I need to calculate the 95% confidence interval with a sample size = 200 stored in a vector named v_name. The problem says I need standard error, which is calculated as the population standard deviation divided by the square root of the sample size. R tells me s <- sd(v_name) = 13.92435, but I think that is the sample standard deviation, so I don't know if I have the right value for s.

If s is the standard deviation I need to calculate the CI, then I think this my code in R to calculate sample standard error:

# Assign the sample standard error to object "SE"

SE <-(s / sqrt(length(v_name)))

Now my code for the upper portion of CI:

# Calculate the upper 95% confidence interval, m is the sample mean.

m+(1.96*(SE/sqrt(length(v_name)))

The t-score for degrees of freedom = 199 is 1.972.

But m+(1.972*(SE/sqrt(length(v_name))) also does not produce the right answer.

It seems strange that my formula for the CI has the same denominator as my formula for SE. Am I using the right CI formula? Thank you ]]>