# Exercise 15:  confidence interval for proportions

 

#At the lectures we looked an example concerning the opinion poll from April 2013 (cf. slide 2 from the lectures)

#We will in this exercise consider this example further.

 

 

# Question a)

 

# Of the n=968 persons who were interviewed by Norstat, y=sum(yi)=303 would have voted H?yre (H)

# The following calculations reproduce the result from the lectures (cf. slide 4)

n=968

y=303

p=y/n

se=sqrt(p*(1-p)/n)

margin=1.96*se

lower=p-margin

upper=p+margin

cbind(p,margin,lower,upper)

 

# Do the calculations and check that you get the result from the lectures.

 

 

# Question b)

 

# In the opinion poll, 193 of the persons interviewed would have voted Fremskrittspartiet (FrP) and 41 would have voted Senterpartiet (Sp).

 

# Repeat the calculations above for Fremskrittspartiet and Senterpartiet.

# How is the "margin of error" for these parties compared to the "margin of error" for H?yre (cf. slide 4)?