# Variance ----
## Sample variance with no weights
stcov(x = iris$Sepal.Length, sample = TRUE)
## Population variance with no weights
stcov(x = iris$Sepal.Length, sample = TRUE)
## Sample variance with no weights
wt = c(100, rep(1,nrow(iris)-1)) # Unbalanced weights
stcov(x = iris$Sepal.Length, sample = FALSE, wt = wt)
## Population variance with no weights
wt = c(100, rep(1,nrow(iris)-1)) # Unbalanced weights
stcov(x = iris$Sepal.Length, sample = FALSE)
# Covariance ----
## Sample covariance with no weights
stcov(x = iris[,1:4], sample = TRUE)
## Population covariance with no weights
stcov(x = iris[,1:4], sample = TRUE)
## Sample covariance with no weights
wt = c(100, rep(1,nrow(iris)-1)) # Unbalanced weights
stcov(x = iris[,1:4], sample = FALSE, wt = wt)
## Population covariance with no weights
wt = c(100, rep(1,nrow(iris)-1)) # Unbalanced weights
stcov(x = iris[,1:4], sample = FALSE)
Run the code above in your browser using DataLab