# PMLE4SCR

This R package implements two-stage pseudo maximum likelihood estimation 
(PMLE) and simultaneous maximum likelihood estimation (MLE) for 
copula-based regression models with semi-competing risks data. The marginal 
distributions are modeled by semiparametric transformation regression models, 
and the dependence between the bivariate event times is specified by a 
parametric copula function with the copula parameter that may depend on 
some covariates.

## Install `PMLE4SCR`

To install this R package:

```r
install.packages("PMLE4SCR")
```

## Example

```r
library(PMLE4SCR)
data(BMT, package = "SemiCompRisks")
BMT$g <- factor(BMT$g, levels = c(2, 3, 1),
                labels = c("AML-low", "AML-high", "ALL"))

# Two-stage PMLE
myfit <- PMLE4SCR(BMT, time = "T2", death = "T1",
                  status_time = "delta2", status_death = "delta1",
                  T.fmla = ~ g, D.fmla = ~ g,
                  copula.family = "Clayton",
                  copula.control = list(formula = ~ g))
myfit$gamma
myfit$betaT

# Simultaneous MLE
myfit_mle <- MLE4SCR(BMT, time = "T2", death = "T1",
                     status_time = "delta2", status_death = "delta1",
                     T.fmla = ~ g, D.fmla = ~ g,
                     copula.family = "Clayton",
                     copula.control = list(formula = ~ g))
myfit_mle$gamma
myfit_mle$betaT
```

## Reference

This package implements the methods described in:

Arachchige, S. J., Chen, X., and Zhou, Q. M. (2025). Two-stage pseudo 
maximum likelihood estimation of semiparametric copula-based regression 
models for semi-competing risks data. *Lifetime Data Analysis*, 31, 52-75.
