fbrNBglm: Firth-Type Bias-Reduced Negative Binomial Log-Linear Model

Description Usage Arguments Value Author(s) Examples

Description

This is the estimation algorithm for generalized linear model with negative binomial responses and log link function. Sore functions are modified properly such that bias in the coefficients are reduced.

Usage

1
2
3
4
5
6
7
fbrNBglm.fit(x, y, weights = rep(1, length(y)), offset = rep(0, length(y)),
  family, odisp, control = fbrNBglm.control())

fbrNBglm.control(standardizeX = TRUE, coefOnly = TRUE,
  solvers = nlSolvers, verbose = FALSE, maxit = 25L, start = NULL,
  infoParms = list(j = 1, k = 1, m = 1), order = 2L,
  tol = sqrt(.Machine$double.eps), qr.tol = tol)

Arguments

x, y, weights, offset

Defined the same as in glm.fit.

family

The same as in glm.fit, but the default (and the only currently supported) choice is negbin{'log', odisp}, where odisp is defined below.

odisp

A numeric scalar of negative binomial over-dispersion parameter. This is the same as 1/size, where size is the parameter as in dnbinom.

control

A list returned from fbrNBglm.control.

standardizeX

A logical scalar. If TRUE, columns of design matrix will be standardized with norm 1 during the fitting process, except for columns with identical values.

coefOnly

A logical scalar. If TRUE, only the regression coefficients will be returned. This is useful when being called from other functions, e.g. NBDev. If coef=FALSE, a glm object will be returned.

solvers

The non-linear equation solvers to be used if iterative fitting is necessary.

verbose

A logical scalar, indicating whether intermediate messages should be printed.

maxit

A positive integer, the maximum number of iterations allowed if iterative fitting is necessary.

start

A numeric vector of starting values, with length being the same as the number of columns of x.

infoParms

A list of three components, named j, k, and m, respectively. These parameters control the type of adjustment made to the score function. When all j, k, and m are 1, the observed information is used in the adjustment. When k=0, the expected information is used. See reference for details.

order

A positive integer. Usually this should be set to 2, indicating the second order, i.e., O(n^{-1}) bias being reduced by the adjustment. For one-way design, if infoParms$j=1 and offsets are constants within each treatment, the third order bias reduction with order=3 is also support, resulting in an estimate with both O(n^{-1}) order and O(n^{-2}) order biases being reduced.

tol

Small positive integer, indicating the desired accuracy of parameter estimates.

qr.tol

The same as the tol argument of qr.

Value

It depends.

Author(s)

Long Qu <rtistician@gmail.com>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 ## prepare example data
 data(mockRNASeqData)
 x=mockRNASeqData$design.matrix
 y=mockRNASeqData$counts[3462,]
 offset = log(mockRNASeqData$estimated.normalization)
 overDisp = mockRNASeqData$estimated.nbdisp[3462]
 nbfam = negbin('log', overDisp)
 
 ## usual maximum likelihood estimate
 coef(glm.fit(x, y, offset=offset, family=nbfam))
 
 ## 2nd-order biased reduced fit with observed information
 ctrl= fbrNBglm.control(infoParms=list(j=1,k=1,m=1), order=2L, coefOnly=TRUE)
 fbrNBglm.fit(x, y, offset=offset, family=nbfam, control=ctrl)

 ## 2nd-order biased reduced fit with expected information
 ctrl= fbrNBglm.control(infoParms=list(j=0,k=1,m=1), order=2L, coefOnly=TRUE)
 fbrNBglm.fit(x, y, offset=offset, family=nbfam, control=ctrl)
 
 ## 3rd-order biased reduced fit with observed information
 ## Not available yet if offsets are non-constants with a treatment
 offset.avg = ave(offset, mockRNASeqData$treatment)
 ctrl= fbrNBglm.control(infoParms=list(j=1,k=1,m=1), order=3L, coefOnly=TRUE)
 fbrNBglm.fit(x, y, offset=offset.avg, family=nbfam, control=ctrl)

gitlongor/QuasiSeq documentation built on May 17, 2019, 5:28 a.m.