loglin.model: define a log-linear model

Description Usage Arguments Details Value Note References See Also Examples

Description

Function to specify a hierarchical log-linear model. This is a particular case of a hmm model.

Usage

1
2
loglin.model(lev, int = NULL, strata = 1, dismarg = 0, type = "b", 
D = TRUE, c.gen = TRUE, printflag = FALSE, names = NULL, formula = NULL)

Arguments

lev

Vector of number of categories of variables

int

Generating class of the log-linear model (must be a list) or list of all the interactions included

strata

Number of strata

dismarg

List of interactions constrained by inequalities - see ‘hmmm.model’

type

"b" for baseline logits, "l" for local logits

D

Input argument for inequalities - see ‘hmmm.model’

c.gen

If FALSE the input int must be the list of the minimal interaction sets to be excluded

printflag

If TRUE information on the included and excluded interactions are given

names

A character vector whose elements are the names of the variables

formula

A formula describing a log-linear model

Details

This function simplifies ‘hmmm.model’ in the case of log-linear models. If formula is employed, c.gen and int must not be declared while names must be specified.

Value

An object of the class hmmmmod defining a log-linear model that can be estimated by ‘hmmm.mlfit’.

Note

If int and formula are not supplied a saturated log-linear model is defined. For log-linear models where the parameters depend on covariates first define a saturated log-linear model and then use the function ‘create.XMAT’.

References

Agresti A (2012) Categorical data Analysis, (3ed), Wiley, New York.

Bergsma W, Croon M, Hagenaars JA (2009) Marginal Models for Dependent, Clustered, and Longitudinal Categorical Data. Springer.

See Also

hmmm.model, hmmm.mlfit, create.XMAT

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
data(madsen)
y<-getnames(madsen)
names<-c("Infl","Sat","Co","Ho")

f<-~Co*Ho+Sat*Co+Infl*Co+Sat*Ho+Infl*Sat
model<-loglin.model(lev=c(3,3,2,4),formula=f,names=names)

# alternatively 
# model<-loglin.model(lev=c(3,3,2,4),
# int=list(c(3,4),c(2,3),c(1,3),c(2,4),c(1,2)),names=names)

mod<-hmmm.mlfit(y,model,maxit=3000)
print(mod,printflag=TRUE)

hmmm documentation built on May 2, 2019, 12:27 p.m.