Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

RE: st: marginsplot after xtmixed with square term


From   "Sun, Wensheng" <wsun@bcm.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: marginsplot after xtmixed with square term
Date   Wed, 13 Mar 2013 20:55:23 -0500

Hi Scott, 

It works. By the way, could you explain what "i.pressure c.repl##c.repl##i.pressure" means?

Thank you very much!

Wensheng 

________________________________________
From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] On Behalf Of Scott Merryman [scott.merryman@gmail.com]
Sent: Wednesday, March 13, 2013 8:09 PM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: marginsplot after xtmixed with square term

Stata does not know that repl2 is the square of repl.

Try:


webuse acmemanuf
lowess y repl, by(pressure)
//gen repl2=repl^2
gen id=.
replace id=temp if pressure==1
replace id=temp+3 if pressure==2
replace pressure=0 if pressure==1
replace pressure=1 if pressure==2
xtmixed y  i.pressure c.repl##c.repl##i.pressure  || id: repl,
cov(uns) res(ind) mle variance
margins pressure, at(repl=(1(1)10))
marginsplot

Scott


On Wed, Mar 13, 2013 at 12:43 PM, Sun, Wensheng <wsun@bcm.edu> wrote:
> Please help! Marginsplot after xtmixed model contend square-term (wish to get concaved curves instead of straight lines).
> webuse acmemanuf
> lowess y repl, by(pressure)
> gen repl2=repl^2
> gen id=.
> replace id=temp if pressure==1
> replace id=temp+3 if pressure==2
> replace pressure=0 if pressure==1
> replace pressure=1 if pressure==2
> xtmixed y c.repl## i.pressure c.repl2##i.pressure  || id: repl, cov(uns) res(ind) mle variance
> margins pressure, at(repl=(1(1)10))
> marginsplot
>
> I expected to get concaved curves from marginsplot like I usually got from modeling estimates with square terms; however, what I got here were two straight lines. Please help me to fix my codes.
>
> Thank you very much!
>
> Wensheng
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index