i

R Programming Complete Tutorial

Standard Deviation

The standard deviation (σ) measures the dispersion of a dataset relative to its mean (μ) and is calculated as the square root of the variance. Standard deviation is a measure of how spread out numbers are. More specifically, it measures the dispersion of a data set relative to its mean and is calculated by the square root of the variance.

We can calculate the standard deviation using the formula below. Where μ is the mean, xi is the sample points. 

Formula:

  • If the data is being considered a population on its own, we divide by the number of data points, N.

  • If the data is a sample from a larger population, we divide by one fewer than the number of data points in the sample, N-1.

  • Steps to calculate the Standard deviation:

  • Step 1: Calculate the mean (μ).

  • Step 2: For each data point, calculate the square of its distance to the mean.

  • Step 3: Aggregate the values from Step 2.

  • Step 4: Divide the aggregated result by the number of data points (N).

  • Step 5: Take the square root.

  • Example: Calculate manually standard deviation and compare this with R function.