I have attached R boot package (1) A researcher is interested in better understanding variability in birth weights of children whose mothers suffer from a particular disease. She takes a SRS of size 12 and records the resulting birth weight in pounds (given below) 3.5, 5.4, 4.2, 4.0, 4.8, 4.8, 3.4, 3.9, 4.7, 4.9, 4.5, 4.5 interquartile range (IQR = Q3-Q1) to measure variabil can be calculated in (a) She decides to use ity. Calculate the IQR for these data.Note that IQR R via: quantile(data,. 75) - quantile(data,.25) (b) She also wishes to construct a 95% confidence interval for IQR. Use R to create the interval using the percentile method with B = 2,000. You may use the R boot package use R to create the same interval using the BCA method with B=2,000. (c) Now, You will want to use the R boot package.

MATLAB: An Introduction with Applications
6th Edition
ISBN:9781119256830
Author:Amos Gilat
Publisher:Amos Gilat
Chapter1: Starting With Matlab
Section: Chapter Questions
Problem 1P
icon
Related questions
Question
Practice Pack

#non-parametric BS
data("faithful")

hist(faithful$eruptions)

#pretend it is reasonable to think that these data are normal
t.test(faithful$eruptions)

#pretend it is reasonable to think that these data are from loc-scale family
#get CI for mean
B <- 1000
boot.samp <- rep(NA,times=B)
for (b in 1:B){
boot.dat <- faithful$eruptions[sample(1:length(faithful$eruptions),length(faithful$eruptions),replace = TRUE)]
boot.samp[b] <- (mean(boot.dat) - mean(faithful$eruptions))/(sd(boot.samp)/sqrt(length(faithful$eruptions)))
}

mean(faithful$eruptions) - quantile(boot.samp,.975)*sd(faithful$eruptions)/sqrt(length(faithful$eruptions))
mean(faithful$eruptions) + quantile(boot.samp,.975)*sd(faithful$eruptions)/sqrt(length(faithful$eruptions))

#percentile method for median
B <- 1000
boot.samp <- rep(NA,times=B)
for (b in 1:B){
boot.dat <- faithful$eruptions[sample(1:length(faithful$eruptions),length(faithful$eruptions),replace = TRUE)]
boot.samp[b] <- median(boot.dat)
}

quantile(boot.samp,.025)
quantile(boot.samp,.975)


#residual method for median
B <- 1000
boot.samp <- rep(NA,times=B)
for (b in 1:B){
boot.dat <- faithful$eruptions[sample(1:length(faithful$eruptions),length(faithful$eruptions),replace = TRUE)]
boot.samp[b] <- median(boot.dat) - median(faithful$eruptions)
}

median(faithful$eruptions) - quantile(boot.samp,.975)
median(faithful$eruptions) - quantile(boot.samp,.025)


#use R bootstrap package
library("boot")

boot.out <- boot(data=faithful$eruptions,statistic = function(dat,inds){median(dat[inds])},R=2000)
boot.ci(boot.out,type=c("perc", "bca"))

I have attached R boot package
(1) A researcher is interested in better understanding variability in birth weights
of children whose mothers suffer from a
particular disease. She takes a SRS of size
12 and records the resulting birth weight in pounds (given below)
3.5, 5.4, 4.2, 4.0, 4.8, 4.8, 3.4, 3.9, 4.7, 4.9, 4.5, 4.5
interquartile range (IQR = Q3-Q1) to measure variabil
can be calculated in
(a) She decides to use
ity. Calculate the IQR for these data.Note that IQR
R via: quantile(data,. 75) - quantile(data,.25)
(b) She also wishes to construct a 95% confidence interval for IQR. Use R to
create the interval using the percentile method with B = 2,000. You may
use the R boot package
use R to create the same interval using the BCA method with B=2,000.
(c) Now,
You will want to use the R boot package.
Transcribed Image Text:I have attached R boot package (1) A researcher is interested in better understanding variability in birth weights of children whose mothers suffer from a particular disease. She takes a SRS of size 12 and records the resulting birth weight in pounds (given below) 3.5, 5.4, 4.2, 4.0, 4.8, 4.8, 3.4, 3.9, 4.7, 4.9, 4.5, 4.5 interquartile range (IQR = Q3-Q1) to measure variabil can be calculated in (a) She decides to use ity. Calculate the IQR for these data.Note that IQR R via: quantile(data,. 75) - quantile(data,.25) (b) She also wishes to construct a 95% confidence interval for IQR. Use R to create the interval using the percentile method with B = 2,000. You may use the R boot package use R to create the same interval using the BCA method with B=2,000. (c) Now, You will want to use the R boot package.
Expert Solution
trending now

Trending now

This is a popular solution!

video

Learn your way

Includes step-by-step video

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Hypothesis Tests and Confidence Intervals for Means
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, statistics and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
MATLAB: An Introduction with Applications
MATLAB: An Introduction with Applications
Statistics
ISBN:
9781119256830
Author:
Amos Gilat
Publisher:
John Wiley & Sons Inc
Probability and Statistics for Engineering and th…
Probability and Statistics for Engineering and th…
Statistics
ISBN:
9781305251809
Author:
Jay L. Devore
Publisher:
Cengage Learning
Statistics for The Behavioral Sciences (MindTap C…
Statistics for The Behavioral Sciences (MindTap C…
Statistics
ISBN:
9781305504912
Author:
Frederick J Gravetter, Larry B. Wallnau
Publisher:
Cengage Learning
Elementary Statistics: Picturing the World (7th E…
Elementary Statistics: Picturing the World (7th E…
Statistics
ISBN:
9780134683416
Author:
Ron Larson, Betsy Farber
Publisher:
PEARSON
The Basic Practice of Statistics
The Basic Practice of Statistics
Statistics
ISBN:
9781319042578
Author:
David S. Moore, William I. Notz, Michael A. Fligner
Publisher:
W. H. Freeman
Introduction to the Practice of Statistics
Introduction to the Practice of Statistics
Statistics
ISBN:
9781319013387
Author:
David S. Moore, George P. McCabe, Bruce A. Craig
Publisher:
W. H. Freeman