gentbinomial {VGAM} | R Documentation

## Generally-Truncated Binomial Distribution Family Function

### Description

Fits a generally-truncated binomial distribution.

### Usage

    gentbinomial(truncate = 0, zero = NULL, link = "logitlink",
                 type.fitted = c("mean", "prob", "prob.t"),
                 multiple.responses = FALSE, parallel = FALSE)

### Arguments

`truncate` | Vector of truncated values, i.e., integers between 0 and `size` inclusive. Must have unique values only. May be a `NULL`, which stands for empty set (same as `binomialff`). The default is the 0-truncated or positive-binomial.
`link, zero` | See `CommonVGAMffArguments` for information.
`multiple.responses, parallel` | See `CommonVGAMffArguments` for information.
`type.fitted` | See `CommonVGAMffArguments` for information. The choice `"prob.t"` means the probability of having a truncated value, given the estimate of `prob` from an ordinary binomial distribution. The mean can be be obtained by the extractor function `fitted` applied to the object (the default).

### Details

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.

### Value

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

### Warning

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.

### Note

This family function can handle multiple responses.

### Author(s)

Thomas W. Yee and Chenchen Ma

### See Also

`Gentbinom`, `rposbinom`, `posbinomial`, `binomialff`, `simulate.vlm`.

### Examples

    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)

[Package VGAM version 1.1-1 Index]