<>
If you do insist on a -program- to return the values:
**************
webuse docvisits, clear
//drop it beforehand
capt prog drop sim
//define the program
program define sim
version 10.1
syntax [, SAMplesize(integer 1000)]
//estimate
gmm (docvis - exp({xb:private chronic /*
*/ female income} + {b0})) in 1/`samplesize', /*
*/instruments(private chronic female age black/*
*/ hispanic) deriv(/xb = -1*exp({xb:} + {b0})) /*
*/deriv(/b0 = -1*exp({xb:} + {b0})) /*
*/twostep nolog
//test
estat overid
end
//for sample sizes from 100 to 4000
forv i=100(100)4000{
qui sim, sam(`i')
di in red _n(2) /*
*/"Returned Values for `i' obs"
ret li
}
**************
HTH
Martin
-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of John Antonakis
Sent: Samstag, 19. September 2009 09:56
To: statalist@hsphsun2.harvard.edu
Subject: st: Simulation: return overidentifying statistics
Hi:
I would like to do a Monte Carlo to see how the Hansen J test behaves
when varying sample size.
I can't figure out how to return and simulate the chi-square, df, and
p-values for each run.
Best,
John.