## 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)
Run the code above in your browser using DataLab