Re: [R] Help with seting up comparison

From: Bart Joosen <bartjoosen_at_hotmail.com>
Date: Tue, 08 Jun 2010 05:36:51 +0000

Greg,

the animals are a sample of a larger population, as you guessed.

I used lmer to estimate the effects:

> lmer(Count~Animal | Day, dat)
Linear mixed model fit by REML
Formula: Count ~ Animal | Day

   Data: dat
  AIC BIC logLik deviance REMLdev
 1554 1574 -772 1542 1544
Random effects:

 Groups   Name        Variance   Std.Dev.  Corr  
 Day      (Intercept) 1.7707e-02 0.1330678       
          Animal      4.0287e-05 0.0063472 1.000 
 Residual             2.0917e+00 1.4462790       
Number of obs: 430, groups: Day, 4

Fixed effects:

            Estimate Std. Error t value
(Intercept)   4.2423     0.1257   33.76


But how does this help me to state that there is no effect within an animal? anova doesn't seems to work (gives an empty table) I'm sorry, but I have no experience with lme models, only lm.

Thanks for your time

Bart

> From: Greg.Snow_at_imail.org
> To: bartjoosen@hotmail.com; r-help@r-project.org
> Date: Mon, 7 Jun 2010 14:54:47 -0600
> Subject: RE: [R] Help with seting up comparison
>
> Are you interested in only those 35 animals (not every going to look at any other animals other than those 35, but you want to predict what will happen for those 35)? Or are the 35 animals a sample of a larger population of animals?
>
> If the later (seems the most likely case) then you probably want to use a mixed effects model (nlme or lme4 packages) with animal as a random effect, then just look at the fixed effect of day.
>
> Hope this helps,
>
> --
> Gregory (Greg) L. Snow Ph.D.
> Statistical Data Center
> Intermountain Healthcare
> greg.snow_at_imail.org
> 801.408.8111
>
>
> > -----Original Message-----
> > From: r-help-bounces_at_r-project.org [mailto:r-help-bounces_at_r-
> > project.org] On Behalf Of Bart Joosen
> > Sent: Monday, June 07, 2010 9:14 AM
> > To: r-help_at_r-project.org
> > Subject: [R] Help with seting up comparison
> >
> >
> > Hi,
> >
> > I tried on this, but couldn't figure it out:
> > Suppose I have a dataframe as follows:
> > dat <- data.frame(Day=rep(rep(c(1,2), each=4),2), Animal = rep(c(1,2),
> > each=8), Count=c(rnorm(8, 100), rnorm(8,90)))
> >
> > 2 animals are being examined on 2 different days. Count is the result.
> >
> > Now I need to point out whether or not there is a difference between
> > the
> > days.
> > I did this by an ANOVA test, while first converting the animal and day
> > to a
> > factor variable:
> > dat$Animal <- as.factor(dat$Animal)
> > dat$Day <- as.factor(dat$Day)
> > mod <- lm(Count ~Animal * Day,dat)
> > anova(mod)
> >
> > Now I have to check for difference within the animal, to see if there
> > is a
> > difference in count for each day. (In my real data, I have 35 animals,
> > with
> > 4 days, and 4 results).
> > I thought about a Tukey HSD test, but this compares every day of every
> > animal with every other day of every other animal. (TukeyHSD(aov(mod)))
> >
> > Any idea about which function (or model for lm) to use to only compare
> > days
> > within every animal?
> >
> > Best regards
> >
> > Bart
> >
> >
> > --
> > View this message in context: http://r.789695.n4.nabble.com/Help-with-
> > seting-up-comparison-tp2246106p2246106.html
> > Sent from the R help mailing list archive at Nabble.com.
> >
> > ______________________________________________
> > R-help_at_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.
                                               



Hotmail: betrouwbare e-mail met krachtige spambescherming.

        [[alternative HTML version deleted]]



R-help_at_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. Received on Tue 08 Jun 2010 - 05:40:59 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 08 Jun 2010 - 17:10:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive