Learn R Programming

VGAM (version 0.8-1)

grc: Fitting Goodman's RC Association Model

Description

Fits a Goodman's RC Association Model to a matrix of counts

Usage

grc(y, Rank = 1, Index.corner = 2:(1 + Rank),
    Structural.zero = 1, summary.arg = FALSE, h.step = 1e-04, ...)

Arguments

y
A matrix of counts. Output from table() is acceptable; it is converted into a matrix. Note that y must be at least 3 by 3.
Rank
An integer from the set {1,...,min(nrow(y), ncol(y))}. This is the dimension of the fit.
Index.corner
A vector of Rank integers. These are used to store the Rank by Rank identity matrix in the A matrix; corner constraints are used.
Structural.zero
An integer from the set {1,...,min(nrow(y), ncol(y))}, specifying the row that is used as the structural zero.
summary.arg
Logical. If TRUE, a summary is returned. If TRUE, y may be the output (fitted object) of grc().
h.step
A small positive value that is passed into summary.rrvglm(). Only used when summary.arg=TRUE.
...
Arguments that are passed into rrvglm.control().

Value

  • An object of class "grc", which currently is the same as an "rrvglm" object.

Warning

This function temporarily creates a permanent data frame called .grc.df, which used to be needed by summary.rrvglm(). Then .grc.df is deleted before exiting the function. If an error occurs, then .grc.df may be present in the workspace.

Details

Goodman's RC association model can fit a reduced-rank approximation to a table of counts. The log of each cell mean is decomposed as an intercept plus a row effect plus a column effect plus a reduced-rank part. The latter can be collectively written A %*% t(C), the product of two `thin' matrices. Indeed, A and C have Rank columns. By default, the first column and row of the interaction matrix A %*% t(C) is chosen to be structural zeros, because Structural.zero=1. This means the first row of A are all zeros.

This function uses options()$contrasts to set up the row and column indicator variables.

References

Goodman, L. A. (1981) Association models and canonical correlation in the analysis of cross-classifications having ordered categories. Journal of the American Statistical Association, 76, 320--334.

Yee, T. W. and Hastie, T. J. (2003) Reduced-rank vector generalized linear models. Statistical Modelling, 3, 15--41.

Documentation accompanying the VGAM package at http://www.stat.auckland.ac.nz/~yee contains further information about the setting up of the indicator variables.

See Also

rrvglm, rrvglm.control, rrvglm-class, summary.grc, auuc, olympic.

Examples

Run this code
# Some undergraduate student enrolments at the University of Auckland in 1990
g1 = grc(auuc, Rank=1)
fitted(g1)
summary(g1)

g2 = grc(auuc, Rank=2, Index.corner=c(2,5))
fitted(g2)
summary(g2)


# 2008 Summer Olympic Games in Beijing
top10 = head(olympic, n=10)
oly1 = with(top10, grc(cbind(gold,silver,bronze)))
round(fitted(oly1))
round(resid(oly1, type="response"), dig=1)  # Response residuals
summary(oly1)
Coef(oly1)

Run the code above in your browser using DataLab