Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

MultHomog

Specify a Multiplicative Interaction with Homogeneous Effects in a gnm Model Formula


Description

A function of class "nonlin" to specify a multiplicative interaction with homogeneous effects in the formula argument to gnm.

Usage

MultHomog(..., inst = NULL)

Arguments

...

a comma-separated list of two or more factors.

inst

(optional) an integer specifying the instance number of the term.

Details

MultHomog specifies instances of a multiplicative interaction in which the constituent multipliers are the effects of two or more factors and the effects of these factors are constrained to be equal when the factor levels are equal. Thus the interaction effect would be

gamma_i gamma_j ...

for an observation with level i of the first factor, level j of the second factor and so on, where gamma_l is the effect for level l of the homogeneous multiplicative factor.

If the factors passed to MultHomog do not have exactly the same levels, the set of levels is taken to be the union of the factor levels, sorted into increasing order.

Value

A list with the anticipated components of a "nonlin" function:

predictors

the factors passed to MultHomog

common

an index to specify that common effects are to be estimated across the factors

term

a function to create a deparsed mathematical expression of the term, given labels for the predictors.

call

the call to use as a prefix for parameter labels.

Note

Currently, MultHomog can only be used to specify a one-dimensional interaction. See examples for a workaround to specify interactions with more than one dimension.

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

Examples

set.seed(1)

###  Fit an association model with homogeneous row-column effects
rc1 <- gnm(Freq ~ r + c + Diag(r,c) + MultHomog(r, c),
           family = poisson, data = friend)
rc1

## Not run: 
###  Extend to two-component interaction
rc2 <- update(rc1, . ~ . + MultHomog(r, c, inst = 2),
              etastart = rc1$predictors)
rc2

## End(Not run)

### For factors with a large number of levels, save time by
### setting diagonal elements to NA rather than fitting exactly;
### skipping start-up iterations may also save time
dat <- as.data.frame(friend)
id <- with(dat, r == c)
dat[id,] <- NA
rc2 <- gnm(Freq ~ r + c + instances(MultHomog(r, c), 2),
           family = poisson, data = dat, iterStart = 0)

gnm

Generalized Nonlinear Models

v1.1-1
GPL-2 | GPL-3
Authors
Heather Turner [aut, cre] (<https://orcid.org/0000-0002-1256-3375>), David Firth [aut] (<https://orcid.org/0000-0003-0302-2312>), Brian Ripley [ctb], Bill Venables [ctb], Douglas M. Bates [ctb], Martin Maechler [ctb] (<https://orcid.org/0000-0002-8685-9910>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.