Using R-Studio
We desire to know the probability that a voter supports a controversial rose proposal. From a random sample of 3100, x=1331 voters support the rose proposal. Let p hat be the sample proportion supporting the rose proposal. Answer the following:
a) what is the variance of p hat
b) As a function of p, what is the standard deviation of p hat
c) Calculate p hat
d) Let ptot be the random variable representing the voters in the sample who support the rose proposal. As a function of p, what is the standard deviation of ptot?
e) Calculate a classical 96% confidence interval for p
f) What is the critical value for an approximate classical 94 percent confidence interval for p?
g) What is the length of the 96% confidence interval for p?
h) Assuming the same p hat value, what sample size would have made the 96% confidence interval for p to have a length of .08 or less?
SOlutionA:
Rcode is:
x <- 1331
n <- 3100
phat <- x/n
phat
var_phat <-(phat*(1-phat)/n)
var_phat
Variance=7.903525e-05
b) As a function of p, what is the standard deviation of p hat
sd_phat <-sqrt((phat*(1-phat)/n))
sd_phat
output:
0.008890177
standard deviation= 0.008890177
Solutionc:
c) Calculate p hat
x <- 1331
n <- 3100
phat <- x/n
phat=0.4293548
d) Let ptot be the random variable representing the voters in the sample who support the rose proposal. As a function of p, what is the standard deviation of ptot?
ptot=sqrt(p*(1-p)/n)
=sqrt(0.4293548*(1-0.4293548)/3100)
=0.0089
e) Calculate a classical 96% confidence interval for p
install library PropCIs in R
Rcode:
library(PropCIs)
require(PropCIs)
exactci(1331, 3100, conf.level=0.96)
Output:
Data:
96 percent confidence interval:
0.4110156 and 0.4478390
Get Answers For Free
Most questions answered within 1 hours.