[R] Pseudodataset text file

From: Dan Janes <djanes_at_oeb.harvard.edu>
Date: Tue 14 Jun 2005 - 04:33:26 EST

Hi All,

Two weeks ago, I received instructions from the R list about creating pseudodatasets by bootstrapping an existing dataset 1000 times. I received code that bootstrapped my dataset and ran an ANOVA on each pseudodataset, producing a histogram of F-values. Here is the code I received that produces this F-histogram.

X <- data.frame(b=rnorm(2162),c =factor(rep(1:47,each=46)))

## linear fit with true values
lm0 <- lm(b~c,data=X)
Fvals <- numeric(1000)
for (i in 1:1000) {

    X.boot <- X[sample(1:nrow(X),replace=TRUE),]     Fvals[i] <- anova(lm(b~c,data=X.boot))$"F value"[1] }

I am grateful for the assistance but the code does not provide what I need. I need the 1000 pseudodatasets produced by the bootstrap in order to work with them in a different context. Can you someone offer a suggestion on how to produce the bootstrapped datasets as a text file?

Thank you.


Dan Janes, Ph.D.
Harvard University/OEB
26 Oxford St.
Cambridge, MA 02138
Office: 617-496-2375
Fax: 617-495-5667
Email: djanes@oeb.harvard.edu

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 Received on Tue Jun 14 04:38:01 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:33 EST