econometrics

Propensity score matching in R

I wrote an introductory tutorial on how to perform propensity score matching using R, which has been posted on my RPubs site (link).

Propensity score matching is a statistical approach to balancing the observed covariates between groups. In observational studies, this method has the potential to mitigate potential confounding and allow us to make causal interpretations. However, there are a lot of approaches and nuances. This intorductory tutorial presents the basics of propensity score methods and how we can use these in our conventional analyses.

Stata - marginsplot & mplotoffset commands for plotting average marginal effects

In Stata, users have a lot of flexibility with creating plots, particularly after the margins command has been executed. Once a regression command has been run, users can estimate the average marginal effect of a factor with respect to another variable using the margins command in Stata. Once the average marginal effect has been estimated, users can plot this using the marginsplot or mplotoffset commands. These are power tools that allow us to visualize the average marginal effects, particularly when we have interaction terms.

I posted a tutorail on my RPubs site that revieweed some basic features of the marginsplot and mplotoffset commands and provide some practical examples of customization.

Prepost analysis with continuous data using R - Part 1

I wrote a tutorial on how to perform simple prepost analysis using R, which is available on my RPubs page. It covers how to compare two differences (change in value before and after an interention) using independent t test and linear regression approaches. However, it doesn’t cover how to address correlation between two dependent values. Part 2 of prepost analysis will cover those issues.

Some cool website on study design and biostatistics

This month (November 2024), I wanted to take a break from writing tutorial and articles. Instead, I wanted update myself on (and share) some very helpful/useful online resources.

A colleague of mine introduced me to website called Datamethods. It’s mainly a discussion forum, but it has some useful resources. This particular post contains references that are very useful for anyone who is interested in study design and biostatistics (link). It is a collection of papers and articles that addresses common myths and practices regarding the application of biostatistics in study designs.

Another great website is Scott Cunningham’s Mixed Taped Sessions. He has a book called Mixed Taped Session about causal inference, and he has regular workshops. I attended his Causal Inference Part 2 workshop, and it was amazing. We learned about the basic difference-in-differences methods (coding in R and Stata), and the innovations surrounding these methods (e.g., Callaway & Sant’Anna’s staggered difference-in-differences approach). Scott also provides the historical perspectives on these methods, which are insightful as they are entertaining. Moreover, he conducts interviews with prominant econometricians, which he posts on his YouTube channel.

Hopefully, these sites are useful for you as they have been for me.

Staggered difference-in-differences using R

I was interested in learning how to apply the Callaway & Sant'Anna staggered difference-in-differences framework to my work. After reading several papers and watching the video by Sant'Anna, I wrote a short tutorial on how to apply this framework to a simulated data. The tutorial is located on my RPubs site.

This is a unique method that used the R “did” package, which is based on the paper by Callaway & Sant’Anna.

Interrupted time series analysis (ITSA) with Stata

Interrupted time series analysis (ITSA) is a study design used to study the effects of an intervention across time. An important feature of the ITSA is the time when the intevention occurs. The time before and after the intervention are of interest because we want to visualize if the trends are similar or different. Additionally, we want to visualize the change immediately after the intervention is implemenated. I call this period the index date.

In this article, I’ll review the single-group ITSA and multiple groups ITSA. Then I’ll review how to perform an ITSA in Stata.

You can view the complete tutorial on my RPubs site.

Empirical Bayes estimates

Recently, my classmate asked me how to perform empirical Bayesian shrinkage, a form of estimation that tries to adjust your sample mean to the grand mean by incorporating more variables. I haven't done this as part of my regular work so I had to review my past class notes.

I forgot how useful empirical Bayes estimates were and wanted to document what I discovered. In my research, I discovered an informative guide by David Robinson who used baseball statistics as a motivating example to explain empirical Bayesian shrinkage on his blog.

In addition, Nicolas Lartillot wrote a great summary of empirical Bayes estimation and Stein's paradox on his blog.