[R-sig-ME] Model Setup Help

Derek Ogle DOgle at northland.edu
Fri Jun 18 22:41:14 CEST 2010


Off-list it was suggested that I should supply some data.  A text file of the data I am working with is at

http://www.ncfaculty.net/dogle/me_ex.txt

The YEAR and SITE variables should be factor()ed after reading the data file.

Thanks.

> -----Original Message-----
> From: r-sig-mixed-models-bounces at r-project.org [mailto:r-sig-mixed-
> models-bounces at r-project.org] On Behalf Of Derek Ogle
> Sent: Friday, June 18, 2010 2:39 PM
> To: r-sig-mixed-models at r-project.org
> Subject: [R-sig-ME] Model Setup Help
> 
> I am working on a project to convert some SAS code to R code as an on-
> line addendum to a published book
> (http://www.montana.edu/mtcfru/Guy/AIFFD.html).  For the most part this
> has been fairly straightforward.  However, I do not have much
> experience, and I am currently struggling to learn, with mixed-effects
> models.  As a hope to create a conversion from SAS to R that I can
> learn from, I have been attempting to work with the following
> situation.
> 
> Numbers of fish in two size categories were captured on one lake, over
> a nine year period (variable YEAR), at 12 fixed sites (variable SITE)
> each year.  A management regulation was implemented during the nine-
> year sampling period such that the years have been categorized as
> either "APRE" (before the regulation) or "BPOST" (after the regulation)
> (variable PERIOD).  The total number of fish in both size categories
> have been summed (variable TOTAL) and the log ratio of the number of
> fish in each size category has been created (variable LOGIT).  PERIOD,
> YEAR, and SITE are factor variables, LOGIT is a continuous quantitative
> variable, and TOTAL is a discrete quantitative variable.  The ultimate
> goal is to determine if mean LOGIT differed between periods (i.e., does
> the "ratio" of the two size categories differ from before to after the
> implementation of the regulation).
> 
> I would consider PERIOD to be a fixed effect, YEAR to be random, and
> there to be a lack of independence from year-to-year of LOGIT and TOTAL
> at each SITE.
> 
> The SAS PROC MIXED code that I am trying to convert is
> 
> PROC MIXED;
> CLASS PERIOD YEAR SITE;
> MODEL LOGIT=PERIOD;
> WEIGHT TOTAL;
> RANDOM YEAR(PERIOD);
> REPEATED YEAR/SUBJECT=SITE TYPE=AR(1);
> RUN;
> 
> I have tried various "things" in lme() from the nlme package but to no
> real success (defined as either re-creating something close to the SAS
> output or convincing myself that I knew what I was doing).
> 
> If someone has the time and inclination to help me set up lme() code (I
> assume that that is the most appropriate function) for this situation I
> would be very thankful.  Thank you in advance for any help you can
> offer.
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models




More information about the R-sig-mixed-models mailing list