| Title: | Simultaneous-Equations Hazard/Probit Models with a Gaussian-Copula Correlation |
|---|---|
| Description: | Fits two-equation simultaneous models in the style of Lillard (1993) <doi:10.1016/0304-4076(93)90106-F>: a pair of processes, each either a binary probit outcome or a continuous-time hazard duration, linked through a single correlation parameter between their underlying error terms and estimated jointly by maximum likelihood via a Gaussian copula. Equation 1 may be a probit, a log-normal accelerated-failure-time hazard, or a piecewise (linear-log-hazard) Gompertz hazard with an arbitrary, user-specified number of segments; equation 2 is always a hazard, log-normal or piecewise Gompertz. Models can also be fit under independence (correlation fixed at zero), which reduces exactly to two separate univariate fits. See the package vignette/manual for the full likelihood derivation and a simulation-based verification. |
| Authors: | Nobutaka Fukuda [aut, cre] |
| Maintainer: | Nobutaka Fukuda <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0.0 |
| Built: | 2026-10-16 12:44:47 UTC |
| Source: | https://github.com/cran/lillardhaz |
Fits two-equation simultaneous models in the style of Lillard (1993): a
pair of processes – each a binary probit outcome or a continuous-time
hazard duration – linked through a single correlation parameter between
their underlying error terms, estimated jointly by maximum likelihood via
a Gaussian copula. See fit_lillardhaz.
Maintainer: Nobutaka Fukuda [email protected]
Authors:
Nobutaka Fukuda [email protected]
Useful links:
Report bugs at https://github.com/nobifukuda/lillardhaz/issues
Fits a two-equation simultaneous model in the style of Lillard (1993): a pair of processes, each either a binary probit outcome or a continuous- time hazard duration, linked through a single correlation parameter between their underlying error terms and estimated jointly by maximum likelihood via a Gaussian copula.
fit_lillardhaz( eq1, eq2, data, y1, d1 = NULL, y2, d2, x1 = character(0), x2 = character(0), nodes1 = NULL, nodes2 = NULL, corr = TRUE, start = NULL, method = "BFGS" )fit_lillardhaz( eq1, eq2, data, y1, d1 = NULL, y2, d2, x1 = character(0), x2 = character(0), nodes1 = NULL, nodes2 = NULL, corr = TRUE, start = NULL, method = "BFGS" )
eq1 |
one of |
eq2 |
one of |
data |
a data frame. |
y1 |
name of equation 1's outcome: the binary 0/1 variable if
|
d1 |
name of equation 1's failure indicator (ignored if
|
y2 |
name of equation 2's duration variable. |
d2 |
name of equation 2's failure indicator. |
x1 |
character vector of covariate names for equation 1's location index (may be empty for an intercept-only equation). |
x2 |
character vector of covariate names for equation 2's location index. |
nodes1, nodes2
|
interior nodes (ascending numeric vectors) for a
piecewise-Gompertz equation 1/equation 2; required exactly when that
equation is |
corr |
logical; if |
start |
optional named numeric vector of starting values. |
method |
optimization method passed to |
An object of class "lillardhaz": a list with components
coefficientsnamed numeric vector of maximum-likelihood
estimates (equation 1 and 2 location coefficients, ancillary
parameters such as ln_sigma or piecewise-Gompertz slopes, and
atanh_rho if corr = TRUE).
sestandard errors from the inverse negative Hessian
(NA if the Hessian is singular).
loglikmaximized log-likelihood.
rho, rho_se
estimated copula correlation between
the two equations' error terms and its delta-method standard error
(0 and NA when corr = FALSE).
fitthe underlying maxLik object.
eq1type, eq2type, nodes1, nodes2,
corr, x1, x2, y1name, y2name
the model specification.
nnumber of observations.
callthe matched call.
Methods for print, summary and predict are
available.
set.seed(1) n <- 2000 x1 <- rnorm(n); x2 <- rbinom(n, 1, 0.5) t1 <- exp(1 - 0.3 * x1 + 0.5 * rnorm(n)) c1 <- -log(runif(n)) / 0.05 t2 <- exp(0.6 + 0.4 * x2 + 0.6 * rnorm(n)) c2 <- -log(runif(n)) / 0.05 d <- data.frame( time1 = pmin(t1, c1), event1 = as.integer(t1 <= c1), time2 = pmin(t2, c2), event2 = as.integer(t2 <= c2), x1 = x1, x2 = x2 ) fit <- fit_lillardhaz("lognormal", "lognormal", d, y1 = "time1", d1 = "event1", y2 = "time2", d2 = "event2", x1 = "x1", x2 = "x2") summary(fit) head(predict(fit, type = "surv2"))set.seed(1) n <- 2000 x1 <- rnorm(n); x2 <- rbinom(n, 1, 0.5) t1 <- exp(1 - 0.3 * x1 + 0.5 * rnorm(n)) c1 <- -log(runif(n)) / 0.05 t2 <- exp(0.6 + 0.4 * x2 + 0.6 * rnorm(n)) c2 <- -log(runif(n)) / 0.05 d <- data.frame( time1 = pmin(t1, c1), event1 = as.integer(t1 <= c1), time2 = pmin(t2, c2), event2 = as.integer(t2 <= c2), x1 = x1, x2 = x2 ) fit <- fit_lillardhaz("lognormal", "lognormal", d, y1 = "time1", d1 = "event1", y2 = "time2", d2 = "event2", x1 = "x1", x2 = "x2") summary(fit) head(predict(fit, type = "surv2"))
Predicted survival/density/index from a fitted lillardhaz model
## S3 method for class 'lillardhaz' predict(object, newdata, type = "surv2", ...)## S3 method for class 'lillardhaz' predict(object, newdata, type = "surv2", ...)
object |
a fitted |
newdata |
optional data frame; defaults to the estimation sample via
|
type |
one of |
... |
unused. |
A numeric vector with one element per row of newdata,
evaluated at the estimated coefficients. Its meaning depends on
type:
"xb1", "xb2"
the linear location index
of equation 1 or 2 (for a log-normal equation, the
mean of log duration; for a piecewise-Gompertz equation, the log of
the proportional hazard shift).
"pr1"the predicted probability that the binary
outcome of equation 1 equals 1, ; only
available when eq1 = "probit".
"surv1", "surv2"
the marginal survival
probability , a value in [0, 1], of equation 1 or 2
evaluated at the observed duration in newdata (variable
y1 or y2 used in the fit).
"dens1", "dens2"
the marginal density
of equation 1 or 2 evaluated at that duration.
The survival and density predictions are marginal (per equation) and do not condition on the other equation's outcome.