Imagine: I have sampled 10,000 humans and measured their height in cm, and drawn the distribution as follows:
# Generate sample data
sampleSize = 10000
sampleData = round(rnorm(n=sampleSize, mean=175, sd=14))
# Draw histogram of sample
h = hist(sampleData, breaks=max(sampleData)-min(sampleData))
######################################################################
# Calculate the mean of the measurement
meanMeasure = mean(sampleData)
meanMeasure
abline(v=meanMeasure, col="red")
# Calculate the standard deviation of the measurement
sdMeasure = sd(sampleData)
sdMeasure
rect(
xleft=meanMeasure-sdMeasure,
ybottom=min(h$counts),
xright=meanMeasure+sdMeasure,
ytop=max(h$counts),
col="#0000ff22"
)
Now I want to estimate how large the standardDeviation is for each measured body height. I thought that bootstrapping my original dataset would be a good method, i.e sampling body sizes from my original dataset with replacement.
Is this a good method? How can I perform this analysis in R (e.g. standard deviation for each height in a bootstrap analysis with 1000 cycles)?