I want to run one-sample test of proportion using following data and save p-val for each obs.
prtesti #obs1 #p1 #p2
I tried the following program. The program is working for fist values only. Can someone tell me where is the problem with my program?
Thanks.
Nizam
gen pval=.
local N = _N
forvalues i = 1/`N' {
prtesti `=obs1' `=p1' `=p2'
local p= 2*(normprob(-abs(r(z))))
replace pval=`p'
}
obs1 | p1 | p2 | pval |
1273314 | 0.5256 | 0.5150 | |
1631438 | 0.5278 | 0.5150 | |
1686524 | 0.5214 | 0.5150 | |
1980880 | 0.5298 | 0.5120 | |
8187141 | 0.5158 | 0.5175 | |
5386442 | 0.5193 | 0.5175 | |
4701894 | 0.4823 | 0.5173 | |
4232052 | 0.5311 | 0.5170 |
0 Response to Looping over observation
Post a Comment