In: Math
This question will be perfomed entirely in R. Consider the following sample from an unkown distribution:
sample_data <- c(1.15, 0.5, 28.03 , 0.085, 1.82, 25.30, 0.7, 0.02, 0.01 ,13.23)
1.a) Calculating the p-value using the bootstrap hypothesis testing method to determine whether the mean is greater than 1 (one-sided test). Use 10,000 bootstrap samples. Set the seed to 248 before beginning the bootstrap process, i.e. include this line of code at the beginning of your script.
set.seed(248)
Include a histogram of the generated bootstrap samples of X̄⋆, does
it appear to be symmetric? Do you
reject the null at 0.05 significance level? (10 points)
1.b) Find the rejection region (for X̄) based on your bootstrap
samples at a 0.05 significance level. (5 points)
1.c) Perform a t-test for the same hypothesis as in 1.a) using the t.test function in R. Make sure that you apply the correct arguments.
Do you reject the null at a 0.05 significance level based on the t-test?
Compare the p-value from 1.a) to the p-value from the t-test, do they imply different conlcusion? Which p-value would you trust more? Support your anwser. (10 points)
ANSWER:
Given that,
1.a)
library(boot)
set.seed(248)
bootrapmean<-function(data,sample){
mean(data[sample])
}
n=10000
bootobject<-boot(data=x,statistic=bootmean,R=n)
p-value =0
The histogram appears to be symmetric.
We reject the null hypothesis that mean =1 at 5% significance level.
1.b)
The t-critical value for a right-tailed test, for a significance level of α=0.05, is
tc=1.645
1.c)
t.test(bootobject$t,alternative = "greater",mu=1,paired=FALSE,conf.level = 0.95)
Yes, we reject the null hypothesis that mean = 1 at 5% level of significance.
Both p-values approximately 0. We would consider t-test p-value to be most appropriate.