We begin by opening the cabinet dataset.

#-------Dataset
cabinet <- read.dta("~/Dropbox/event_history/dta/cabinet.dta")

We create the survival object for our dependent variable, using the syntax Surv(time, event).

#--------Data prepation

dv <- Surv(cabinet$durat, cabinet$'_d')

Table 3.3

We run the Generalized Gamma and Weibull models.

# Generalized Gamma model 

gg_mod <- flexsurvreg(dv ~invest + polar + numst + format + postelec + caretakr,
                      data = cabinet, dist = "gengamma")


# Weibull model 

weib_mod <- survreg(dv ~invest + polar + numst + format + postelec + caretakr,
                  data = cabinet)

Let’s compare the results of our models.

Generalized Gamma Model of Cabinet Durations
Generalized Gamma Weibull
Constant 2.96 (0.14) 2.99 (0.13)
Investiture -0.30 (0.11) -0.30 (0.11)
Polarization -0.02 (0.01) -0.02 (0.01)
Majority 0.47 (0.10) 0.46 (0.10)
Formation -0.10 (0.03) -0.10 (0.03)
Post-Election 0.68 (0.11) 0.68 (0.10)
Caretaker -1.33 (0.21) -1.33 (0.20)
Shape Parameter 0.79 0.77
Scale Parameter 0.92
Log Likelihood -1014.55 -1014.62
N 314 314