Greetings Clarify-Users,
Below I've pasted annotated Stata code for generating simulated
probabilites for xtprobit, a panel model not currently supported in
Clarify. The code is set up for a binary dependent variable, y, and 5
independent variables x1-x5.
The code seems to work, but no guarantees! I'd be delighted to get
comments if problems are identified. I tried the code out using the
probit model so that I could compare with Clarify. The simulations were
pretty much the same, though this code took a lot longer to run than
Clarify.
Thanks for any input.
Colin
Colin Vance, Ph.D.
German Aerospace Center
Institute of Transport Research
Rutherfordstrasse 2
12489 Berlin
Germany
tel: +49 30 67055147
fax: +49 30 67055202
email: colin.vance(a)dlr.de
Here's the code:
#delimit;
xtprobit y x1 x2 x3 x4 x5;
matrix params = e(b);
matrix P=e(V);
drawnorm b1-b7, means(params) cov(P) double;
/*7 simulated parameters are drawn: 5 of which are for the x's, 1
constant, and lnsig2u, which is the panel level variance component*/
local d=18;
while `d' <=80 {;
/*pretend x5 measures age and the goal is to simulate predicted
probabilities for persons aged 18 to 80 holding all other variables at
the mean values, the above sets up the outer loop to do this*/
local i=1;
generate based`d'=.;
while `i' <=1000 {;
/*the inner loop generates 1000 simulated values for each age level*/
quietly generate model= (b1[`i']*2.512424)+(b2[`i']* .357981)+(b3[`i']*
1.076852) + (b4[`i']*11.5) + (b5[`i']*`d') + b6[`i'];
/*this generates the linear prediction with all variables set at the
mean value except for age, b6 is the constant term*/
quietly generate prob=norm(model);
/*converts linear prediction to probability*/
quietly summarize prob, meanonly;
quietly replace based`d'=r(mean) in `i';
drop model prob;
disp `i';
local i=`i'+1;
};
local d=`d'+1;
};
/*produces 62 variables of 1000 observations labeled based18-based80,
these are the simulated predicted probabilities*/
#delimit cr
--
Clarify mailing list served by Harvard-MIT Data Center
[Un]Subscribe/View Archive: http://lists.hmdc.harvard.edu/?info=clarify
---------- Forwarded message ----------
Date: Mon, 16 May 2005 14:16:58 -0700
From: "Vuchinich, Samuel" <vuchinis(a)oregonstate.edu>
To: king(a)harvard.edu
Subject: Clarify
Will Clarify work with the xtmixed Stata command for mixed models (new
in Stata 9).
Prof. Sam Vuchinich
Department of Human Development and Family Sciences
Oregon State University
vuchinis(a)orst.edu
--
Clarify mailing list served by Harvard-MIT Data Center
[Un]Subscribe/View Archive: http://lists.hmdc.harvard.edu/?info=clarify