Learn R Programming

VGAM (version 1.1-12)

goffset: GAITD Offset for the GTE Method

Description

Utility function to create a matrix of log-offset values, to help facilitate the Generally-Truncated-Expansion method

Usage

goffset(mux, n,
        a.mix = NULL, i.mix = NULL, d.mix = NULL,
        a.mlm = NULL, i.mlm = NULL, d.mlm = NULL, par1or2 = 1)

Value

A matrix with n rows and the same number of columns that a GAITD regression would produce for its matrix of linear predictors. The matrix can be inputted into vglm

by assigning the offset argument.

Arguments

mux

Multiplier. Usually a small positive integer. Must be positive. The value 1 means no change.

n

Number of rows. A positive integer, it should be the number of rows of the data frame containing the data.

a.mix, i.mix, d.mix

See, e.g., gaitdpoisson.

a.mlm, i.mlm, d.mlm

See, e.g., gaitdpoisson.

par1or2

Number of parameters of the parent distribution. Set par1or2 = 2 for gaitdnbinomial, else the default value should be used.

Details

This function is intended to make the Generally-Truncated-Expansion (GTE) method easier for the user. It only makes sense if the linear predictors(s) are log of the mean of the parent distribution, which is the usual case for gaitdpoisson and gaitdnbinomial. However, for gaitdlog and gaitdzeta one should be using logffMlink and zetaffMlink.

Without this function, the user must do quite a lot of book-keeping to know which columns of the offset matrix is to be assigned log(mux). This can be rather laborious.

In the fictitional example below the response is underdispersed with respect to a Poisson distribution and doubling the response achieves approximate equidispersion.

See Also

gaitdpoisson, gaitdlog, gaitdzeta, gaitdnbinomial, Trunc, offset.

Examples

Run this code
i.mix <- c(5, 10, 15, 20); a.mlm <- 13; mymux <- 2
goffset(mymux, 10, i.mix = i.mix, a.mlm = a.mlm)
if (FALSE) org1  <- with(gdata, range(y))  # Original range of the data
vglm(mymux * y ~ 1,
     offset = goffset(mymux, nrow(gdata), i.mix = i.mix, a.mlm = a.mlm),
     gaitdpoisson(a.mlm = mymux * a.mlm, i.mix = mymux * i.mix,
                  truncate = Trunc(org1, mymux)),
     data = gdata)

Run the code above in your browser using DataLab