Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: AW: xtmixed regression lines


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: xtmixed regression lines
Date   Tue, 22 Sep 2009 18:09:45 +0200

<> 


Perhaps you can phrase your problem in terms of this code, so your question
is easier to answer:



*************
// to simulate -xtmixed-
//22.09.2009 17:29:43
//generates panel with 1000 subjects observed over 10 years

clear*
set obs 1000

//id
gen id=_n
lab var id "Person ID"
//individual effect
gen alpha=rnormal()
label var alpha "Individual Effect"
//random part of coeff
gen rand=rnormal()

//expand to # of time periods
expand 10
//get time period (after expansion!)
bys id: gen time=_n
lab var time "Time Period"
//residual per time period
gen eps=rnormal()
lab var eps "Idiosyncratic Shock"

//covariate
gen byte ses=runiform()<.3
gen timeses=time*ses

//DGP
gen w1=1+alpha+(2+rand)*time+ /* 
*/ 0.3*ses+timeses+eps

gen wfinal=2+alpha+(1+rand)*time+ /* 
*/ 0.4*ses+.8*timeses+eps

compress
xtmixed wfinal time ses timeses  /* 
*/  || id: time, covariance(uns) variance
predict predwfinal, xb

xtmixed w1 time ses timeses  /* 
*/  || id: time, covariance(uns) variance
predict predw1, xb

tw (line predwfinal time if ses==1)  /* 
*/ (line predwfinal time if ses==0)  /* 
*/ (line predw1 time if ses==1)  /* 
*/ (line predw1 time if ses==0)
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Debs Majumdar
Gesendet: Dienstag, 22. September 2009 17:21
An: [email protected]
Betreff: st: xtmixed regression lines

Hello  Stata users,

   I ran the following two models:

xtmixed w1 time ses time*ses  || id: time, covariance(uns) variance
 
and 
 
xtmixed wfinal time ses time*ses  || id: time, covariance(uns) variance
 
where ses was coded as 1 for high and 0 for low.
 
I want to construct regression lines based on the two models. Basically, I
am looking for four regression lines for comparison purposes (Two lines
(with w1 and wfinal) for high ses and two for low ses on the same graph for
comparison purposes).

I am not sure how to do that.  Any thoughts on how to get all the 4 lines on
the same graph?

 Thanks,

  Debs


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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