Question: erform the test in problem S 2 using a bootstrap analysis. ( a ) Would we want to use a one - sample or two
erform the test in problem S using a bootstrap analysis.
a Would we want to use a onesample or twosample bootstrap test? Explain your choice.
b The code below runs the bootstrap procedure on the differences between the shoot and root
data. However, there are some problems with the code.
The code only runs the bootstrap procedure times, which is not enough to make an
accurate approximation of the null distribution.
The code takes a resample without replacement.
Fix the code so that the bootstrap procedure runs times and samples with
replacement.
Shoot c
Root c
diff Shoot Root
# Calculate summary statistics
xbar meandiff
n lengthdiff
B
# Create a vector to store that values
that numericB
set.seed
# Bootstrap loop
fori in :B
# Draw a SRS of size n from data
xstar samplediff size n replace F
# Calculate resampled mean and sd
xbarstar meanxstar
sstar sdxstar
# Calculate that, and store it in vector
thatixbarstar xbarsstarsqrtn
c Calculate a twosided bootstrap pvalue.
d Explain why the bootstrap test result is similar to the T test result from S
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
