Learn R Programming

gnm (version 0.8-1)

Multiplicative interaction: Specify a Multiplicative Interaction in a gnm Model Formula

Description

Mult is a symbolic wrapper to indicate a multiplicative interaction in the formula argument to gnm.

Exp is a symbolic wrapper to indicate an exponeniated multiplier in a Mult term.

Usage

Mult(..., multiplicity = 1)
Exp(multiplier)

Arguments

...
a comma-separated list of two or more symbolic expressions, which represent the constituent multipliers in each component of the interaction.
multiplicity
a positive integer specifying the number of components to fit.
multiplier
a symbolic expression.

Value

  • Mult returns a list of objects of class "Mult", with one element for each multiplicative component. A "Mult" object is a list of deparsed expressions representing the factors in the multiplicative interaction.

    Exp returns an object of class "Exp" which is a deparsed expression representing the multiplier to be exponentiated.

Details

A multiplicative interaction is either (if multiplicity = 1) a product of the form $$m_1 m_2 ... m_n,$$ where the constituent multipliers $m_1, m_2, ..., m_n$ are linear predictors; or (if multiplicity is greater than 1) a sum of such components, each of which is a product of the same linear predictors (but with different parameters).

Mult may be used to specify a multiplicative interaction in the formula argument to gnm. The desired number of components in the interaction is specified by multiplicity.

Models for the constituent multipliers are specified symbolically as unspecified arguments to Mult. These symbolic expressions are interpreted in the same way as the right hand side of a formula in an object of class "formula". In particular, an intercept term is added by default. Offsets can be added to constituent multipliers, using offset.

Exp is a companion function to Mult, which may be used to specify an exponentiated constituent multiplier, so that the multiplier is constrained to be nonnegative.

References

Vargas, M, Crossa, J, van Eeuwijk, F, Sayre, K D and Reynolds, M P (2001). Interpreting treatment by environment interaction in agronomy trials. Agronomy Journal 93, 949--960.

See Also

offset, gnm, Dref, MultHomog

Examples

Run this code
set.seed(1)
## Using 'Mult' with 'Exp' to constrain the first constituent multiplier
data(yaish)
## Fit the "UNIDIFF" mobility model across education levels
unidiff <- gnm(Freq ~ educ*orig + educ*dest +
               Mult(Exp(-1 + educ), -1 + orig:dest),
               family = poisson, data = yaish, subset = (dest != 7))

## (this example can take quite a while to run)
##
## Using 'multiplicity' > 1
data(wheat)
yield.scaled <- wheat$yield * sqrt(3/1000)
treatment <- factor(paste(wheat$tillage, wheat$summerCrop, wheat$manure,
                          wheat$N, sep = ""))
bilinear2 <- gnm(yield.scaled ~ year + treatment +
                 Mult(year, treatment, multiplicity = 2),
                 family = gaussian, data = wheat)

Run the code above in your browser using DataLab