Last chance! 50% off unlimited learning
Sale ends in
Fits a generally-altered and -truncated negative binomial regression (using a multinomial logit model for the altered values).
gatnbinomial.mlm(alter = NULL, truncate = NULL, zero = "size",
lmunb = "loglink", lsize = "loglink", type.fitted = c("mean",
"pobs.a", "Pobs.a", "prob.a", "prob.t"),
imethod = 1, imunb = NULL, isize = exp(1), ishrinkage = 0.95,
probs.y = 0.35, cutoff.prob = 0.999, eps.trig = 1e-7,
max.chunk.MB = 30)
Same as gatpoisson.mlm
.
See Links
for more choices and information.
Similar to negbinomial
.
See CommonVGAMffArguments
and
gatpoisson.mlm
for information.
See CommonVGAMffArguments
for information.
See CommonVGAMffArguments
for information.
See negbinomial
for information.
See negbinomial
for information.
An object of class "vglmff"
(see vglmff-class
).
The object is used by modelling functions such as vglm
,
and vgam
.
See gatpoisson.mlm
for more information.
Due to its flexibility, it is easy to misuse this function;
the truncate
vector should ideally be not very long and
have values that can be justified by the application on hand.
Likewise, the alter
vector should be short too, and
each value should have good justification for being included.
Adding unnecessary values to these two arguments willy-nilly
is a recipe for disaster.
Regarding truncation,
under- or over-flow may occur if the data is ill-conditioned.
The response is checked to see that no values equal
any values of the truncate
vector.
Compared to gatpoisson.mlm
this family function is even more difficult to fit because
it is more flexible and involves approximating an infinite
series when computing the expected information matrix.
The generally-truncated (GT) negative binomial distribution is an
ordinary negative binomial
distribution with the probability of certain values
(given by the truncate
argument) being zero.
Thus the other probabilities are scaled up.
The (0-truncated) positive-negative binomial distribution is a
special case
(posnegbinomial
).
The generally-altered (GA) negative binomial distribution is an
ordinary negative binomial
distribution with the probability of certain values
(given by the alter
argument) being modelled using a multinomial
logit model
(see multinomial
).
The 0-altered negative binomial distribution is a special case
(zanegbinomial
)
and it is called a hurdle model by some people.
This function can fit both the GA and GT models simultaneously,
called the GAT-NB-MLM.
It might be applied to heaped data.
That is, each special value can be altered or truncated but
not both.
The default settings make this family function
equivalent to negbinomial
.
This function implements Fisher scoring and currently
does not handle multiple responses for GT or the GA model.
Compared to what could be ginbinomial.mlm
this family function handles deflation and inflation,
therefore handles a wider range of data.
For further details please see
Gaitnbinom.mlm
.
Gaitnbinom.mlm
,
gatpoisson.mlm
,
gatnbinomial.mix
,
zanegbinomial
,
multinomial
,
Posnegbin
,
CommonVGAMffArguments
,
simulate.vlm
.
# NOT RUN {
avec <- c(10, 20, 30) # Alter these values
tvec <- 0 # Truncate this value
pobs.a <- logitlink(-(2:4), inverse = TRUE) # Between 0.02 and 0.12
size1 <- exp(1)
gdata <- data.frame(x2 = runif(nn <- 1000))
gdata <- transform(gdata, lambda1 = exp(2 + 0.5 * x2))
gdata <- transform(gdata,
y1 = rgaitnbinom.mlm(nn, size1, mu = lambda1, pobs.a = pobs.a,
truncate = tvec, byrow = TRUE, alter = avec))
gatnbinomial.mlm(alter = avec)
(ty1 <- with(gdata, table(y1)))
propn1 <- c(ty1) / sum(ty1)
plot(as.numeric(names(ty1)), propn1, las = 1, xlab = "y",
yaxs = "i", ylim = c(0, max(propn1) * 1.1), main = "Heaped data",
ylab = "Proportion", lwd = 3, type = "h", col = "blue")
fit1 <- vglm(y1 ~ x2, trace = TRUE, data = gdata, crit = "coef",
gatnbinomial.mlm(alter = avec, truncate = tvec,
zero = c("size", "pobs")))
head(fitted(fit1))
head(predict(fit1))
coef(fit1, matrix = TRUE)
summary(fit1)
# }
Run the code above in your browser using DataLab