Standard Error in R (Example)
On this page, I’ll explain how to calculate the standard error in the R programming language.
Example Data
We use the following numeric vector as example data:
x <- c(6, 8, 4, 3, 9, 3, 5, 1, 3, 2, 5, 2) # Create example vector |
x <- c(6, 8, 4, 3, 9, 3, 5, 1, 3, 2, 5, 2) # Create example vector
Example: Computation of Standard Error in R
We can compute the standard error with a combination of the sd, sqrt and length functions:
sd(x) / sqrt(length(x)) # Compute standard error # 0.7084447 |
sd(x) / sqrt(length(x)) # Compute standard error # 0.7084447
The standard error of our example data is 0.7084447.