Hi,
I am new user to Stata forum. I have been working with a two year repeated cross-sectional data for my study. I am trying to implement the kernel matching method using the diff command with rcs and kernel options. With these two options I am also trying to attain bootstrapped standard errors for several outcomes in a loop. I have faced two issues while using this command and would appreciate if someone could help with the same:
1. When I run the diff rcs kernel with bootstrap option, the command always gives an error "_weights not found". I was able to fix this when I removed "varabbrev off" - I figured that the program picks up the nearest names to _weight available but it would be good to have the command run even when the variable abbreviations are off.
2. I have been stuck to be able to replicate the same results when I run the command again and again with bootstrap option. I face this problem even when I set a random seed or stable sort my dataset (more specifically with rcs kernel options). As a solution to this, I tried using the weights generated by the diff command and ran my own pooled weighted regression with bootstrapped standard errors which I am able to replicate each time it (though not same standard errors as the diff command) is ran but it is also not the best solution. Would there be a way to do this using the diff command rather than running manual weighted regression?
The problem can be seen when it run on the example dataset as well:
use "https://ift.tt/29Ffn9K", clear
*Problem 1
set varabbrev off // short variable names unacceptable
diff fte, t(treated) p(t) cov(bk kfc roys) kernel rcs support logit bs reps(50)
**Solution
set varabbrev on // short variable names acceptable
diff fte, t(treated) p(t) cov(bk kfc roys) kernel rcs support logit bs reps(50)
use "https://ift.tt/29Ffn9K", clear
set varabbrev on // short variable names acceptable
*Problem 2
diff fte, t(treated) p(t) cov(bk kfc roys) kernel rcs support logit bs reps(50)
diff fte, t(treated) p(t) cov(bk kfc roys) kernel rcs support logit bs reps(50) // different results
**Solution
diff fte, t(treated) p(t) cov(bk kfc roys) kernel rcs support logit bs reps(50) // different results
sort id treated t, stable
bs, seed(12345678) reps(100): diffbs fte t treated _diff if fte!=. & _support==1 // try bootstrap with regression weights. diffbs is a program that diff command uses for weighted bs regression (the last weight "_weight_rcs" and "_support" created is used from the diff command ) - result replicates each time though not same as diff se's
Would appreciate any help.
Thanks,
Shivani
Related Posts with diff command (rcs and bootstrap option) - results replication issue*
interaction variable with i. operatorI want to run the following regression Code: reghdfe ABPROD BORDERLINE POST BORDERLINE_POST i.sic…
Creating a day variableI want to create a continuous day variable from January 1, 1991, to June 12, 1991. For instance, I e…
Loop to create new variablesDear All I am working on a data set where I have to create (project) variables for age and position…
output from outreg2.Dear All, With given data, I run the following regressions and use (ssc install) outreg2 to construc…
Double loops in Stata?Dear All, I want to do the following: Code: local replace replace forvalues i = 2007(1)2017 { for…
Subscribe to:
Post Comments (Atom)
0 Response to diff command (rcs and bootstrap option) - results replication issue*
Post a Comment