inmoose.edgepy.estimateGLMTagwiseDisp
- inmoose.edgepy.estimateGLMTagwiseDisp(y, dispersion, design=None, offset=None, prior_df=10, trend=True, span=None, AveLogCPM=None, weights=None)
Compute an empirical Bayes estimate of the negative binomial dispersion parameter for each tag, with expression levels specified by a log-linear model.
This function implements the empirical Bayes strategy propose by McCarthy et al. (2012) [2] for estimating the tagwise negative binomial dispersions. The experimental conditions are specified by design matrix allowing for multiple explanatory factors. The empirical Bayes posterior is implemented as a conditional likelihood with tag-specific weights, and the conditional likelihood is computed using Cox-Reid approximate conditional likelihood (Cox and Reid, 1987 [1]).
The prior degrees of freedom determine the weight given to the global dispersion trend. The larger the prior degrees of freedom, the more the tagwise dispersions are squeezed towards the global trend.
Note that the terms “tag” and “gene” are synonymous here. The function is only named “tagwise” for historical reasons.
This function calls the lower-level
dispCoxReidInterpolateTagwise().- Parameters:
y (matrix) – matrix of counts
dispersion (float or array_like) – common or trended dispersion estimates, used as an initial estimate for the tagwise estimates
design (matrix) – the design matrix, as in
glmFitoffset (matrix, optional) – offset matrix for the log-linear model, as in
glmFit(). Defaults to the log-effective library sizes.prior_df (int) – prior degrees of freedom
trend (bool) – whether the prior should be the trended (
trend=True) or the common dispersion (trend=False)span (float, optional) – width of the smoothing window, in terms of proportion of the data set. Default value decreases with the number of tags.
AveLogCPM (array_like, optional) – vector of the average log2 counts per million for each tag
weights (matrix, optional) – observation weights
- Returns:
vector of the tagwise dispersion estimates
- Return type:
ndarray
References