Calculate sample means and covariance(s) of multivariate data
# S3 method for default
mcovs(x, grouping, pooled=TRUE, …)# S3 method for formula
mcovs(formula, data, pooled=TRUE, …)
A formula in the form of grouping ~ x1 + x2 + …
, where the right hand side specifies the sample variables.
Data frame from which variables specified in formula
are taken.
data frame or Matrix containing sample values.
a factor specifying the population to which the samples in x
belong.
logical. If TRUE
, pooled variance-covariance matrix is calculated. If FALSE
, a list of variance-covariance matrices for each groups are calculated. Default to TRUE
.
further arguments
A list containing:
total number of samples.
number of samples per groups.
levels of the grouping
factor
a named list of vectors specifying the means for each group. Named according to lev
.
a named list of variance-covarinace matrix(es). Named as pooled
if pooled=TRUE
, otherwise according to lev
.