CGstats: Mean, covariance and counts for grouped data

Description Usage Arguments Value Author(s) See Also Examples

Description

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.

Usage

1
CGstats(object, varnames = NULL, homogeneous = TRUE, simplify = TRUE)

Arguments

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.

Value

A list whose form depends on the type of input data and the varnames.

Author(s)

Søren Højsgaard, sorenh@math.aau.dk

See Also

cov.wt

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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)

boennecd/gRim documentation built on May 12, 2019, 3:10 p.m.