Skip to contents

sigma() returns the fitted scale-like parameter from a drmTMB model. For univariate Gaussian location-scale models this is the fitted residual sigma_i vector on the response scale. For Student-t models this is the Student-t scale parameter; when nu > 2, the residual standard deviation is sigma * sqrt(nu / (nu - 2)). For skew-normal models this is the response standard deviation under the public moment parameterization, not the native Azzalini scale omega. For lognormal models this is the fitted standard deviation of log(y). For Gamma models this is the fitted coefficient of variation. For Tweedie models this is the public scale parameter where internal dispersion is phi = sigma^2. For beta, zero-one beta, and beta-binomial models this is the public scale parameter where internal precision is phi = 1 / sigma^2. Cumulative-logit ordinal, binomial, Poisson, and zero-inflated Poisson models have no fitted residual scale parameter and return a fixed unit dispersion vector for consistency with base-R sigma() conventions. For negative-binomial 2, zero-truncated negative-binomial 2, hurdle negative-binomial 2, and zero-inflated negative-binomial 2 models this is the fitted overdispersion scale in the untruncated NB2 component Var(y | component) = mu + sigma^2 * mu^2. For bivariate Gaussian, bivariate lognormal, and bivariate Student-t models it returns a roundable list with fitted sigma1 and sigma2 vectors. The bivariate-lognormal values are log-response SDs; the bivariate-Student values are Student-t scales, not marginal SDs.

Usage

# S3 method for class 'drmTMB'
sigma(object, ...)

Arguments

object

A drmTMB fit.

...

Reserved for future scale-extractor options.

Value

A numeric vector for univariate models, or a named, roundable list of numeric vectors for bivariate Gaussian, bivariate lognormal, or bivariate Student-t models.

Details

In meta-analytic models fitted with meta_V(V = V), this is the modelled residual heterogeneity scale, not the square root of the known sampling variance plus residual variance. Simulation and Pearson residuals combine known sampling covariance with residual scale internally.

For families in drm_clamped_scale_families(), sigma() reports the soft-clamped scale the TMB likelihood actually evaluated (see predict.drmTMB()), the same scale that residuals.drmTMB(), fitted(), and simulate() use. When check_drm() reports the clamp active, this makes the fit honest about what it evaluated, not correct: the estimate itself is still unreliable near the clamp.

sigma() follows drmTMB's distributional-regression contract, not the scalar summary contract some generic tools expect from stats::sigma(). When the scale formula contains fitted-row variation, such as sigma ~ x, sigma() returns one scale value per observation. Generic helpers that assume a scalar residual scale, including insight::get_sigma(), may summarize that vector and hide the fitted heterogeneity; inspect range(sigma(fit)) or predict.drmTMB() with dpar = "sigma" when the scale model is part of the scientific question.

Examples

dat <- data.frame(y = c(0.2, 0.5, 1.1, 1.4), x = c(-1, 0, 1, 2))
fit <- drmTMB(bf(y ~ x, sigma ~ x), data = dat)
sigma(fit)
#> [1] 0.06708204 0.06708204 0.06708204 0.06708204