## Simulate exponential data with censoring
set.seed(1234)
mu <- 2 # mean of exponential distribution
n <- 500
y <- rexp(n, rate = 1/mu)
## Introduce censoring (25% of observations)
status <- rbinom(n, 1, 0.75)
y_obs <- ifelse(status, y, NA)
## Compute scale estimate
scale_est <- weibull_scale(
log_y = log(y_obs[!is.na(y_obs)]),
log_mu = log(mu),
status = status[!is.na(y_obs)]
)
print(scale_est)
Run the code above in your browser using DataLab