Mean, covariance and counts for grouped data (statistics for conditional Gaussian distribution).
CGstats
provides what corresponds to calling
cow.wt
on different strata of data where the strata are defined by
the combinations of factors in data.
CGstats(object, varnames = NULL, homogeneous = TRUE, simplify = TRUE)
object |
A dataframe. |
varnames |
Names of variables to be used. |
homogeneous |
Logical; if TRUE a common covariance matrix is reported. |
simplify |
Logical; if TRUE the result will be presented in a simpler form. |
A list whose form depends on the type of input data and the varnames.
Søren Højsgaard, sorenh@math.aau.dk
data(milkcomp) # milkcomp <- subset(milkcomp, (treat %in% c("a", "b")) & (lactime %in% c("t1", "t2"))) # milkcomp <- milkcomp[,-1] # milkcomp$treat <- factor(milkcomp$treat) # milkcomp$lactime <- factor(milkcomp$lactime) CGstats(milkcomp) CGstats(milkcomp, c(1, 2)) CGstats(milkcomp, c("lactime", "treat")) CGstats(milkcomp, c(3, 4)) CGstats(milkcomp, c("fat", "protein")) CGstats(milkcomp, c(2, 3, 4), simplify=FALSE) CGstats(milkcomp, c(2, 3, 4), homogeneous=FALSE) CGstats(milkcomp, c(2, 3, 4), simplify=FALSE, homogeneous=FALSE)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.