R: Generally-Altered, -Inflated and -Truncated Logarithmic...

gaitlog.mix {VGAM} | R Documentation

## Generally–Altered, –Inflated and –Truncated Logarithmic Regression Family Function (GAIT–Log–Log–Log Mixture Variant)

### Description

Fits a generally–altered, –inflated and –truncated logarithmic regression (mixtures of logarithmic distributions on nested and/or partitioned supports).

### Usage

    gaitlog.mix(alter = NULL, inflate = NULL, truncate = NULL,
        max.support = Inf, zero = c("pobs.a", "pstr.i"),
        eq.ap = FALSE, eq.ip = FALSE, lshape.p = "logitlink",
        lpobs.a = "logitlink", lshape.a = "logitlink",
        lpstr.i = "logitlink", lshape.i = "logitlink",
        type.fitted = c("mean", "pobs.a", "pstr.i", "Pobs.a", "Pstr.i",
        "prob.a", "prob.i", "prob.t", "lhs.prob"),
        imethod = 1, gshape.p = -expm1(-7 * ppoints(12)), ishape.p = NULL,
        ishape.a = NULL, ishape.i = NULL,
        ipobs.a = NULL, ipstr.i = NULL, ishrinkage = 0.95, probs.y = 0.35)

### Arguments

`alter, inflate, truncate` | See `gaitpoisson.mix`.
`lshape.p, lshape.a, lshape.i` | Link functions. See `gaitpoisson.mix` and `Links` for more choices and information.
`lpobs.a, lpstr.i` | Link functions. See `gaitpoisson.mix` and `Links` for more choices and information.
`eq.ap, eq.ip` | Single logical each. See `gaitpoisson.mix`
`type.fitted, max.support` | See `gaitpoisson.mix`.
`imethod, ipobs.a, ipstr.i` | See `CommonVGAMffArguments` for information.
`gshape.p, ishape.p` | See `CommonVGAMffArguments` 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` for information.
`probs.y, ishrinkage` | See `CommonVGAMffArguments` for information.
`zero` | See `gaitpoisson.mix` and `CommonVGAMffArguments` for information.

### Details

Although the full GAIT–Log–Log–Log model may be fitted, the two submodels that may be fitted can be abbreviated GAT–Log–Log or GIT–Log–Log, which is where the inner distribution for ordinary values is the logarithmic distribution, and the outer distribution for the altered or inflated values is another logarithmic distribution with a different shape parameter by default. Thus for the GAT model the distribution being fitted is a (spliced) mixture of two logarithmic with differing (partitioned) support. Likewise, for the GIT model the distribution being fitted is a mixture of two logarithmic with nested support. Two shape parameters at a time may be constrained to be equal using `eq.ap` or `eq.ip`.

For the GIT model, by default, a logistic regression models the (structural) probability `pstr.i` that the response is inflated.

This function currently does not handle multiple responses. Further details are at `Gaitlog`.

For the GIT model, the ordering of the linear/additive predictors corresponds to `length(inflate)` equalling 0, 1, and more than 1; the dimension grows accordingly. The same idea holds for the GAT model.

Apart from the order of the linear/additive predictors, the following are (or should be) equivalent: `gaitlog.mix()` and `logff()`, `gaitlog.mix(alter = 1)` and `oalog(zero = "pobs1")`, `gaitlog.mix(inflate = 1)` and `oilog(zero = "pstr1")`, `gaitlog.mix(truncate = 1)` and `otlog()`.

### Value

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

### Warning

See `gaitpoisson.mix`

### Note

See `gaitpoisson.mix`

### Author(s)

T. W. Yee

### See Also

`Gaitlog`, `gaitpoisson.mix`, `gaitpoisson.mlm`, `oalog`, `oilog`, `otlog`, `CommonVGAMffArguments`, `rootogram4`, `simulate.vlm`.

### Examples

    avec <- c(5, 10)  # Alter these values
    ivec <- c(3, 15)  # Inflate these values
    tvec <- c(6, 7)   # Truncate these values
    max.support <- 20; set.seed(1)
    pobs.a <- logitlink(-1, inverse = TRUE)  # About 0.27
    pstr.i <- logitlink(-1, inverse = TRUE)  # About 0.27
    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, alter.mix = avec, pobs.mix.a = pobs.a,
                    inflate.mix = ivec, pstr.mix.i = pstr.i, truncate = tvec,
                    max.support = max.support))
    gaitlog.mix(alter = avec, inflate = ivec, max.support = max.support)
    with(gdata, table(y1))
    gaitlxfit <- vglm(y1 ~ x2, crit = "coef", trace = TRUE, data = gdata,
                      gaitlog.mix(inflate = ivec, truncate = tvec,
                                  max.support = max.support,
                                  alter = avec, eq.ap = TRUE, eq.ip = TRUE))
    head(fitted(gaitlxfit, type.fitted = "Pstr.i"))
    head(predict(gaitlxfit))
    coef(gaitlxfit, matrix = TRUE)
    summary(gaitlxfit)

[Package VGAM version 1.1-3 Index]