[R-sig-eco] extracting variance components from lm (Lee, Laura)
Carl von Ende
cvonende at niu.edu
Sat Jul 22 20:17:26 CEST 2017
Hi Laura,
To quote the Statsoft Electronic Textbook (Stats), “The basic goal of variance component estimation is to estimate the population covariation between random factors and the dependent variable.”
In using “lm,” you are assuming Station and Year are fixed factors. Therefore, the only random component is the residual error term.
To estimate variance components, you must assume either Year or Station is fixed & the other factor random (= mixed model analysis), or that both Year & Station are random. You will need to use nlme/lmm for the mixed or random analyses.
Also, re. your R code for the LM, it should be either Year * Station, or Year + Station + Year:Station.
See The R Book, 2nd ed., Michael J. Crawley, Chap. 19 – Mixed-Effect Models, for some examples.
Hope this helps?
Carl von Ende
On 7/22/17, 5:00 AM, "R-sig-ecology on behalf of r-sig-ecology-request at r-project.org" <r-sig-ecology-bounces at r-project.org on behalf of r-sig-ecology-request at r-project.org> wrote:
Send R-sig-ecology mailing list submissions to
r-sig-ecology at r-project.org
To subscribe or unsubscribe via the World Wide Web, visit
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
or, via email, send a message with subject or body 'help' to
r-sig-ecology-request at r-project.org
You can reach the person managing the list at
r-sig-ecology-owner at r-project.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of R-sig-ecology digest..."
Today's Topics:
1. extracting variance components from lm (Lee, Laura)
----------------------------------------------------------------------
Message: 1
Date: Fri, 21 Jul 2017 12:19:22 +0000
From: "Lee, Laura" <laura.lee at ncdenr.gov>
To: "'r-sig-ecology at r-project.org'" <r-sig-ecology at r-project.org>
Subject: [R-sig-eco] extracting variance components from lm
Message-ID:
<BY2PR09MB0705FDFA73F0D27CC42DBDC693A40 at BY2PR09MB0705.namprd09.prod.outlook.com>
Content-Type: text/plain; charset="iso-8859-1"
Hi all-
I have a fairly simple model:
m1 <- lm(Catch ~ Year + Station + Year*Station, data = data)
I would like to extract the among years and year*station variance components and need assistance. I'm aware of the 'varComp' package, but I believe that only applies to nlme and requires a random effect. Any help is greatly appreciated. Thanks!
Cheers,
Laura
Laura M. Lee
Senior Stock Assessment Scientist
Division of Marine Fisheries
Department of Environmental Quality
252 808 8094??? office
252 726 6062??? fax
mailto:Laura.Lee at ncdenr.gov
3441 Arendell Street
P.O. Box 769
Morehead City, NC 28557-0769
Email correspondence to and from this address is subject to the
North Carolina Public Records Law and may be disclosed to third parties.
------------------------------
Subject: Digest Footer
_______________________________________________
R-sig-ecology mailing list
R-sig-ecology at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
------------------------------
End of R-sig-ecology Digest, Vol 112, Issue 6
*********************************************
More information about the R-sig-ecology
mailing list