# Trying to calculate standard error and proportions

#1
``````
# `N` represents the number of people polled
N <- 25

# Create a variable `p` that contains 100 proportions ranging from 0 to 1
p <- seq(0,1, by = 0.01)

# Create a variable `se` that contains the standard error of each sample average
se <-  sqrt(p * (1 - p))  / N

# Plot `p` on the x-axis and `se` on the y-axis
plot(p,se)

``````

#2

What I am trying to do :
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.

Trying to convert this math notation to R code, and having trouble defining the "se" variable:

SE(X) = SQRT(p(1 - p)) / N

#3

I think you just need to put the `/N` inside the parentheses for the square root function:

`` se <-  sqrt(p * (1 - p)  / N )``

#4

yes. I got it now. thank you