makeCompVar: Compute integrated means and covariances

View source: R/makeCompVar.R

makeCompVarR Documentation

Compute integrated means and covariances

Description

Takes a large sample from the background population and calculates the within and between covariance matrices, a vector of means, a vector of the counts of replicates for each item from the sample, and other bits needed to make up a compcovar object.

Usage

makeCompVar(x, ...)

## Default S3 method:
makeCompVar(x, item.column, ...)

## S3 method for class 'formula'
makeCompVar(x, data = NULL, ...)

Arguments

x

a matrix, or data.frame, of observations, with cases in rows, and properties as columns, or a formula.

...

other arguments.

item.column

an integer indicating which column gives the item.

data

if x is a formula, then the user must supply a data.frame containing the observations.

Details

Uses ML estimation at the moment - this will almost certainly change in the future and hopefully allow regularisation methods to get a more stable (and non-singular) estimate.

Value

an object of class compvar

Methods (by class)

  • makeCompVar(default): Create a compvar object using a formula.

  • makeCompVar(formula): Create a compvar object using a formula.

Author(s)

David Lucy and James Curran

Examples

# load Greg Zadora's glass data
data(glass)

# calculate a compcovar object based upon glass
# using K, Ca and Fe - warning - could take time
# on slower machines
background = subset(glass, select = c(item, logKO, logCaO, logFeO))
Z1 = makeCompVar(background, 1)

# Use the formula interface
Z2 = makeCompVar(item ~ logKO + logCaO + logFeO, data = glass)

comparison documentation built on Aug. 25, 2023, 5:14 p.m.