Nonlin {gnm}R Documentation

Specify a Special Nonlinear Term in a Model Formula

Description

A symbolic wrapper, for use in the formula argument to gnm, to indicate a nonlinear term that requires special handling.

Usage

Nonlin(functionCall, data = NULL)

Arguments

functionCall a call to a “plug-in” function that provides the objects required to fit the special nonlinear term.
data (optional) a data.frame containing any variables in specified arguments of functionCall.

Details

Nonlinear terms that cannot be specified by Mult require special handling by gnm. Nonlin provides a way of specifying such terms in a gnm formula.

To fit the special terms, gnm requires certain objects and functions, which must be produced by a plug-in function. The functionCall argument of Nonlin specifies the call to this function that is necessary to fit the desired term.

The gnm package includes plug-in functions for multiplicative interactions with homogeneous effects (MultHomog) and diagonal reference terms (Dref). Users may also define their own plug-in functions which should return a list with at least the following three components:

labels
a character vector of labels for the parameters (to which gnm will prefix the call to the plug-in function).
predictor
a function which takes a vector of parameter estimates and returns either a vector of fitted values or a matrix whose columns are additive components of the fitted values.
localDesignFunction
a function which takes the arguments coef (a vector of parameter estimates) and predictor (the result of the predictor function), and returns the local design matrix.

and optionally one further component

start
either a vector of default starting values for the parameters or a function which takes the number of parameters and returns a vector of default starting values.

Any variables passed to unspecified arguments of the plug-in function will be automatically added to the model frame used in gnm. This model frame can be accessed within a plug-in function using getModelFrame.

The data argument of Nonlin can be used to provide any variables required by specified arguments of the plug-in function. ALL the variables given in data will be added to the model frame.

Value

An object of class "Nonlin" which is a list of deparsed expressions representing the variables passed to unspecified arguments of the plug-in function, with the attributes

call the call to make to the plug-in function.
extraData if supplied, the data frame passed to the data argument of Nonlin.

Author(s)

Heather Turner

References

Goodman, L. A. (1979) Simple Models for the Analysis of Association in Cross-Classifications having Ordered Categories. J. Am. Stat. Assoc., 74(367), 537-552.

See Also

gnm, getModelFrame, MultHomog, Dref, Mult

Examples

set.seed(1)
data(occupationalStatus)

##  Fit an association model with homogeneous row-column effects
RChomog <- gnm(Freq ~ origin + destination + Diag(origin, destination) +
               Nonlin(MultHomog(origin, destination)), family = poisson,
               data = occupationalStatus)

[Package gnm version 0.6-1 Index]