Hi,
I want to randomly assign treatment and run the same regression in the loop for 50 times and then I want to see how many times my variable of interest (POST) is significant. It's better if I can store the estimate with the p-value (or in a star representation). I tried the following. Where am I going wrong? Any help is appreciated.
drop post
drop random
foreach i of numlist 1/50 {
generate random=uniform()
sort random
generate post=0
replace post=1 in 1/50
tsset id year
set matsize 800
set more off
reg agriculture post i.country_id i.year i.country#c.line_time_trend [aw=ypop], cluster( country_id )
est sto b_1
esttab b_1,keep( post ) se star(* 0.10 ** 0.05 *** 0.001)
est clear //estimates clear
matrix p = J(`post',1,.)
matrix rownames p = `y'
matrix colnames p = "p"
matlist p
// for the computation of the p-values
local i = 1
foreach var of local y {
reg `var' post
matrix p[`i++',1] = 2*ttail(e(df_r), abs(_b[post]/_se[post]))
}
//
matlist p
}
Related Posts with random treatment,50 times loop and store the estimate with p value for the variable of interest (POST) and display.
PPML Reset Test ResultHello to all of you. I have been working in a gravity model with 133 countries from 2005 to 2018 (O…
Statistical formula for calculating 95% CIs from two geometric meansHello, I have the following data: Group 1: Mean = 8985, confidence intervals = 5705–14150 67 peopl…
hettest : Different results from regressionHi, I have a model with 3 nominal independent variables. Three dummy variables are used for the firs…
Stata Tabulate command & finding the most optimised modelHi statalists! I am very new to Stata - have just started my econometrics course and I am actually …
LM Test Result in Random Effect ModelDear members, I'm quite newbie here. I'm so confused in determining the perfect model for my regress…
Subscribe to:
Post Comments (Atom)
0 Response to random treatment,50 times loop and store the estimate with p value for the variable of interest (POST) and display.
Post a Comment