Calculate the population variance or standard deviation of a vector.

var_pop(x)

sd_pop(x)

Arguments

x

(Numeric) vector.

Value

The population variance or standard deviation of x.

Details

Unlike var, which returns the sample variance, var_pop() returns the population variance. sd_pop() returns the standard deviation based on the population variance.

Examples

data(efc)

# sampling variance
var(efc$c12hour, na.rm = TRUE)
#> [1] 4428.579
# population variance
var_pop(efc$c12hour)
#> [1] 4383.39

# sampling sd
sd(efc$c12hour, na.rm = TRUE)
#> [1] 66.54757
# population sd
sd_pop(efc$c12hour)
#> [1] 66.20717