| gaitlog {VGAM} | R Documentation |
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.
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 = 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 = -expm1(-7 * ppoints(12)),
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)
truncate, max.support |
See |
alt.mix, inf.mix |
See |
alt.mlm, inf.mlm |
See |
lshape.p, lshape.a, lshape.i |
Link functions.
See |
eq.ap, eq.ip |
Single logical each.
See |
parallel.ap, parallel.ip |
Single logical each.
See |
type.fitted, imux |
See |
imethod, ipobs.mix, ipstr.mix |
See |
ipobs.mlm, ipstr.mlm, byrow.ai |
See |
gpstr.mix, gpstr.mlm |
See |
gshape.p, ishape.p |
See |
ishape.a, ishape.i |
See |
probs.y, ishrinkage |
See |
zero |
See |
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.
An object of class "vglmff" (see vglmff-class).
The object is used by modelling functions such as vglm,
rrvglm
and vgam.
See gaitpoisson.
See gaitpoisson.
T. W. Yee
Gaitlog,
logff,
Gaitpois,
gaitpoisson,
gaitzeta,
spikeplot,
oalog,
oilog,
otlog,
CommonVGAMffArguments,
rootogram4,
simulate.vlm.
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))
## Not run: spikeplot(with(gdata, y1), las = 1)
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