weibreg: Weibull regression model for duration data

View source: R/weibreg.R

weibregR Documentation

Weibull regression model for duration data

Description

The Weibull model is the most popular model for duration data. This function enables the estimation of this model with two alternative (but equivalent) parametrization: the Accelerate Failure Time and the Proportional Hazard. Moreover heterogeneity can be introduced, which leads to the Gamma-Weibull model

Usage

weibreg(
  formula,
  data,
  weights,
  subset,
  na.action,
  offset,
  contrasts = NULL,
  model = c("aft", "ph"),
  opt = c("bfgs", "newton", "nr"),
  start = NULL,
  maxit = 100,
  robust = TRUE,
  trace = 0,
  mixing = FALSE,
  check_gradient = FALSE,
  ...
)

gres(x)

## S3 method for class 'weibreg'
scoretest(object, ..., vcov = NULL)

Arguments

formula

a symbolic description of the model

data

a data frame

subset, weights, na.action, offset, contrasts

see stats::lm,

model

one of "aft" or "ph"

opt

the optimization method

start

a vector of starting values

maxit

maximum number of iterations

robust

a boolean if TRUE, the log of the shape and the variance parameters are estimated

trace

an integer

mixing

if TRUE, the Gamma-Weibull model is estimated

check_gradient

if TRUE the numeric gradient and hessian are computed and compared to the analytical gradient and hessian

...

further arguments

x, object

a weibreg object

vcov

the covariance matrix estimator to use for the score test

Value

an object of class c("weibreg", "micsr"), see micsr::micsr for further details.

Examples

library(survival)
wz <- weibreg(Surv(duration, censored == "no") ~ gender + age + log(wage + 1),
         unemp_duration, mixing = TRUE, model = "ph")

micsr documentation built on June 8, 2025, 9:31 p.m.