Learn R Programming

gRim (version 0.1.2)

loglinDim: Return the dimension of a log-linear model

Description

Return the dimension of a log-linear model given by the generating class 'glist'. If the model is decomposable and adjusted dimension can be found.

Usage

loglinGenDim(glist, tableinfo)
loglinDecDim(glist, tableinfo, adjust=TRUE)

Arguments

glist
Generating class (a list) for a log-linear model. See 'details' below.
tableinfo
Specification of the levels of the variables. See 'details' below.
adjust
Should model dimension be adjusted for sparsity of data (only available for decomposable models)

Value

  • A numeric.

Details

glist can be either a list of vectors with variable names or a list of vectors of variable indices. tableinfo can be one of three different things. 1) A contingency table (a table). 2) A list with the names of the variables and their levels (such as one would get if calling dimnames on a table). 3) A vector with the levels. If glist is a list of vectors with variable names, then the entries of the vector tableinfo must be named. If the model is decomposable it loglinDecDim is to be preferred over loglinGenDim as the former is much faster. Setting adjust=TRUE will force loglinDecDim to calculated a dimension which is adjusted for sparsity of data. For this to work, tableinfo *MUST* be a table.

See Also

dmod, glm, loglm

Examples

Run this code
## glist contains variable names and tableinfo is a named vector:
loglinGenDim(list(c("a","b"),c("b","c")), c(a=4,b=7,c=6))

## glist contains variable names and tableinfo is not named:
loglinGenDim(list(c(1,2),c(2,3)), c(4,7,6))

## For decomposable models:
loglinDecDim(list(c("a","b"),c("b","c")), c(a=4,b=7,c=6),adjust=FALSE)

Run the code above in your browser using DataLab