On Oct 3, 2012, at 10:31 PM, Greg Lollback wrote:
> Hi people,
>
> I'm looking at the influence of sample size on a dataset, so I randomly
> sampled from the data with different sample sizes multiple times using
> the "sample" and "replicate" function. For example:
>
> /replicate(1000, sample("variable name", "sample size",
replace=T))/.
That does not look like it is valid R code.
>
> I saved the data, and now I have 1000 replicates of data of various
> sample sizes (2-33 in my case). If you can picture that one (of 1000)
> iteration is a line of mean values of the variable for each sample size,
> i.e. the sample size (2-33) is on the x-axis and the average variable
> value (number of trees, dogs, cats, whatever) is on the y-axis.
>
> This means I have 1000 replicates of a line. *I'm looking to find the
> average line from several lines *(1000 lines in my case).
If your code to do this had been provided we might now have an idea about what
the structure of you objects might be.
> Does anybody
> know how to do this in R? There was a topic on this using the function
> "approx", but I don't have missing data and my data is on the
same scale
> range.
It sounds as though you are redoing the invention of the bootstrap. You could
look at package 'boot', although in this case it does sound rather
simple. (And it sounds like homework and this mailing list frowns on being used
as a surreptitious help line.)
--
David Winsemius, MD
Alameda, CA, USA