I have a small sample of 19 observations, with a mean of 8.105 and sd of 6.064. I want to calculate a 95% CI for the mean. My data is not normally distributed, according to the Q-Q plot. Assuming normality, I get a CI of [5.183,11.028]. I tried calculating a CI using bootstrap, but I am not sure I did it okay. The result was [5.372,10.84]. Does it makes sense that it's narrower? Is there another method of doing it (maybe using LOG transformation).

My R code is:

xbar = mean(X)
trials = do(1000) * mean(resample(X))
histogram(~mean, data = trials, col="gray")
se = sd(~ mean , data = trials)
xbar - 1.96*se
xbar + 1.96*se

Thank you.

  • $\begingroup$ One more thing, how many samples should I take? I know that the default in Stata for example, is 50. I took 1000, too much? $\endgroup$ – BlueSigma Jan 26 '17 at 18:54

Estimating a margin of error using methods that are based on central limit theorem (CLT) is inappropriate and suffer deficiencies. Bootstrapping is the appropriate method in your case. You could try package 'boot' or package 'bootstrap' in R.

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.