nb2: A negative binomial family

Description Usage Details Value Author(s) See Also Examples

View source: R/auxilaryfunctions.R

Description

Since the negative binomial is not a family in base R, an nb2() family has been created which establishes the negative binomial as a family for use in the main rpql function. Only the log link is available at the moment, with the variance parameterized as V = μ + φμ^2 where φ is the overdispersion parameter.

Usage

1
2
3
 
nb2()
  

Details

Used in the form rpql(y, ..., family = nb2(), ...).

Value

An object of class "family"

Author(s)

NA

Maintainer: NA

See Also

negative.binomial in the MASS package for another example of a negative.binomial family.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
## The function is currently defined as follows
nb2 <- function () {
    link <- "log"
    linkfun <- function(mu) log(mu)
    linkinv <- function(eta) pmax(exp(eta), .Machine$double.eps)
    mu.eta <- function(eta) pmax(exp(eta), .Machine$double.eps)
    variance <- function(mu, phi) mu + phi * mu^2
    valideta <- function(eta) TRUE
    validmu <- function(mu) all(mu > 0)
    structure(list(family = "negative.binomial", link = "log", 
        linkfun = linkfun, linkinv = linkinv, mu.eta = mu.eta, 
        variance = variance, valideta = valideta, validmu = validmu, 
        name = link), class = "family")
  }

## End(Not run)  

emitanaka/rpql documentation built on Aug. 12, 2019, 12:35 p.m.