View source: R/var_mean_indep.R
var_mean_indep | R Documentation |
These functions help calculate the variance matrix of different
kinds of samples. var_mean_indep
creates an asymptotic
covariance matrix for the sample means of a list of independent
samples. var_prop_indep
creates an asymptotic covariance
matrix for the sample proportions of a list of independent
samples. var_mean_onesample
creates an asymptotic covariance
matrix for the sample means of several variables from the same
sample.
var_mean_indep(x_vectors)
var_mean_onesample(df, vars = names(df))
var_prop_indep(pi_hat, nobs)
x_vectors |
A list of vectors, representing the different independent samples. |
df |
A data.frame object |
vars |
A character vector of variable names in |
pi_hat |
A vector of sample proportions. |
nobs |
The sample size. |
A matrix, representing the asymptotic covariance matrix of the sample means.
# list of independent samples
x_vectors <- list(
rnorm(1000, mean = 1, sd = 2),
rnorm(10, mean = 4, sd = 0.5),
rnorm(1000000, mean = 0, sd = 1)
)
var_mean_indep(x_vectors)
# sample proportions
pi_hat <- c(0.1, 0.6, 0.3)
nobs <- 1000
var_prop_indep(pi_hat, nobs)
# covariance of educ and age in cps dataset
var_mean_onesample(cps, c("educ", "age"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.