Learn R Programming

ordinalTables (version 1.0.0.3)

log_linear_fit: Fits a log-linear model to the data provided, using the design matrix provided. Names for the effects will be "rows1", "cols1" etc. If there are remaining entries, they can be specified as the "effect_names" character vector. This function is a wrapper around a call to glm() that handles some of the details of the call and packages the output in a more convenient form.

Description

Fits a log-linear model to the data provided, using the design matrix provided. Names for the effects will be "rows1", "cols1" etc. If there are remaining entries, they can be specified as the "effect_names" character vector. This function is a wrapper around a call to glm() that handles some of the details of the call and packages the output in a more convenient form.

Usage

log_linear_fit(n, x, effect_names = NULL)

Value

a list containing x: the design matrix beta: the regression parameters se: the vector of standard errors g_squared: G^2 fit measure chisq: X^2 fit measure df: degrees of freedom expected: matrix of expected frequencies

Arguments

n

matrix of observed counts to be fit

x

design matrix for predictor variables

effect_names

character vector of additional names to apply to the columns of x The default is NULL, in which case the columns will be labeled "model1" etc.