Skip to contents

Fits an interval-censored model of various types (NP, PO, or PH) by iterating over baseline and regression parameter updates.

Usage

icsurvfit(L, R, Z, model = "NP", maxiter = 500)

Arguments

L

Left endpoints (may contain NA, -Inf).

R

Right endpoints (may contain NA, Inf).

Z

A matrix or data frame of covariates.

model

One of "NP", "PO", or "PH". Defaults to "NP" for nonparametric (no covariates).

maxiter

Maximum number of iterations for the fitting algorithm.

Value

A list (class "icsurvfit") with components:

beta

Estimated regression coefficients (if model="PO" or "PH").

y

Baseline function estimates at each time index.

t

Ordered time points at which y is evaluated.

var

Estimated variance-covariance matrix of beta (if applicable).

j

Number of iterations used.

model

The specified model type.

conv

Logical indicating whether the algorithm converged.

varnames

Covariate names.

call

Matched call.

Details

NP

Nonparametric (no covariate effects).

PO

Proportional odds.

PH

Proportional hazards.

Internally, this function sets up the data, identifies which observations are left-, right-, or interval-censored, and then calls various helper routines (e.g., profile1, NR2) to perform the iterative fitting.

Examples

# Simple example
data(bcos)

n <- nrow(bcos) # sample size
L <- bcos$left + rnorm(n, 0, 0.0001) # add random noise
R <- bcos$right + rnorm(n, 0, 0.0001)
Z <- as.numeric(bcos$treatment == "RadChem")

# Nonparametric
obj_np <- icsurvfit(L, R)

# Cox model (PH)
obj_ph <- icsurvfit(L, R, Z, model = "PH")
obj_ph
#> 
#> Call:
#> icsurvfit(L = L, R = R, Z = Z, model = "PH")
#> 
#> NPMLE of proportional hazards for interval-censored data:
#> 
#> ICM algorithm converges in 20 iterations.
#> 
#> Maximum Likelihood Estimates for Regression parameters:
#> 
#>      Estimate  StdErr z.value  p.value   
#> [1,]  0.80580 0.30391  2.6514 0.008016 **
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
#> Call:
#>   icsurvfit(L = L, R = R, Z = Z, model = "PH")
#>
#> NPMLE of proportional hazards for interval-censored data:
#>
#>   ICM algorithm converges in 20 iterations.
#>
#> Maximum Likelihood Estimates for Regression parameters:
#>
#>   Estimate  StdErr z.value  p.value
#> [1,]  0.78883 0.29344  2.6882 0.007183 **
#>   ---
#>   Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

# Proportional odds model (PO)
obj_po <- icsurvfit(L, R, Z, model = "PO")
obj_po
#> 
#> Call:
#> icsurvfit(L = L, R = R, Z = Z, model = "PO")
#> 
#> NPMLE of proportional odds for interval-censored data:
#> 
#> ICM algorithm converges in 18 iterations.
#> 
#> Maximum Likelihood Estimates for Regression parameters:
#> 
#>      Estimate  StdErr z.value p.value  
#> [1,]  0.87562 0.41301  2.1201   0.034 *
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
#> Call:
#>   icsurvfit(L = L, R = R, Z = Z, model = "PO")
#>
#> NPMLE of proportional odds for interval-censored data:
#>
#>   ICM algorithm converges in 20 iterations.
#>
#> Maximum Likelihood Estimates for Regression parameters:
#>
#>   Estimate  StdErr z.value p.value
#> [1,]  0.89529 0.41137  2.1764 0.02953 *
#>   ---
#>   Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1