Hi all!
I was wondering if you can help me with a little sampling issue I'm
having in R.
I have a database with 100 observations.
I need to sample n=9 sample size, 200 times (i.e. get 200 samples of
size 9).
N (pop. size) =100
Each sample can't contain the same observation more than one
Does the following what you want:
x - 1:100
s - matrix(0, nrow=200, ncol=9)
for (i in 1:200) {
s[i, ] - sample(x, 9)
}
m - rowMeans(s)
hist(m)
The default behavior of sample is without replacement.
Thomas
Noam Friedman wrote:
Hi all!
I was wondering if you can help me with a
On 3/23/06 5:52 AM, Noam Friedman [EMAIL PROTECTED] wrote:
Hi all!
I was wondering if you can help me with a little sampling issue I'm
having in R.
I have a database with 100 observations.
I need to sample n=9 sample size, 200 times (i.e. get 200 samples of
size 9).
N (pop. size)
I prefer the function resample as it is given in the sample help, in this
way:
resample - function(x, size, ...)
{
if length(x = 1) {if (!missing(size) size == 0) x[FALSE] else x}
else sample(x, size, ...)
}
Anyway, if an observation can not be twice in the sample, you have to use
From: Sean Davis
On 3/23/06 5:52 AM, Noam Friedman [EMAIL PROTECTED] wrote:
Hi all!
I was wondering if you can help me with a little sampling issue I'm
having in R.
I have a database with 100 observations.
I need to sample n=9 sample size, 200 times (i.e. get 200
samples
Hello,
I'm going to use R to analyze some point count data and I need to use the
sample function. Let's say that I have a data set like below with each row
being a visit to a site and the numbers in the rows individual distances.
The real data set will of course have many more rows.
a
[[1]]