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

# re: st: margins after split-plot anova

 From Luca Campanelli <[email protected]> To "[email protected]" <[email protected]> Subject re: st: margins after split-plot anova Date Sat, 23 Jun 2012 00:09:48 +0100 (BST)

```Thank you.
In the following example the option at() does not work (not estimable):

anova depvar c.IQ group / id|group label label#group label#c.IQ , repeated (label)
margins, within(group) at( IQ=(1))

There is something about having a continuous covariate in the anova model that I’m missing or that does not work in Stata.

Let’s look at the following examples:
- no continuous covariate:
1) anova depvar group / id|group label label#group, repeated (label)
margins, within(group)

2) regress depvar group label label#group
margins group

- with continuous covariate:
3) anova depvar c.IQ group / id|group label label#group label#c.IQ , repeated (label)
margins, within(group)

4)regress depvar c.IQ group label label#group label#c.IQ
margins group

The output of margins in 1), 2), AND 3) are equal. The output of 4) is (correctly) different from 1) and 2), because 4) includes a continuous covariate that is not present in 1) and 2).
And the problem (again, perhaps I’m missing something simple, but I don’t know what) is that the outcome of margins in 3) is equal to the outcome of margins in 1) and 2).

Thank you again for any help anybody can provide.
Luca

-----------previous message--------------

You might have to combine your working syntax with the at() option to get the margins at different covariate values. See the at() option for margins.

> Thank you very much, David.
> This works:
>
> anova depvar c.IQ  group / id|group label  label#group  label#c.IQ ,  repeated (label)
> margins, within(group)
>
> However it seems that margins does not take into account the continuous covariate in the model (c.IQ). In other words, “margins, within(group)” produces the same results after this
> anova depvar c.IQ  group / id|group label  label#group  label#c.IQ ,  repeated (label)
> and after this
> anova depvar  group / id|group label  label#group ,  repeated (label)
> (spss produces different estimates for the model with or without continuous covariate, which makes sense).
> The options atmenas / asbalanced don’t change the results.
>
> Any idea why?
>
> Thank you,
> Luca

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