Presentation
Object-oriented programming in Mata
Daniel C. Schneider
7 September 2023
Session
Object-oriented programming (OOP) is a programming paradigm that is ubiquitous in today's landscape of programming languages.
This presentation explores OOP features in Mata by describing the code behind dtms, a community-contributed package for discrete-time multistate model estimation. Estimation in dtms proceeds in several steps, where each step can nest multiple results of the next level, thus building up a treelike structure of results. The presentation explains how this treelike structure is implemented in Mata using OOP, and what the benefits of using OOP for this task are. These include easier code maintenance via a more transparent code structure, shorter coding time, and an easier implementation of efficient calculations.
The presentation will at first provide simple examples of useful classes; for example, a class that represents a Stata matrix in Mata, or a class that can grab, hold, and restore Stata e()-results. More complex relationships among classes will then be explored in the context of the treelike results structure of dtms. While topics covered will include such technically sounding concepts as class composition, self-threading code, inheritance, and polymorphism, an effort will be made to link these concepts to tasks that are relevant to Stata users that have already gained or are interested in gaining an initial proficiency of Mata.
Validate your login
Se connecter
Créer un nouveau compte