weighted_var | R Documentation |
Calculates weighted variance, see stats::cov.wt()
or
https://en.wikipedia.org/wiki/Sample_mean_and_covariance#Weighted_samples
for details.
weighted_var(x, w = NULL, method = c("unbiased", "ML"), na.rm = FALSE, ...)
x |
Numeric vector. |
w |
Optional vector of non-negative case weights. |
method |
Specifies how the result is scaled. If "unbiased", the denomiator
is reduced by 1, see |
na.rm |
Should missing values in |
... |
Further arguments passed to |
A length-one numeric vector.
stats::cov.wt()
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.