[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
[no subject]
g mean of 100 estimates
0.4 -3.18674
0.3 -3.083586
0.2 -3.056365
0.1 -2.994547
0.05 -2.973532
The divergence may not seem large, but it is consistent for a number of
simulations, and values of nip, so it appears to be a problem.
My question is whether its due to my data set up, my implementation of
the
-gllamm- command, or something else.
Thanks
Michael
(PS My apologies to those who can write elegant/efficient code)
* in the model below there is a 'true' observation of the latent
variable x
* z1-z4 are the 4 measurements of that variable for each individual,
* y is the observed response
* -gllamm- attempts to retrieve the known parameters given only the
values
* of y and z1-z4
* values reported above are the mean of 100 replicates for the 5 values
of g
set matsize 500
matrix result=J(500,6,0)
set more off
foreach num of numlist 1/5 {
foreach iter of numlist 1/100 {
drop *
set obs 500
gen g=0.05
replace g=0.1 if `num'==2
replace g=0.2 if `num'==3
replace g=0.3 if `num'==4
replace g=0.4 if `num'==5
gen err=invnorm(uniform())
gen x=uniform()-0.5
gen ys=1-3*x+err
gen y=0
replace y=1 if ys>0
gen z1=x+g*invnorm(uniform())
gen z2=x+g*invnorm(uniform())
gen z3=x+g*invnorm(uniform())
gen z4=x+g*invnorm(uniform())
gen id=_n
expand 5
sort id
by id: gen t=_n
gen resp=z1
replace resp=z2 if t==2
replace resp=z3 if t==3
replace resp=z4 if t==4
replace resp=y if t==5
gen op1=0
replace op1=1 if t==1
gen op2=0
replace op2=1 if t==2
gen op3=0
replace op3=1 if t==3
gen op4=0
replace op4=1 if t==4
gen yvar=0
replace yvar=1 if t==5
gen var=1
replace var=2 if t==5
eq i1: op1 op2 op3 op4 yvar
gllamm resp yvar op1 op2 op3 op4 , nip(20) nocons i(id) nrf(1) eqs(i1)
link (ident probit) family(gauss binom) lv(var) fv(var) trace adapt
matrix t=e(b)
lincom [id1_1l]_b[yvar]
matrix result[(`num'-1)*100+`iter',1]=t[1,10]
matrix result[(`num'-1)*100+`iter',2]=r(se)
matrix result[(`num'-1)*100+`iter',3]=(exp(t[1,6]))^2
matrix result[(`num'-1)*100+`iter',4]=`num'
matrix list result
}
}
NOTE NEW PHONE NUMBERS
__________________________________________
Dr Michael Burton
Associate Professor
School of Agricultural & Resource Economics (MO89)
Faculty of Natural & Agricultural Sciences
University of Western Australia
35, Stirling Highway
Crawley (Perth), WA 6009 Australia
tel +61 8 6488 2531
fax +61 8 6488 1098
The University of Western Australia: CRICOS Provider No. 00126G
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
© Copyright 1996–2024 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |