simulate_ic_data: Simulate Interval-Censored Data

View source: R/iclogcondist_simulation.R

simulate_ic_dataR Documentation

Simulate Interval-Censored Data

Description

This function generates interval-censored data, where the event times are generated from one of the following distributions: Weibull, log-normal and log-logistic. It supports both case 1 and case 2 interval censoring.

Usage

simulate_ic_data(
  n,
  dist,
  para1,
  para2,
  upper_bound = Inf,
  C1_upper = 1,
  case = 2,
  rounding = FALSE,
  round_digit = 4
)

Arguments

n

An integer specifying the number of observations to generate.

dist

A character string indicating the distribution to use for event times. Options are "lognormal", "weibull", or "loglogistic".

para1

A numeric value representing the first parameter of the distribution:

  • "lognormal": Mean of the log-normal distribution (meanlog).

  • "weibull" and "loglogistic": Shape parameter.

para2

A numeric value representing the second parameter of the distribution:

  • "lognormal": Standard deviation of the log-normal distribution (sdlog).

  • "weibull" and "loglogistic": Scale parameter.

upper_bound

A numeric value specifying the upper bound for event times, corresponding to a truncated distribution. Default is Inf.

C1_upper

A numeric value specifying the upper limit for the first censoring time C1. Default is 1.

case

An integer specifying the censoring case to simulate:

  • 1: Current status (case 1 interval censoring)

  • 2: Case 2 Interval censoring

rounding

A logical value. If TRUE, generated times are rounded to a specified number of decimal places. Default is FALSE.

round_digit

An integer specifying the number of digits for rounding when rounding = TRUE. Default is 4.

Details

  • **Censoring Times**:

    • In case = 1 (current status), one censoring time is generated, where it follows U(0, C1_upper).

    • In case = 2 (case 2 interval censoring), two censoring times are generated:

      • C1: sampled from U(0, C1_upper).

      • C2: sampled from U(C1, min(upper_bound, 20)).

  • **Distributions**:

    • **Weibull**: Parameterized by shape (para1) and scale (para2).

    • **Log-logistic**: Parameterized by shape (para1) and scale (para2).

    • **Log-normal**: Parameterized by mean (para1) and standard deviation (para2).

Value

A matrix of interval-censored data where each row represents an interval (L, R] containing the unobserved event time.

Examples

# Simulate data with a truncated Weibull distribution and case II interval censoring
simulate_ic_data(n = 100, dist = "weibull", para1 = 2, para2 = 1, upper_bound = 5, case = 2)

iclogcondist documentation built on April 4, 2025, 5:18 a.m.