gentbinomial {VGAM} | R Documentation |
Fits a generally-truncated binomial distribution.
gentbinomial(truncate = 0, zero = NULL, link = "logitlink", type.fitted = c("mean", "prob", "prob.t"), multiple.responses = FALSE, parallel = FALSE)
truncate |
Vector of truncated values, i.e., integers between 0 and
|
link, zero |
See |
multiple.responses, parallel |
See |
type.fitted |
See |
The generally-truncated binomial distribution is the ordinary binomial
distribution with the probability of certain values
(truncate
argument) being zero. Thus the
other probabilities are scaled up.
The positive-binomial (0-truncated) distribution is a special case
and is the default.
Note that the argument truncate
is integer-valued
even though the response is converted into a sample proportion.
An object of class "vglmff"
(see vglmff-class
).
The object is used by modelling functions such as vglm
,
rrvglm
and vgam
.
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.
It is easy to misuse this function;
the truncate
vector should ideally not be very long and
have values that can be justified by the application on hand.
This family function can handle multiple responses.
Thomas W. Yee and Chenchen Ma
Gentbinom
,
rposbinom
,
posbinomial
,
binomialff
,
simulate.vlm
.
nnn <- 1000; tvec <- c(2, 3, 6); size <- 10 pdata <- data.frame(x2 = runif(nnn), x3 = runif(nnn)) pdata <- transform(pdata, y1 = rgentbinom(nnn, prob = logitlink(-1, inverse = TRUE), truncate = tvec, size = size), y2 = rgentbinom(nnn, prob = logitlink(-1 + x2 + x3, inverse = TRUE), truncate = tvec, size = size)) with(pdata, table(y1)) with(pdata, table(y2)) head(pdata) fit1 <- vglm(cbind(y1, size - y1) ~ 1, gentbinomial(truncate = tvec), trace = TRUE, data = pdata) coef(fit1, matrix = TRUE) summary(fit1) fit2 <- vglm(cbind(y2, size - y2) ~ x2 + x3, crit = "coef", gentbinomial(truncate = tvec), trace = TRUE, data = pdata) coef(fit2, matrix = TRUE) summary(fit2)