gaitdlog.RdFits a generally altered, inflated, truncated and deflated logarithmic regression by MLE. The GAITD combo model having 7 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, inflated and deflated values. Truncation may include the upper tail.
gaitdlog(a.mix = NULL, i.mix = NULL, d.mix = NULL,
a.mlm = NULL, i.mlm = NULL, d.mlm = NULL,
truncate = NULL, max.support = Inf,
zero = c("pobs", "pstr", "pdip"), eq.ap = TRUE, eq.ip = TRUE,
eq.dp = TRUE, parallel.a = FALSE,
parallel.i = FALSE, parallel.d = FALSE,
lshape.p = "logitlink", lshape.a = lshape.p,
lshape.i = lshape.p, lshape.d = lshape.p,
type.fitted = c("mean", "shapes", "pobs.mlm", "pstr.mlm",
"pdip.mlm", "pobs.mix", "pstr.mix", "pdip.mix", "Pobs.mix",
"Pstr.mix", "Pdip.mix", "nonspecial",
"Numer", "Denom.p", "sum.mlm.i", "sum.mix.i", "sum.mlm.d",
"sum.mix.d", "ptrunc.p", "cdf.max.s"),
gshape.p = -expm1(-7 * ppoints(12)), gpstr.mix = ppoints(7) / 3,
gpstr.mlm = ppoints(7) / (3 + length(i.mlm)),
imethod = 1, mux.init = c(0.75, 0.5, 0.75),
ishape.p = NULL, ishape.a = ishape.p,
ishape.i = ishape.p, ishape.d = ishape.p,
ipobs.mix = NULL, ipstr.mix = NULL, ipdip.mix = NULL,
ipobs.mlm = NULL, ipstr.mlm = NULL, ipdip.mlm = NULL,
byrow.aid = FALSE, ishrinkage = 0.95, probs.y = 0.35)See gaitdpoisson.
See gaitdpoisson.
See gaitdpoisson.
Link functions.
See gaitdpoisson
and Links for more choices
and information. Actually, it is usually
a good idea to set these arguments equal to
logffMlink because
the log-mean is the first linear/additive
predictor so it is like a Poisson regression.
Single logical each.
See gaitdpoisson.
Single logical each.
See gaitdpoisson.
See gaitdpoisson.
See CommonVGAMffArguments
and gaitdpoisson for information.
See CommonVGAMffArguments
and gaitdpoisson for information.
See CommonVGAMffArguments
and gaitdpoisson for information.
See CommonVGAMffArguments
and gaitdpoisson 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.
See CommonVGAMffArguments
and gaitdpoisson for information.
See CommonVGAMffArguments
and gaitdpoisson for information.
See gaitdpoisson
and CommonVGAMffArguments
for information.
Many details to this family function can be
found in gaitdpoisson because it
is also a 1-parameter discrete distribution.
This function currently does not handle
multiple responses. Further details are at
Gaitdlog.
As alluded to above, when there are covariates
it is much more interpretable to model
the mean rather than the shape parameter.
Hence logffMlink is
recommended. (This might become the default
in the future.) So installing VGAMextra
is a good idea.
Apart from the order of the linear/additive predictors,
the following are (or should be) equivalent:
gaitdlog() and logff(),
gaitdlog(a.mix = 1) and oalog(zero = "pobs1"),
gaitdlog(i.mix = 1) and oilog(zero = "pstr1"),
gaitdlog(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 gaitdpoisson.
See gaitdpoisson.
Gaitdlog,
logff,
logffMlink,
Gaitdpois,
gaitdpoisson,
gaitdzeta,
spikeplot,
goffset,
Trunc,
oalog,
oilog,
otlog,
CommonVGAMffArguments,
rootogram4,
simulate.vlm.
if (FALSE) 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 = rgaitdlog(nn, shape.p, a.mix = avec, pobs.mix = pobs.a,
i.mix = ivec, pstr.mix = pstr.i, truncate = tvec,
max.support = max.support))
#> Error in eval(substitute(list(...)), `_data`, parent.frame()): object 'avec' not found
gaitdlog(a.mix = avec, i.mix = ivec, max.support = max.support)
#> Error: object 'avec' not found
with(gdata, table(y1))
#> Error in eval(substitute(expr), data, enclos = parent.frame()): object 'y1' not found
spikeplot(with(gdata, y1), las = 1)
#> Error in eval(substitute(expr), data, enclos = parent.frame()): object 'y1' not found
fit7 <- vglm(y1 ~ x2, trace = TRUE, data = gdata,
gaitdlog(i.mix = ivec, truncate = tvec,
max.support = max.support, a.mix = avec,
eq.ap = TRUE, eq.ip = TRUE))
#> Error in eval(predvars, data, env): object 'y1' not found
head(fitted(fit7, type.fitted = "Pstr.mix"))
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'fitted': object 'fit7' not found
head(predict(fit7))
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'predict': object 'fit7' not found
t(coef(fit7, matrix = TRUE)) # Easier to see with t()
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'coef': object 'fit7' not found
summary(fit7)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'summary': object 'fit7' not found
spikeplot(with(gdata, y1), lwd = 2, ylim = c(0, 0.4))
#> Error in eval(substitute(expr), data, enclos = parent.frame()): object 'y1' not found
plotdgaitd(fit7, new.plot = FALSE, offset.x = 0.2, all.lwd = 2) # \dontrun{}
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'plotdgaitd': object 'fit7' not found