is there an equivalent Rstudio command to stata "diff" command? (it does diff in diff estimation)

Hi there,
is there an equivalent Rstudio command to stata "diff" command?
I wanna implement the diff in diff estimation using panel data
cheers :slight_smile:
Maria

There's the {did} package that does Difference in Differences with multiple periods and variation in treatment timing.

thanks so much mduvekot!

after installing and downloading the did package I run
model <- did(formula = emptot ~ treated + t + t_treated, data = cyk)
and the following error message prompted out, please, how can I sorted it out?
could not find function "did"

You need to load the package by running

library(did)

before you use the functions in the package.

sure, I already did it, FJCC, thank you, what else can be behind this error?
I installed did package
library (did)
model <- did(formula = emptot ~ treated + t + t_treated, data = cyk)
and the following error message prompted out, please, how can I sorted it out?
could not find function "did"

did is not a function in the did package

> # what are all the exported functions in the did package?
> library(did)
> ls("package:did")
 [1] "aggte"                   "AGGTEobj"               
 [3] "att_gt"                  "build_sim_dataset"      
 [5] "compute.aggte"           "compute.att_gt"         
 [7] "conditional_did_pretest" "DIDparams"              
 [9] "ggdid"                   "glance"                 
[11] "gplot"                   "indicator"              
[13] "mboot"                   "MP"                     
[15] "MP.TEST"                 "mpdta"                  
[17] "pre_process_did"         "process_attgt"          
[19] "reset.sim"               "sim"                    
[21] "splot"                   "test.mboot"             
[23] "tidy"                    "trimmer"   

you might want to start with

vignette("did-basics", package="did")

Than you! I'll try it

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.