Exercise

Exercise 5. se versus p

Write a line of code that calculates the standard error se of a sample average when you poll 25 people in the population. Generate a sequence of 100 proportions of Democrats p that vary from 0 (no Democrats) to 1 (all Democrats).

Plot se versus p for the 100 different proportions.

Instructions

100 XP
  • Use the seq function to generate a vector of 100 values of p that range from 0 to 1.
  • Use the sqrt function to generate a vector of standard errors for all values of p.
  • Use the plot function to generate a plot with p on the x-axis and se on the y-axis.