Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Conditional probabilities with one fixed effect at a constant


From   Michael Ingre <[email protected]>
To   [email protected]
Subject   Re: st: Conditional probabilities with one fixed effect at a constant
Date   Tue, 6 Jul 2004 20:25:19 +0200

On 2004-07-06, at 15.58, Winfield Scott Burhans wrote:

Michael,
Can't you do this by creating a dataset of observations with the fixed
values you want, appending it to the full dataset, and using the -fsample-
option of gllapred?

Buzz Burhans

Thanks Buzz,

Great idea. And it might have worked too. But to tell you the truth, I don't understand how.
I might have misunderstood you but I tried something like the syntax below:

. gllamm resp _Iday_1 _Iday_3 leng _IdayXleng_1 _IdayXleng_3 time _IdayXtime_1 _IdayXtime_ ///
. , i(id) nrf(3) eqs(intercept leng time) link(logit) fam(binomial) adapt

. estsave , gen(es_model1)
. save data1

. drop es_model1
. replace time = 4
. replace _IdayXtime_1 = 4 if _IdayXtime_1 > 0
. replace _IdayXtime_3 = 4 if _IdayXtime_3 > 0
. save data2

. use data1
. estsave , from(es_model1)
. generate model = 1
. append using data2
. replace model = 2 if model == .
. gllapred prob if model == 2 , mu fsample

If I plot the probabilities, the graphs look great. And exactly as I thought they would (or better).

However, I have trouble understanding how -gllapred- would know the subject specific levels of the random factors when I do like this. Are they really the same as in the estimation sample? Am I doing the right thing?

I appreciate any explanations that would help me understand this. My paper is soon to be submitted (hopefully).

Thanks again Buzz.

If this works, I owe you two by now.

Michael





Dear list

I would like to predict (and plot) conditional probabilities for a
response as a function of one independent variable keeping a second
variable at a constant.

More specifically, I would like to plot the predicted probabilities for
_leng_ by _day_ while _time_ == 4 from the model below.

It is very easy to predict probabilities keeping the random effects at
a given value with -gllapred- but I have yet to find a way for keeping
a fixed effect in -gllamm- at a constant.

I appreciate all suggestions.

I think it must be possible to first predict the fixed effects from the
model with _time_ at a constant (4) and then add the random effects
from the intercept and the random effect of _leng_.

Thanks for your time.

Michael


Partial display of model:

. gen const = 1
. eq intercept: const
. eq time: time
. eq leng: leng

. char day[omit] 2

. xi i.day*leng i.day*time
. xi: gllamm resp _Iday_1 _Iday_3 leng _IdayXleng_1 _IdayXleng_3 time
_IdayXtime_1 _IdayXtime_ ///
. , i(id) nrf(3) eqs(intercept leng time) link(logit) fam(binomial)
adapt

---------------------------------------------------------------------- --
------
resp | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------
+----------------------------------------------------------------
_Iday_1 | .5922521 .893279 0.66 0.507 -1.158543
2.343047
_Iday_3 | .2531786 .9334512 0.27 0.786 -1.576352
2.082709
leng | 1.571584 1.170692 1.34 0.179 -.7229305
3.866099
_IdayXleng_1 | 2.473041 1.195547 2.07 0.039 .1298116
4.81627
_IdayXleng_3 | .4036673 1.225166 0.33 0.742 -1.997614
2.804949
time | .2418225 .2774821 0.87 0.383 -.3020324
.7856774
_IdayXtime_1 | -.1086444 .2195245 -0.49 0.621 -.5389045
.3216156
_IdayXtime_3 | .2298701 .2278498 1.01 0.313 -.2167072
.6764475
_cons | -5.118715 1.023391 -5.00 0.000 -7.124525
-3.112905
---------------------------------------------------------------------- --
------

Variances and covariances of random effects
---------------------------------------------------------------------- --
------


***level 2 (subject)

var(1): 4.0975884 (2.5381436)
cov(2,1): -1.2187546 (1.9747622) cor(2,1): -.41187287

var(2): 2.1368686 (2.1924798)
cov(3,1): -.37716119 (.56908407) cor(3,1): -.26415951
cov(3,2): -.79399432 (.56427558) cor(3,2): -.77007299

var(3): .49750012 (.24800011)
---------------------------------------------------------------------- --
------



------------------------------------------------
Michael Ingre , PhD student & Research Associate
Department of Psychology, Stockholm University &
National Institute for Psychosocial Medicine IPM
Box 230, 171 77 Stockholm, Sweden

*
* 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/


------------------------------------------------
Michael Ingre , PhD student & Research Associate
Department of Psychology, Stockholm University &
National Institute for Psychosocial Medicine IPM
Box 230, 171 77 Stockholm, Sweden

*
*   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