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.
dim_loglin(glist, tableinfo)dim_loglin_decomp(glist, tableinfo, adjust = TRUE)
Generating class (a list) for a log-linear model. See 'details' below.
Specification of the levels of the variables. See 'details' below.
Should model dimension be adjusted for sparsity of data (only available for decomposable models)
A numeric.
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.
A contingency table (a table
).
A list with the names of the variables and their levels (such as one
would get if calling dimnames
on a table
).
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 dim_loglin_decomp
is to be preferred over
dim_loglin
as the former is much faster.
Setting adjust=TRUE
will force dim_loglin_decomp
to calculated a
dimension which is adjusted for sparsity of data. For this to work,
tableinfo
MUST be a table.
# NOT RUN {
## glist contains variable names and tableinfo is a named vector:
dim_loglin(list(c("a", "b"), c("b", "c")), c(a=4, b=7, c=6))
## glist contains variable names and tableinfo is not named:
dim_loglin(list(c(1, 2), c(2, 3)), c(4, 7, 6))
## For decomposable models:
dim_loglin_decomp(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