VGAM (version 1.1-4)

gaitlog: Generally--Altered, --Inflated and --Truncated Logarithmic Regression

Description

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

Usage

gaitlog(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 = "logitlink",
     lshape.a = "logitlink", lshape.i = "logitlink",
     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 = -expm1(-7 * ppoints(12)),
     gpstr.mix = ppoints(9) / 2,
     gpstr.mlm = ppoints(9) / (2 + 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
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 argument 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 and gaitpoisson 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 Gaitlog.

Apart from the order of the linear/additive predictors, the following are (or should be) equivalent: gaitlog() and logff(), gaitlog(alt.mix = 1) and oalog(zero = "pobs1"), gaitlog(inf.mix = 1) and oilog(zero = "pstr1"), gaitlog(truncate = 1) and otlog(). The functions oalog, oilog and otlog have been placed in VGAMdata.

See Also

Gaitlog, logff, Gaitpois, gaitpoisson, gaitzeta, oalog, oilog, otlog, 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
max.support <- 20; set.seed(1)
pobs.a <- pstr.i <- 0.1
gdata <- data.frame(x2 = runif(nn <- 1000))
gdata <- transform(gdata, shape.p = logitlink(2+0.5*x2, inverse = TRUE))
gdata <- transform(gdata,
  y1 = rgaitlog(nn, shape.p, alt.mix = avec, pobs.mix = pobs.a,
                inf.mix = ivec, pstr.mix = pstr.i, truncate = tvec,
                max.support = max.support))
gaitlog(alt.mix = avec, inf.mix = ivec, max.support = max.support)
with(gdata, table(y1))
gaitlxfit <- vglm(y1 ~ x2, trace = TRUE, data = gdata,
                  gaitlog(inf.mix = ivec, truncate = tvec,
                          max.support = max.support,alt.mix = avec,
                          eq.ap = TRUE, eq.ip = TRUE))
head(fitted(gaitlxfit, type.fitted = "Pstr.mix"))
head(predict(gaitlxfit))
t(coef(gaitlxfit, matrix = TRUE))  # Easier to see with t()
summary(gaitlxfit, HDEtest = FALSE)  # summary(gaitlxfit) is better
# }

Run the code above in your browser using DataLab