On Sat, 16 Aug 2008, Brown, Heidi wrote:
> Having spent the last few weeks trying to decipher R, I feel I may
> finally be getting somewhere, but i'M still in need of some advice and
> all my tutors seem to be on holiday!
>
> Basically a bit of background, I have data collected on a population of
> Lizards which includes age,sex, and body condition. I collected data
> myself this year and I have data previously collected from 1999, 2002
> and 2005. My plan is to compare this data to identify if there has been
> any change in body condition since the first sample in 1999. I have run
> my data through R using the following:
What is 'year'? I am wondering if it should have been a factor. If it
has been entered as numeric the results are relative to year dot (0) and
the intercept is meaningless.
You mention ANCOVA here but I see no {C}ovariates (unless you have good
reason to treat 'year' as numeric), and you do not even show an ANOVA
table. Take a look at MASS (the book) chapter 6 and use step() or similar
to do backwards model selection following its examples. In particular you
need to respect the hierarchy of terms, so you can only remove
age:sex:year at the first stage.
This sort of thing is best done in an interactive consultation with a
statistician (or a biologist with MSc-level statistical training): until
the full model properly reflects the design the R output presented is not
useful.
>
> mos1<-lm(ci~age*sex*year)
> summary(mos1)
>
> and R has gven me the results
>
> Call:
> lm(formula = ci ~ age * sex * year)
> Residuals:
> Min 1Q Median 3Q Max
> -0.156304 -0.036740 0.002953 0.039081 0.213696
> Coefficients:
> Estimate Std. Error t value Pr(>|t|)
> (Intercept) 9.538260 4.956850 1.924 0.0556 .
> ageJ -15.943787 11.211551 -1.422 0.1564
> sexM -11.844042 6.195258 -1.912 0.0572 .
> year -0.004657 0.002474 -1.883 0.0611 .
> ageJ:sexM 18.887391 13.657536 1.383 0.1681
> ageJ:year 0.007923 0.005590 1.417 0.1578
> sexM:year 0.005977 0.003091 1.934 0.0545 .
> ageJ:sexM:year -0.009458 0.006809 -1.389 0.1663
> ---
> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05
'.' 0.1 ' ' 1
> Residual standard error: 0.06299 on 218 degrees of freedom
> Multiple R-squared: 0.6109, Adjusted R-squared: 0.5984
> F-statistic: 48.89 on 7 and 218 DF, p-value: < 2.2e-16
>
> Firstly I'm a bit bemused, I think my head has turned to mush the last
> few weeks and I'm struggling to decipher the results, am I right in
> thinking the intercept Adult Females?? and secondly I have Been told to
> update the model to produce the minimal adequate model. By doing this do
> I need to remove the least significant from the above list ie age:sex:?
>
> mos2<-update(mos1,~.-age:sex)
> summary(mos2)
>
> Call:
> lm(formula = ci ~ age + sex + year + age:year + sex:year + age:sex:year)
> Residuals:
> Min 1Q Median 3Q Max
> -0.161296 -0.040699 0.001092 0.038537 0.208704
> Coefficients:
> Estimate Std. Error t value Pr(>|t|)
> (Intercept) 7.050e+00 4.628e+00 1.523 0.129
> ageJ -3.216e+00 6.416e+00 -0.501 0.617
> sexM -7.958e+00 5.533e+00 -1.438 0.152
> year -3.416e-03 2.310e-03 -1.479 0.141
> ageJ:year 1.577e-03 3.199e-03 0.493 0.622
> sexM:year 4.038e-03 2.761e-03 1.463 0.145
> ageJ:sexM:year -4.132e-05 9.762e-06 -4.233 3.40e-05 ***
> ---
> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05
'.' 0.1 ' ' 1
> Residual standard error: 0.06312 on 219 degrees of freedom
> Multiple R-squared: 0.6075, Adjusted R-squared: 0.5967
> F-statistic: 56.49 on 6 and 219 DF, p-value: < 2.2e-16
>
> Basically how do i know once the minimal adequate model has been
> reached? how many times should I remove categories and update the model?
>
> Any help will be greatly appreciated and if more information is required
> then let me know!!
>
> Cheers
>
> H
>
>
>
>
>
> [[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.
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595