Hi,
I am running a simulation to compute the frequency of a p_value less than 0.05. My code is as followed:
Code:
scalar sim=100
scalar n=100
local alpha=0.05
forvalues j=1/'=scalar(sim)'{
        forvalues i=1/`scalar(n)'{
        regress y x1 x2 x3
        local t=_b[x1]/_se[x1]
        local pi=2*ttail(e(df_r),abs(`t')
        local count=`count'+(`pi'<'alpha')
}
scalar p=`count'/scalar(n)
putexcel set myresults, modify
putexcel (A2)=(p)
}
The idea is to save all p after each simulation, because I would like to check the distribution of p. Can you please help me what's wrong with my code?
Thank you so much.

Lanna