Re: [R] nested repeated measures in R

From: Spencer Graves <spencer.graves_at_pdf.com>
Date: Sun 30 Jul 2006 - 13:53:12 EST

          For nested, repeated measures of normally distributed data, the best capability available in R (and perhaps anywhere) is in the 'nlme' package. Excellent documentation is available in Pinheiro and Bates (2000) Mixed-Effects Models in S and S-Plus (Springer). This book is also a superlative research monograph by one of the leading contributors in this area (Bates) and one of his former graduate students (Pinheiro).   If your data are not normal, you may want to use 'lmer' in the 'lme4' and 'Matrix' packages; if you need that, please search the archives for more information on that.

          For help getting data into R, if you have R installed, "help.start()" provides easy access to standard documentation shipped with R and available without Internet access. See especially "R Data Import/Export" and "An Introduction to R".

          The simplest way I've found to get data into R is to first store it something like "*.csv" or "*.txt" format, plain text with a unique "sep" character that is only used to separate fields. Then I store the file name (with the path if different from 'getwd()') in a variable like 'File'. Note that "\" is an escape character in R, and to get a character interpreted as "\", you must use either "\" or "/".

          Then I use "readLines" to check the format, including identifying the "sep" character. Then I use "count.fields" to determine the number of fields in each record and the number of records. If I don't get the right answer there, I may not have the correct "sep" character. Or I need to read the file in pieces, because of problems in the file.

          Then I use "read.data". It has many arguments that can be used to modify the "sep" character, skip lines at the beginning of the file and then read only a certain number of lines, per the output from "count.fields".

	  Hope this helps.
	  Spencer Graves

Doran, Harold wrote:
> You can read the manual, read the FAQs, search the help functions and the archives.
>
>
> -----Original Message-----
> From: r-help-bounces@stat.math.ethz.ch on behalf of Eric C Merten
> Sent: Fri 7/21/2006 8:51 PM
> To: r-help@stat.math.ethz.ch
> Subject: [R] nested repeated measures in R
>
> R help,
>
> How would I input data, verify assumptions, and run a nested repeated
> measures ANOVA using R? I have STATION nested in SITE nested in BLOCK with
> measurements repeated for five YEARs. All are random variables and it's only
> slightly unbalanced. I'm trying to characterize spatiotemporal variation in
> stream habitat variables. Thanks for your help!
>
> Eric Merten
>
> ______________________________________________
> R-help@stat.math.ethz.ch 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.
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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 Sun Jul 30 14:09:57 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sun 30 Jul 2006 - 16:16:06 EST.

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