buildRegressions: Creates a series of regressions from a covariance matrix

buildRegressionsR Documentation

Creates a series of regressions from a covariance matrix

Description

This function takes a covariance matrix and list of variables and their parents and returns a collection of regression model parameters for each variable regressed on its parents. This is a compact representation of a normal graphical model.

Usage

buildRegressions(Sigma, means = 0,
                 parents = buildParentList(structMatrix(Sigma)))

Arguments

Sigma

A covariance matrix among a collection of continuous variables.

means

The means of those variables

parents

A named list of length equal to ncol(Sigma) whose elements should correspond to the rows/columns of Sigma. Each element should be a character vector giving the names of the parents of the given node.

Details

This function performs one regression for each element of the parents list. The name of the dependent variable for each regression is given by names(parents) and the independent variables is given by the values of parents. (The function buildParentList() builds a suitable list of elements.)

If means is not supplied, then the variables are assumed to be centered, otherwise the given vector is used as the means.

Value

A list of length equal to parents whose elements are also a list having the following structure

b

A vector of slopes for the regression with names equal to the names of the parent variables. Note that if there are no parents, this will be numeric(0).

a

The intercept from the regression.

std

The residual standard deviation from the regression.

Author(s)

Russell Almond

References

Almond, R. G. (2010). ‘I can name that Bayesian network in two matrixes.’ International Journal of Approximate Reasoning. 51, 167-178.

See Also

buildParentList, buildRegressionTables

Examples

data(MathGrades)
pl <- buildParentList(structMatrix(MathGrades$var),"Algebra")
rt <- buildRegressions(MathGrades$var,MathGrades$mean,pl)


ralmond/CPTtools documentation built on Dec. 27, 2024, 7:15 a.m.