This function estimates a split-population duration model and returns a
object of class `spdur`

.

spdur(duration, atrisk, data = NULL, last = "end.spell", t.0 = "t.0", fail = "failure", distr = c("weibull", "loglog"), max.iter = 300, na.action, silent = FALSE, ...)

duration | A formula of the form Y ~ X1 + X2 …, where Y is duration until failure or censoring. |
---|---|

atrisk | A formula of the form C ~ Z1 + Z2 …, where C is a binary indicator of risk (1 - cure). |

data | A data frame containing the variables in formula and formula2. |

last | A string identifying the vector in |

t.0 | The starting point for time-varying covariate intervals, by
default |

fail | Name of the variable indicating that a spell ended in failure. |

distr | The type of distribution to use in the hazard rate. Valid options are ``weibull'' or ``loglog''; defaults to ``weibull''. |

max.iter | Maximum number of iterations to use in the likelihood maximization. |

na.action | a function which indicates what should happen when the data
contain NAs. The default is set by the |

silent | Suppress optimization output, |

… | Optional arguments, see details. |

Returns an object of class `spdur`

, with attributes:

A named vector of coefficient point estimates.

Estimated covariance matrix.

Standard error estimates.

Z-statistic values.

P-values.

Model frame for the duration equation.

Model frame for the risk equation.

Matrix of duration variables: risk, duration, end of spell, and t.0.

What action was taken for missing values in `data`

.

The original, unevaluated `spdur`

call.

Distribution used for the hazard rate.

See `summary.spdur`

, `predict.spdur`

,
and `plot.spdur`

for post-estimation options.

Optional arguments:

- base.inits
Initial values for the base duration model that is estimated to get initial values for the full split-population model. This needs to be a vector with starting values for the constant, coefficients in the duration equation, and an additional value for the shape parameter of the density used, e.g. Weibull. By default they are 0 for all coefficients and 0 or 1 for the Weibull and LogLog shape parameters respectively.

# Prepare data data(coups) dur.coups <- add_duration(coups, "succ.coup", unitID="gwcode", tID="year", freq="year") # Estimate model model.coups <- spdur(duration ~ polity2, atrisk ~ polity2, data=dur.coups)#> Fitting base weibull... #> Fitting split weibull... #> initial value 350.011512 #> iter 10 value 323.772940 #> iter 20 value 319.813601 #> final value 319.809378 #> convergedmodel.coups <- spdur(duration ~ polity2, atrisk ~ polity2, data=dur.coups, distr="loglog")#> Fitting base loglog... #> Fitting split loglog... #> initial value 347.703995 #> iter 10 value 319.703145 #> iter 20 value 317.637103 #> iter 20 value 317.637101 #> iter 20 value 317.637101 #> final value 317.637101 #> converged