Also available in Stata and Python versions
Load libraries
library(wooldridge)
library(AER)
Weibull Model for Recidivism Duration
with_covariates <- survreg(Surv(durat, cens==0) ~ workprg + priors + tserved + felon + alcohol + drugs + black + married + educ + age, data = recid, dist = "weibull")
summary(with_covariates)
##
## Call:
## survreg(formula = Surv(durat, cens == 0) ~ workprg + priors +
## tserved + felon + alcohol + drugs + black + married + educ +
## age, data = recid, dist = "weibull")
## Value Std. Error z p
## (Intercept) 4.221670 0.341311 12.37 < 2e-16
## workprg -0.112785 0.112535 -1.00 0.3162
## priors -0.110176 0.017067 -6.46 1.1e-10
## tserved -0.016830 0.002130 -7.90 2.8e-15
## felon 0.371623 0.131995 2.82 0.0049
## alcohol -0.555132 0.132243 -4.20 2.7e-05
## drugs -0.349265 0.121880 -2.87 0.0042
## black -0.563016 0.110817 -5.08 3.8e-07
## married 0.188104 0.135752 1.39 0.1659
## educ 0.028911 0.024115 1.20 0.2306
## age 0.004622 0.000665 6.95 3.6e-12
## Log(scale) 0.215840 0.038915 5.55 2.9e-08
##
## Scale= 1.24
##
## Weibull distribution
## Loglik(model)= -3192.1 Loglik(intercept only)= -3274.8
## Chisq= 165.48 on 10 degrees of freedom, p= 2.4e-30
## Number of Newton-Raphson Iterations: 5
## n= 1445
without_covariates <- survreg(Surv(durat, cens==0) ~ 1, data = recid, dist = "weibull")
summary(without_covariates)
##
## Call:
## survreg(formula = Surv(durat, cens == 0) ~ 1, data = recid, dist = "weibull")
## Value Std. Error z p
## (Intercept) 5.2245 0.0705 74.10 < 2e-16
## Log(scale) 0.2627 0.0397 6.61 3.7e-11
##
## Scale= 1.3
##
## Weibull distribution
## Loglik(model)= -3274.8 Loglik(intercept only)= -3274.8
## Number of Newton-Raphson Iterations: 5
## n= 1445