Alexandra
Taking a stab at this, I would think, given the binary DV, you could
manually compute either the proportion correctly predicted or the
proportional reduction in error. After your model runs, the predict command
for -xtlogit- can give you the predicted probability that y = 1 assuming the
random effects equal 0...
-predict BIRTH1_p if e(sample), pu0-
The next set of commands will generate the predicted value (1/0) of BIRTH1
for only the estimation sample.
-gen BIRTH1_hat = 0-
-replace BIRTH1_hat = 1 if BIRTH1_p > 0.5-
-replace BIRTH1_hat = . if BIRTH1_p==.-
A simple table can then give you the frequencies to calculate the PCP or
PRE...
-tab BIRTH1 BIRTH1_hat-
There is probably a better solution, but I hope this helps.
Andrew Sidman
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of avwilson
Sent: Thursday, June 21, 2007 5:24 AM
To: [email protected]
Subject: st: goodness of fit with xtlogit
Dear Statalisters,
How do you determine the efficacy of a binary panel regression (xtlogit)? I
(sadly) do not expect that my regression explains much of the variation, as
I am more concerned with looking at the differences between variables, but I
would like to be able to report how much variation is explained.
This regression (output below) looks at the effect of different attributes
of marital status (wstat2-7, and COWIVES), and presence of kin (frel2) on
the probability of giving birth to a surviving child in a particular year
(BIRTH1), controlling for age (using centred age, agem, and centred age
squared, agemsq) and number of previous marriages (PREVMNO).
Any help much appreciated.
With thanks
Alexandra Wilson
tsset PNO YEAR
panel variable: PNO (unbalanced)
time variable: YEAR, 1925 to 1995
. xtlogit BIRTH1 COWIVES PREVMNO wstat2 wstat3 wstat4 wstat5 wstat7 frel2
agem agem
> sq, re
Fitting comparison model:
Iteration 0: log likelihood = -1763.1136
Iteration 1: log likelihood = -1718.3774
Iteration 2: log likelihood = -1716.3233
Iteration 3: log likelihood = -1716.2842
Iteration 4: log likelihood = -1716.2841
Iteration 5: log likelihood = -1716.2841
Fitting full model:
tau = 0.0 log likelihood = -1716.2841
tau = 0.1 log likelihood = -1730.3262
Iteration 0: log likelihood = -1730.3262
Iteration 1: log likelihood = -1719.7053
Iteration 2: log likelihood = -1719.6826
Iteration 3: log likelihood = -1719.6825
Random-effects logistic regression Number of obs =
3312
Group variable (i): PNO Number of groups =
225
Random effects u_i ~ Gaussian Obs per group: min =
1
avg =
14.7
max =
39
Wald chi2(10) =
78.07
Log likelihood = -1719.6825 Prob > chi2 =
0.0000
----------------------------------------------------------------------------
--
BIRTH1 | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+--------------------------------------------------------------
--
COWIVES | -.0704861 .0695551 -1.01 0.311 -.2068116
.0658395
PREVMNO | .0454798 .0963725 0.47 0.637 -.1434069
.2343664
wstat2 | .0397684 .1411743 0.28 0.778 -.2369283
.316465
wstat3 | -.0869622 .1462071 -0.59 0.552 -.3735228
.1995985
wstat4 | -.0178932 .218193 -0.08 0.935 -.4455435
.4097571
wstat5 | .51028 .4929508 1.04 0.301 -.4558858
1.476446
wstat7 | -.273338 1.085847 -0.25 0.801 -2.401558
1.854882
frel2 | .2203837 .0917241 2.40 0.016 .0406078
.4001597
agem | .0328187 .007313 4.49 0.000 .0184854
.0471519
agemsq | -.0048359 .0006084 -7.95 0.000 -.0060283
-.0036435
_cons | -.9936325 .095403 -10.42 0.000 -1.180619
-.8066461
-------------+--------------------------------------------------------------
--
/lnsig2u | -3.828398 .2685797 -4.354804
-3.301991
-------------+--------------------------------------------------------------
--
sigma_u | .1474599 .0198024 .1133356
.1918588
rho | .0065661 .0017519 .0038892
.011065
----------------------------------------------------------------------------
--
Likelihood-ratio test of rho=0: chibar2(01) = 6.80 Prob >= chibar2 =
0.005
.
*
* 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/
*
* 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/