Last chance! 50% off unlimited learning
Sale ends in
gnm
, to indicate a nonlinear term that requires special
handling.Nonlin(functionCall)
"Nonlin"
which is a list of deparsed expressions
representing the variables in the nonlinear term, with the call to
the plug-in function as an attribute.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 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: [object Object],[object Object],[object Object] and optionally one further component [object Object]
Nonlin
identifies variables in the term from the call to the
plug-in function and returns deparsed expressions representing these
variables, so that they can be added to the model frame. By default,
expressions passed to unspecified arguments of the plug-in function
are deparsed.
If the default action of Nonlin
will not capture the required
variables, a companion function must exist in the environment of the
plug-in function, which takes a call to the plug-in function and
returns the necessary deparsed expressions. The name of this
function must be the name of the plug-in function suffixed with
Variables
, e.g. PlugInFunctionVariables
would be the
companion function for PlugInFunction
.
The call to the plug-in function is evaluated in the environment of
the model frame and in the enclosing environment of the parent frame
of the call to gnm
. To access the model frame directly from
within a plug-in function (e.g. for use with model.matrix
),
use getModelFrame
.
gnm
, getModelFrame
,
MultHomog
, Dref
, Mult
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)
Run the code above in your browser using DataLab