Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: generating predicted values for growth models


From   Amy Hsin <[email protected]>
To   [email protected]
Subject   Re: st: generating predicted values for growth models
Date   Fri, 29 Jun 2012 20:57:16 +0200

Thank you Maarten and William,

Now my question is about the margin command.

When I type the following, I generate predicted values that are
identical to the observed values.

margins, over(asian wave)

This is not what I want.

I would like to generate predicted values for asian==1 and asian==0
for all waves with all other covariates evaluated at the sample mean.

How do I do this?

Thanks in advance.

Amy

On Fri, Jun 29, 2012 at 5:14 PM, William Buchanan
<[email protected]> wrote:
> Hi Amy,
>
> In the syntax that you created the "wave" indicator will be expanded multiple times.  So you've basically written:
>
> xtmixed gpach i.wave i.race i.wave*i.race i.wave i.female i.wave*i.female i.wave c.psescomk8 i.wave*c.psescomk8 etc...
>
> The example that Maarten had sent back to you was an alternative way to notate things so that you could avoid including the same variable multiple times in the same model.  By grouping all of the other variables in the parentheses, you're telling Stata to create the interactions of "i.wave" with the variables that are enclosed in the parentheses.
>
> HTH,
> Billy
>
>
>
> On Jun 29, 2012, at 8:01 AM, Amy Hsin wrote:
>
>> Sorry, I re-ran it exactly as you did and it worked.
>>
>> But what is the difference between what I wrote:
>> xtmixed gpach i.wave##i.asian i.wave##i.female i.wave##c.psescomk8 if
>> gpachmiss!=1 || id: wave , cov(unstructured) variance emiterate(250)
>> mle;
>>
>> And what you wrote:
>> xtmixed gpach i.wave##(i.race i.female c.psescomk8) <other stuff>
>>
>> Are they not the same?
>>
>> Amy
>>
>> On Fri, Jun 29, 2012 at 4:53 PM, Amy Hsin <[email protected]> wrote:
>>> H Maarten,
>>>
>>> Thanks! That was helpful.  However, I still encounter the same problem
>>> when I revise the code.
>>>
>>> Now the command is the following.  However, the predicted values
>>> remain unchanged (i.e. they are the same as the observed).  Any
>>> suggestions?
>>>
>>>>
>>> margins, over(asian wave);
>>>
>>>
>>> Thank you,
>>> Amy
>>>
>>> On Fri, Jun 29, 2012 at 4:23 PM, Maarten Buis <[email protected]> wrote:
>>>> One thing you did wrong is that you used the -xi:- prefix and the
>>>> -margins- post-estimation command. -margins- needs to know about the
>>>> interactions you created, and -xi:- will does not leave that
>>>> information behind. So you need to use the factor variable notation
>>>> instead, see -help fvvarlist-. Translating your command would be:
>>>>
>>>>  xtmixed gpach i.wave##(i.race i.female c.psescomk8) <other stuff>
>>>>
>>>> -- Maarten
>>>>
>>>> On Fri, Jun 29, 2012 at 4:03 PM, Amy Hsin wrote:
>>>>> Hi,
>>>>>
>>>>> I am trying to generate predicted values from linear growth curves and
>>>>> am running into problems. The predicted values that I am generating
>>>>> using models that adjusts for a variety of covariates are the same as
>>>>> the observed values, which does not make sense. Is there something
>>>>> that I am obviously doing wrong?
>>>>>
>>>>> Here is a simplified version of my model.
>>>>>
>>>>> xi: xtmixed gpach i.wave*race i.wave*female i.wave*psescomk8 if
>>>>> gpachmiss!=1 || id: wave , cov(unstructured) variance emiterate(250)
>>>>> mle;
>>>>> margins, over(race wave);
>>>>>
>>>>> -gpach are test scores evaluated at time 0, 1, 2 and 3
>>>>> -race and female are both dichotomous variables
>>>>> -psescomk8 a time invariant continuous covariate
>>>>> In this model, I'd like to measure time nonparametrically so I am
>>>>> including it as a series of dummy variables.
>>>>> When I use the "margins" command to estimate predicted test scores for
>>>>> each racial category at each point in time, I get values that are
>>>>> identical to the observed values.
>>>>>
>>>>> Any ideas as to what I am doing wrong?
>>>>>
>>>>> Thank you in advance.
>>>>>
>>>>>
>>>>> Amy Hsin
>>>>> *
>>>>> *   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/
>>>>
>>>>
>>>>
>>>> --
>>>> --------------------------
>>>> Maarten L. Buis
>>>> Institut fuer Soziologie
>>>> Universitaet Tuebingen
>>>> Wilhelmstrasse 36
>>>> 72074 Tuebingen
>>>> Germany
>>>>
>>>>
>>>> http://www.maartenbuis.nl
>>>> --------------------------
>>>>
>>>> *
>>>> *   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/
>>>
>>>
>>>
>>> --
>>> Amy Hsin
>>> Assistant Professor of Sociology
>>> Queens College, City University of New York
>>> http://qcpages.qc.cuny.edu/~ahsin
>>
>>
>>
>> --
>> Amy Hsin
>> Assistant Professor of Sociology
>> Queens College, City University of New York
>> http://qcpages.qc.cuny.edu/~ahsin
>>
>> *
>> *   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/



-- 
Amy Hsin
Assistant Professor of Sociology
Queens College, City University of New York
http://qcpages.qc.cuny.edu/~ahsin

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index