# Test 3.docx - Test 3 Predict 401-DL Last updated by MJG...

• Test Prep
• maira.shahid2
• 4
• 100% (6) 6 out of 6 people found this document helpful

This preview shows page 1 - 3 out of 4 pages.

# Test 3: Predict 401-DL# Last updated: 2015-05-16 by MJG# Clear workspacerm(list=ls())# Q1: Use the degree of confidence and sample data to construct a confidence# interval for the population of proportion p.# N = 56, x = 30; 95% confidencen <- 56x <- 30zValue <- qnorm(1 - 0.05 / 2) #Resulting from 95% confidencepHat <- x/nmoe <- zValue * sqrt((pHat * ((1 - pHat)/n)))ciLower <- pHat - moeciUpper <- pHat + moeprint(round(c(ciLower, pHat, ciUpper), 3))# Q2: Use the given data to find the minimum sample size required to estimate# the population proportion.# MOE: 0.005; confidence level: 96%; p and q unknown. Use z = 2.05moe <- 0.005n = (0.5) * (0.5) * ((2.05 / moe)**2)round(n, 2)# Note: using the confidence level, we could solve more "accurately" by# calculating actual zValue, instead of using 2.05:zValue <- qnorm(1 - 0.04 / 2)moe <- 0.005pHat <- 0.50qHat <- 0.50n = (pHat) * (qHat) * ((zValue / moe)**2)n
# Q3: Use the given data to find the minimum sample size requried to estimate# the population proportion.# MOE: 0.04; confidence level: 95%; from a prior study, p is estimated by the# decimal equivalent of 60%moe <- 0.04zValue <- qnorm(1 - 0.05 pHat <- 0.60qHat <- (1 - pHat)n <- (pHat) * (qHat) * ((zValue / moe)/ 2)**2)