In R I have a matrix of 47 rows and 30 columns. Each cell contains a numerical value (varying from 0.0 to 1.0). Some cells have "NA" instead of a numerical value.
This is what I would like to do:
- For each row, sample one random value until all 47 rows were sampled once. Only numerical values can be sampled (NA's should be ignored).
- Take these 47 values, compute the mean, and store the mean.
- Repeat this process 10,000 times with replacement.
- Determine the 95% interval (2.5%-97.5%) of these 10,000 means.
- Plot a histogram of the 10,000 means showing the boundaries the 2.5% and 97.5% interval.
- Determine whether an observed value falls inside or outside the boundaries.
- Compute the P-value of the observed mean.
It's important that only one sample is drawn from each row (randomly) and that every row is sampled once in every iteration.
I hope I'm not asking too much :-) I appreciate any help!