Learn R Programming

gRim (version 0.1.2)

cmod: Graphical Gaussian model

Description

Specification of graphical Gaussian model. The 'c' in the name cmod refers to that it is a (graphical) model for 'c'ontinuous variables

Usage

cmod(formula, data, marginal = NULL, fit = TRUE, details=0)

Arguments

formula
Model specification in one of the following forms: 1) a right-hand sided formula, 2) as a list of generators, 3) an undirected graph (represented either as a graphNEL object or as an adjacency matrix). Notice that there are certai
data
Data in one of the following forms: 1) A dataframe or 2) a list with elements cov and n.obs (such as returned by the cov.wt() function.)
marginal
Should only a subset of the variables be used in connection with the model specification shortcuts
fit
Should the model be fitted.
details
Control the amount of output; for debugging purposes.

Value

  • An object of class cModel (a list)

Details

The independence model can be specified as ~.^1 and the saturated model as ~.^.. The marginal argument can be used for specifying the independence or saturated models for only a subset of the variables.

See Also

dmod mmod ggmfit

Examples

Run this code
## Graphical Gaussian model
data(carcass)
cm1<-cmod(~.^., carcass)

## Stepwise selection based on BIC
cm2<-backward(cm1,k=log(nrow(carcass)))

## Stepwise selection with fixed edges
cm3<-backward(cm1,k=log(nrow(carcass)),
 fixinMAT=matrix(c("LeanMeat","Meat11","Meat12","Meat13","LeanMeat","Fat11","Fat12","Fat13"),
 ncol=2))

Run the code above in your browser using DataLab