unit_04_exercise_2.Rmd

# Vspace3cm d which the intervals c 99 do you find to

• Homework Help
• ProfProton740
• 5

This preview shows pages 3–5. Sign up to view the full content.

\vspace{3cm} d) Which the intervals calculated (90\%, 95\%, 99\%) do you find to be the most informative as an estimate of the mean weight of high-school age students in the US? Explain your answer. \vspace{2cm} ###Increasing Sample Size The following code includes a section that removes any rows from \texttt{yrbss} where there are no data recorded for \texttt{weight}. The version of \texttt{yrbss} without missing weight values is named \texttt{yrbss.complete}. Run the following code chunk to take a random sample of size 10 from \texttt{yrbss.complete}, changing the seed to be the last four digits of your HUID. {r initial_sampling_yrbss_xxxx, message = FALSE} #load the dataset require(OIBioStat) data("yrbss") #remove rows with missing weight values weight.complete = complete.cases(yrbss$weight) yrbss.complete = yrbss[weight.complete, ] #set parameters sample.size = 10 #obtain random sample of row numbers set.seed(5011) sample.rows = sample(c(1:nrow(yrbss.complete)), sample.size) #create yrbss.sample yrbss.sample = yrbss.complete[sample.rows, ] #calculate a confidence interval  3. The \texttt{t.test()} command can be used to calculate confidence intervals in \textsf{R}. For example, the command to calculate a 95\% confidence interval for \texttt{height} is {r, eval = FALSE} t.test(yrbss.sample$height, na.rm = TRUE, conf.level = 0.95)$conf.int This preview has intentionally blurred sections. Sign up to view the full version.  a) Calculate a 95\% confidence interval based on the sample weights using \texttt{t.test()}. \vspace{1cm} b) Examine the effect of larger sample sizes on the confidence interval by re- running the code for sample sizes of 25, 100, and 1000. Describe your observations. \vspace{3cm} ###The Meaning of "Confidence" 4. The method illustrated for computing an$x$\% confidence interval will produce an interval that, on average, contains the true population mean$x$times out of 100. a) Calculate the population mean weight,$\mu_{weight}$for \texttt{yrbss.complete}. \vspace{2cm} b) Does the 95\% confidence interval you calculated in part b) of Question 3 for sample size 100 contain$\mu_{weight}$? \vspace{1cm} \newpage 5. Run the following code chunk to take 1,000 random samples of size 100 from \texttt{yrbss.complete}. For each sample, the code calculates mean weight for participants in the sample and stores the value in the vector \texttt{sample.means}. The code also calculates the margin of error$m\$
This is the end of the preview. Sign up to access the rest of the document.
• Fall '16
• banubaydil

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern