Learn R Programming

VGAM (version 1.1-5)

gaitzeta: Generally--Altered, --Inflated and --Truncated Zeta Regression

Description

Fits a generally--altered, --inflated and --truncated zeta regression by MLE. The GAIT combo model having 5 types of special values is implemented. This allows mixtures of zetas on nested and/or partitioned support as well as a multinomial logit model for altered and inflated values.

Usage

gaitzeta(alt.mix = NULL, inf.mix = NULL, alt.mlm = NULL,
     inf.mlm = NULL, truncate = NULL, max.support = Inf,
     zero = c("pobs", "pstr"), eq.ap = FALSE, eq.ip = FALSE,
     parallel.ap = FALSE, parallel.ip = FALSE, lshape.p = "loglink",
     lshape.a = lshape.p, lshape.i = lshape.p,
     type.fitted = c("mean", "shapes", "pobs.mlm", "pstr.mlm",
     "pobs.mix", "pstr.mix", "Pobs.mix", "Pstr.mix", "nonspecial",
     "Numer", "Denom.p", "sum.mlm.i", "sum.mix.i", "ptrunc.p",
     "cdf.max.s"), gshape.p = 1 + exp(-seq(7)),
     gpstr.mix = ppoints(7) / 3,
     gpstr.mlm = ppoints(7) / (3 + length(inf.mlm)), imethod = 1,
     imux = 0.5, ishape.p = NULL, ishape.a = ishape.p,
     ishape.i = ishape.p, ipobs.mix = NULL, ipstr.mix = NULL,
     ipobs.mlm = NULL, ipstr.mlm = NULL, byrow.ai = FALSE,
     ishrinkage = 0.95, probs.y = 0.35)

Arguments

truncate, max.support

See gaitpoisson. Only max.support = Inf is allowed because some equations are intractable.

alt.mix, inf.mix
alt.mlm, inf.mlm
lshape.p, lshape.a, lshape.i

Link functions. See gaitpoisson and Links for more choices and information.

eq.ap, eq.ip

Single logical each. See gaitpoisson

parallel.ap, parallel.ip

Single logical each. See gaitpoisson.

type.fitted, imux
imethod, ipobs.mix, ipstr.mix

See CommonVGAMffArguments and gaitpoisson for information.

ipobs.mlm, ipstr.mlm, byrow.ai

See CommonVGAMffArguments and gaitpoisson for information.

gpstr.mix, gpstr.mlm

See CommonVGAMffArguments and gaitpoisson for information.

gshape.p, ishape.p

See CommonVGAMffArguments and gaitpoisson for information. The former is used only if the latter is not given. Practical experience has shown that good initial values are needed, so if convergence is not obtained then try a finer grid.

ishape.a, ishape.i

See CommonVGAMffArguments and gaitpoisson for information.

probs.y, ishrinkage

See CommonVGAMffArguments for information.

zero

See gaitpoisson and CommonVGAMffArguments for information.

Value

An object of class "vglmff" (see vglmff-class). The object is used by modelling functions such as vglm, rrvglm and vgam.

Warning

See gaitpoisson.

Details

Many details to this family function can be found in gaitpoisson because it is also a 1-parameter discrete distribution. This function currently does not handle multiple responses. Further details are at Gaitzeta.

Apart from the order of the linear/additive predictors, the following are (or should be) equivalent: gaitzeta() and zetaff(), gaitzeta(alt.mix = 1) and oazeta(zero = "pobs1"), gaitzeta(inf.mix = 1) and oizeta(zero = "pstr1"), gaitzeta(truncate = 1) and otzeta(). The functions oazeta, oizeta and otzeta have been placed in VGAMdata.

See Also

Gaitzeta, zetaff, Gaitpois, gaitpoisson, gaitlog, spikeplot, oazeta, oizeta, otzeta, CommonVGAMffArguments, rootogram4, simulate.vlm.

Examples

Run this code
# NOT RUN {
avec <- c(5, 10)  # Alter these values parametrically
ivec <- c(3, 15)  # Inflate these values
tvec <- c(6, 7)   # Truncate these values
set.seed(1); pobs.mix <- pstr.mix <- 0.1
gdata <- data.frame(x2 = runif(nn <- 1000))
gdata <- transform(gdata, shape.p = loglink(0.1+0.1*x2, inverse = TRUE))
gdata <- transform(gdata,
  y1 = rgaitzeta(nn, shape.p, alt.mix = avec, pobs.mix = pobs.mix,
                 inf.mix = ivec, pstr.mix = pstr.mix, truncate = tvec))
gaitzeta(alt.mix = avec, inf.mix = ivec, max.support = max.support)
with(gdata, table(y1))
spikeplot(with(gdata, y1), col = "pink2", log = "x")
gaitzxfit <- vglm(y1 ~ x2, crit = "coef", trace = TRUE, data = gdata,
                  gaitzeta(inf.mix = ivec, truncate = tvec,
                           alt.mix = avec, eq.ap = TRUE, eq.ip = TRUE))
head(fitted(gaitzxfit, type.fitted = "Pstr.mix"))
head(predict(gaitzxfit))
t(coef(gaitzxfit, matrix = TRUE))  # Easier to see with t()
summary(gaitzxfit, HDEtest = FALSE)  # summary(gaitzxfit) is better
# }

Run the code above in your browser using DataLab