Re: [R] mixed model MANCOVA

2008-09-10 Thread John Fox
Dear Erika et al.,

I'm not sure exactly what you want to do, but you might take a look at the
Anova() function in the car package, which will compute "type-II" or
"type-III" tests for multivariate linear models, including models with
repeated measures; you can also get the traditional univariate tests. Be
very careful of Type-III tests, especially if the covariate is involved in
interactions, since it's very easy to test strange hypotheses (as is true
even in a univariate context). There are some examples of repeated-measures
ANOVAs and MANOVAs in ?Anova.

I hope this helps,
  John

--
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On
> Behalf Of hadley wickham
> Sent: September-10-08 8:53 PM
> To: Erika Crispo
> Cc: r-help@r-project.org
> Subject: Re: [R] mixed model MANCOVA
> 
> On Mon, Sep 8, 2008 at 1:06 PM, Erika Crispo
> <[EMAIL PROTECTED]> wrote:
> > Hello,
> >
> > I need to perform a mixed-model (with nesting) MANCOVA, using Type III
sums
> of squares. I know how to perform each of these types of tests
individually,
> but I am not sure if performing a mixed-model MANCOVA is possible. Please
let
> me know.
> 
> Why?  What is the purpose of your analysis?  Why do you think a
> mixed-effects MANCOVA is appropriate? What have simpler models told
> you about the data?  What exploratory graphics have you done?
> 
> Hadley
> 
> 
> --
> http://had.co.nz/
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] mixed model MANCOVA

2008-09-10 Thread hadley wickham
On Mon, Sep 8, 2008 at 1:06 PM, Erika Crispo
<[EMAIL PROTECTED]> wrote:
> Hello,
>
> I need to perform a mixed-model (with nesting) MANCOVA, using Type III sums 
> of squares. I know how to perform each of these types of tests individually, 
> but I am not sure if performing a mixed-model MANCOVA is possible. Please let 
> me know.

Why?  What is the purpose of your analysis?  Why do you think a
mixed-effects MANCOVA is appropriate? What have simpler models told
you about the data?  What exploratory graphics have you done?

Hadley


-- 
http://had.co.nz/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] mixed model MANCOVA

2008-09-10 Thread Adam D. I. Kramer

Hi Erika,

As mentioned, I haven't run the model before and I don't have access
to your data set, so you might want to post your reply to the list as well
(cc'd again).

As another guessing-without-trying-anything, I'd first make sure
that in fact pop and family are factor variables with the same length as
a,b,c,treat,centroidsize.

Also having not used glmer before, I'm not sure how to get the p
values...since estimates and std. errors and t-values are reported, the df's
are likely known and so they probably exist in the "model" object you
created. Of course, your highest t-value is 1.92, so none of your fixed
effects would be significant at the .05 level (the two-tailed z-score cutoff
is 1.93, which is the limit for t).

--Adam

On Wed, 10 Sep 2008, Erika Crispo wrote:


Thanks! I am still having some problems. I have tried the following:


model=glmer(cbind(a,b,c)~pop*treat+centroidsize+(1|pop/family))

Error: Matrices must have same number of columns in rbind2(..1, r)
In addition: Warning messages:
1: In family:pop :
numerical expression has 104 elements: only the first used
2: In family:pop :
numerical expression has 104 elements: only the first used




I don't get the error messages if I exclude the nesting (i.e. exclude pop on 
the RHS). But even then, I don't know how to interpret the output. How can I 
get P values for pop and treat? I've attached my data file.



summary(model)

Linear mixed model fit by REML
Formula: cbind(a, b, c) ~ pop * treat + centroidsize + (1 | family)
  AICBIC logLik deviance REMLdev
-685.3 -656.2  353.6   -822.8  -707.3
Random effects:
Groups   NameVariance   Std.Dev.
family   (Intercept) 9.8877e-13 9.9437e-07
Residual 2.3502e-05 4.8478e-03
Number of obs: 104, groups: family, 28

Fixed effects:
   Estimate Std. Error t value
(Intercept) 4.518e-03  4.329e-03  1.0438
popkah -2.338e-03  1.902e-03 -1.2297
popkant-2.328e-03  1.881e-03 -1.2380
poprwe -3.728e-03  1.941e-03 -1.9204
treatn -8.703e-04  1.957e-03 -0.4448
centroidsize-1.886e-06  2.464e-06 -0.7656
popkah:treatn   3.440e-03  2.695e-03  1.2765
popkant:treatn  1.198e-03  2.699e-03  0.4439
poprwe:treatn   4.662e-03  2.746e-03  1.6976

Correlation of Fixed Effects:
  (Intr) popkah popknt poprwe treatn cntdsz ppkh:t ppknt:
popkah  -0.228
popkant -0.335  0.507
poprwe  -0.193  0.490  0.492
treatn  -0.092  0.485  0.476  0.479
centroidsize -0.951  0.009  0.119 -0.023 -0.128
popkah:trtn  0.121 -0.705 -0.352 -0.346 -0.719  0.036
popknt:trtn  0.095 -0.352 -0.680 -0.347 -0.721  0.063  0.520
poprwe:trtn  0.117 -0.346 -0.346 -0.707 -0.706  0.037  0.510  0.511


<>< <>< <>< <>< <>< <>< <><
Erika Crispo, PhD candidate
McGill University, Department of Biology
http://www.biology.mcgill.ca/grad/erika/index.htm

<> ><> ><> ><> ><> ><> ><>
----- Original Message - From: "Adam D. I. Kramer" 
<[EMAIL PROTECTED]>

To: "Erika Crispo" <[EMAIL PROTECTED]>
Cc: 
Sent: Wednesday, September 10, 2008 5:47 PM
Subject: Re: [R] mixed model MANCOVA



Hi Erika,

 I have not tried this before, and I hope that somebody will correct
me if I'm wrong, but the glmer function in the lme4 library appears to do
what you want. From examples(lmer):

lmer> (gm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 |
herd), family = binomial, data = cbpp))

...I guess that this will do what you want it to because it has multiple
variables on the LHS and both continuous and categorical variables on the
RHS, along with an explicit grouping structure.

In your case, you probably want to leave the family= argument out, as noted
in ?glmer, "If 'family' is missing then a linear mixed model is fit;
otherwise a generalized linear mixed model is fit." ...MANCOVA tend to be
generalized linear models.

Once again, though, I have not used this system personally, haven't seen
your data, and don't know what output to expect. Hopefully somebody else 
can

confirm or deny this solution's efficacy.

--Adam

On Mon, 8 Sep 2008, Erika Crispo wrote:


Hello,

I need to perform a mixed-model (with nesting) MANCOVA, using Type III
sums of squares. I know how to perform each of these types of tests
individually, but I am not sure if performing a mixed-model MANCOVA is
possible. Please let me know.

Erika

<>< <>< <>< <>< <>< <>< <><
Erika Crispo, PhD candidate
McGill University, Department of Biology
http://www.biology.mcgill.ca/grad/erika/index.htm

<> ><> ><>

Re: [R] mixed model MANCOVA

2008-09-10 Thread Adam D. I. Kramer

Hi Erika,

I have not tried this before, and I hope that somebody will correct
me if I'm wrong, but the glmer function in the lme4 library appears to do
what you want. From examples(lmer):

lmer> (gm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 |
herd), family = binomial, data = cbpp))

...I guess that this will do what you want it to because it has multiple
variables on the LHS and both continuous and categorical variables on the
RHS, along with an explicit grouping structure.

In your case, you probably want to leave the family= argument out, as noted
in ?glmer, "If 'family' is missing then a linear mixed model is fit;
otherwise a generalized linear mixed model is fit." ...MANCOVA tend to be
generalized linear models.

Once again, though, I have not used this system personally, haven't seen
your data, and don't know what output to expect. Hopefully somebody else can
confirm or deny this solution's efficacy.

--Adam

On Mon, 8 Sep 2008, Erika Crispo wrote:


Hello,

I need to perform a mixed-model (with nesting) MANCOVA, using Type III
sums of squares. I know how to perform each of these types of tests
individually, but I am not sure if performing a mixed-model MANCOVA is
possible. Please let me know.

Erika

<>< <>< <>< <>< <>< <>< <><
Erika Crispo, PhD candidate
McGill University, Department of Biology
http://www.biology.mcgill.ca/grad/erika/index.htm

<> ><> ><> ><> ><> ><> ><>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] mixed model MANCOVA

2008-09-08 Thread Erika Crispo



  Hello,

  I need to perform a mixed-model (with nesting) MANCOVA, using Type III sums 
of squares. I know how to perform each of these types of tests individually, 
but I am not sure if performing a mixed-model MANCOVA is possible. Please let 
me know.

  Erika 

  <>< <>< <>< <>< <>< <>< <><
  Erika Crispo, PhD candidate
  McGill University, Department of Biology
  http://www.biology.mcgill.ca/grad/erika/index.htm
  ><> ><> ><> ><> ><> ><> ><>
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] mixed model MANCOVA

2008-09-08 Thread Erika Crispo
Hello,

I need to perform a mixed-model (with nesting) MANCOVA, using Type III sums of 
squares. I know how to perform each of these types of tests individually, but I 
am not sure if performing a mixed-model MANCOVA is possible. Please let me know.

Erika 

<>< <>< <>< <>< <>< <>< <><
Erika Crispo, PhD candidate
McGill University, Department of Biology
http://www.biology.mcgill.ca/grad/erika/index.htm
><> ><> ><> ><> ><> ><> ><>
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.