Skip to contents

These methods expose drmTMB fits to standard base-R model summary and comparison helpers.

Usage

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

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

# S3 method for class 'drmTMB'
AIC(object, ..., k = 2)

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

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

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

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

Arguments

object

A drmTMB fit.

...

Reserved for future extractor options.

k

Numeric penalty per parameter for AIC(); the default is 2.

Value

logLik() returns an object of class "logLik". vcov() returns a numeric covariance matrix. nobs(), df.residual(), and deviance() return numeric scalars.

Details

logLik() returns a "logLik" object with df and nobs attributes so stats::AIC() and stats::BIC() use the fitted likelihood, optimized top-level parameter count, and fitted-row count consistently. nobs() returns the number of fitted rows after complete-case filtering. df.residual() returns nobs - df, where df is the number of optimized top-level parameters recorded in logLik(). deviance() returns -2 * logLik; for these likelihood-based distributional models this is an absolute negative twice log-likelihood value, not a saturated-model GLM deviance. vcov() returns the fixed-effect covariance matrix from TMB::sdreport() when the fit contains an sdreport object with pdHess = TRUE; the same object is available as fit$sdr and fit$sdreport. If sdreport() was skipped, failed, or returned pdHess = FALSE, Wald standard errors and Wald confidence intervals are unavailable while point estimates remain usable. vcov() intentionally does not include random-effect conditional modes or derived response-scale quantities.

Examples

set.seed(20260524)
n <- 36
x <- seq(-1.5, 1.5, length.out = n)
dat <- data.frame(
  y = 0.3 + 0.6 * x + rnorm(n, sd = 0.7),
  x = x
)
fit <- drmTMB(bf(y ~ x, sigma ~ 1), data = dat)

logLik(fit)
#> 'log Lik.' -26.64286 (df=3)
nobs(fit)
#> [1] 36
df.residual(fit)
#> [1] 33
deviance(fit)
#> [1] 53.28572
AIC(fit)
#> [1] 59.28572
BIC(fit)
#> [1] 64.03627
vcov(fit)
#>                   mu:(Intercept)          mu:x sigma:(Intercept)
#> mu:(Intercept)      7.145752e-03 -3.575043e-17      2.005656e-14
#> mu:x               -3.575043e-17  9.012661e-03     -5.755220e-15
#> sigma:(Intercept)   2.005656e-14 -5.755220e-15      1.388888e-02