wtd_sd | R Documentation |
Calculated the weighted standard deviation using a vector of values and a vector of weights.
wtd_sd(x, w = NULL, sample = T, error = F)
x |
(num vector) A vector of values. |
w |
(num vector) A vector of weights. |
sample |
(log scalar) Whether this is a sample as opposed to a population (default true). |
error |
(lgl scalr) Whether to throw an error if there is no data at all or no pairwise complete cases. Default yes. |
set.seed(1)
X = rnorm(100)
set.seed(1)
W = runif(100)
sd(X) #0.898
wtd_sd(X, W) #0.894, slightly different
wtd_sd(X) #0.898, not using weights
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.