powered by
Calculates weighted variance, see stats::cov.wt or https://en.wikipedia.org/wiki/Sample_mean_and_covariance#Weighted_samples for details.
stats::cov.wt
weighted_var(x, w = NULL, method = c("unbiased", "ML"), na.rm = FALSE, ...)
A length-one numeric vector.
Numeric vector.
Optional non-negative, non-missing case weights.
Specifies how the result is scaled. If "unbiased", the denomiator is reduced by -1, unlike "ML". See stats::cov.wt for details.
Should missing values in x be removed? Default is FALSE.
x
FALSE
Further arguments passed to stats::cov.wt.
weighted_mean.
weighted_mean
weighted_var(1:10) weighted_var(1:10, w = NULL) weighted_var(1:10, w = rep(1, 10)) weighted_var(1:10, w = 1:10) weighted_var(1:10, w = 1:10, method = "ML")
Run the code above in your browser using DataLab