In: Statistics and Probability
An interval estimate of a population mean is required. The statistician is concerned that the sample may not have arisen from a Normal distribution as there was a distinct lack of symmetry in a boxplot of the ( continuous) variable of interest. List two approaches that could be used here to address this concern.
#method 1:- bootstrap method
r code is given below for processing ;-
rm(list=ls())
# Simulated data
set.seed(123)
data0 = rgamma(383,5,3)
mean(data0) # Sample mean
hist(data0) # Histogram of the data
library(boot)
# function to obtain the mean
Bmean <- function(data, indices) {
d <- data[indices] # allows boot to select sample
return(mean(d))
}
# bootstrapping with 1000 replications
results <- boot(data=data0, statistic=Bmean, R=1000)
# view results
results
plot(results)
# get 95% confidence interval
boot.ci(results, type=c("norm", "basic", "perc", "bca"))
#method 2:- wilcoxon test
r code is as following types
wilcox.test(your-data, conf.int = TRUE, conf.level = 0.95)
it gives you the CI around the (pseudo)median not the mean,because
if the data is heavily non-normal generally the median is a more
informative measure.
please like ?