glmPT: Fit Poisson-Tweedie generalized linear model.

Description Usage Arguments Value Author(s) Examples

View source: R/glmPT.R

Description

'glmPT' is used to fit generalized linear models for the Poisson-Tweedie family of distributions.

Usage

1
2
tweeDEglm(formula, counts, data, mc.cores = 1, a = NULL, offset = NULL,  ...)
glmPT(formula, data, offset = NULL, a = NULL, ...)

Arguments

formula

an object of class 'formula': a symbolic description of the model to be fitted.

counts

Matrix or data.frame of counts for the 'tweeDEglm'.

data

an optional data frame, list or environment containing the variables in the model. If not found in 'data', the variables are taken from 'environment(formula)', typically the environment from which 'glm' is called.

mc.cores

number of cpu cores to be used. This option is only available when the 'multicore' package is installed and loaded first. In such a case, if the default value of 'mc.cores=1' is not changed, all available cores will be used.

offset

this can be used to specify an _a priori_ known component to be included in the linear predictor during fitting.

a

numeric vector (for 'tweeDEglm') or numeric scalar (for 'glmPT') smaller than 1. If specified the PT shape parameter will be fixed. For 'tweeDEglm', if the provided 'a' is a scalar this value will be used for all rows of 'counts' (genes).

...

additional arguments to be passed to the 'optim' 'control' options.

Value

An object of class 'glmPT' containing the following information:

call

the matched call.

contrasts

(where relevant) the contrasts used.

convergence

A character string giving any additional information returned by the optimizer, or 'NULL'.

counts

A two-element integer vector giving the number of calls to 'fn' and 'gr' respectively. This excludes those calls needed to compute the Hessian, if requested, and any calls to 'fn' to compute a finite-difference approximation to the gradient.

df

Number of estimated parameters.

fitted.values

The fitted mean values, obtained by transforming the linear predictors by the inverse of the link function.

hessian

A symmetric matrix giving an estimate of the Hessian at the solution found.

message

A character string giving any additional information returned by the optimizer, or 'NULL'.

ncov

An integer giving the number of variables in the model.

par

A vector giving the estimated parameters.

residuals

The residuals in the final iteration of the IWLS fit.

se

A vector giving the standard error of the estimated parameters.

value

Value of the log-likelihood of the model in the last iteration.

...

Further arguments to be passed to the 'glm.fit' function.

Author(s)

Mikel Esnaola <mesnaola@creal.cat>

Examples

1
2
3
4
5
6
7
8
9
counts <- matrix(rPT(n = 1000, a = 0.5, mu = 10, D = 5), ncol = 40)
g <- factor(rep(c(0,1), 20))
mod1 <- glmPT(counts[1,]~g)
mod1
summary(mod1)
anova(mod1)

mod2 <- tweeDEglm(~ g, counts) 
mod2

tweeDEseq documentation built on Nov. 8, 2020, 5:59 p.m.