Title: | Cox Model with Interval-Censored Starting Time of a Covariate |
---|---|
Description: | Calibration and risk-set calibration methods for fitting Cox proportional hazard model when a binary covariate is measured intermittently. Methods include functions to fit calibration models from interval-censored data and modified partial likelihood for the proportional hazard model, Nevo et al. (2018+) <arXiv:1801.01529>. |
Authors: | Daniel Nevo |
Maintainer: | Daniel Nevo <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.0.8 |
Built: | 2025-01-31 04:39:08 UTC |
Source: | https://github.com/daniel258/iccalib |
For a given time point, calculate the probability of positive exposure value for multiple observations (participants). The function uses the results of a proportional hazards calibration model fit, and given covariates and collected data on the history of the binary exposure for each participant.
CalcCoxCalibP(w, w.res, point, fit.cox, hz.times, Q)
CalcCoxCalibP(w, w.res, point, fit.cox, hz.times, Q)
w |
A matrix of time points when measurements on the binary covariate were obtained. |
w.res |
A matrix of measurement results of the binary covariate. Each measurement corresponds to the time points in |
point |
The time point at which the probabilities are estimated |
fit.cox |
The result of |
hz.times |
Times used for calculating the baseline hazard function from PH calibration model |
Q |
Matrix of covariates for the PH calibration model |
A vector of estimated probabilities of positive exposure status at time point
.
sim.data <- ICcalib:::SimCoxIntervalCensCox(n.sample = 200, lambda = 0.1, alpha = 0.25, beta0 = 0, gamma.q = c(log(0.75), log(2.5)), gamma.z = log(1.5), mu = 0.2, n.points = 2) # The baseline hazard for the calibration model is calculated in observation times cox.hz.times <- sort(unique(sim.data$obs.tm)) # Fit proprtional hazards calibration model fit.cox <- FitCalibCox(w = sim.data$w, w.res = sim.data$w.res, Q = sim.data$Q, hz.times = cox.hz.times, n.int = 5, order = 2) # Calculate the conditional probabilities of binary covariate=1 at time one probs <- CalcCoxCalibP(w = sim.data$w, w.res = sim.data$w.res, point = 1, Q = sim.data$Q, fit.cox = fit.cox, hz.times = cox.hz.times) summary(probs)
sim.data <- ICcalib:::SimCoxIntervalCensCox(n.sample = 200, lambda = 0.1, alpha = 0.25, beta0 = 0, gamma.q = c(log(0.75), log(2.5)), gamma.z = log(1.5), mu = 0.2, n.points = 2) # The baseline hazard for the calibration model is calculated in observation times cox.hz.times <- sort(unique(sim.data$obs.tm)) # Fit proprtional hazards calibration model fit.cox <- FitCalibCox(w = sim.data$w, w.res = sim.data$w.res, Q = sim.data$Q, hz.times = cox.hz.times, n.int = 5, order = 2) # Calculate the conditional probabilities of binary covariate=1 at time one probs <- CalcCoxCalibP(w = sim.data$w, w.res = sim.data$w.res, point = 1, Q = sim.data$Q, fit.cox = fit.cox, hz.times = cox.hz.times) summary(probs)
For a given time point, calculate the probability of positive exposure value for multiple observations (participants). The function uses the results of proportional hazards grouped risk-set calibration model fit, and given covariates and collected data on the history of the binary exposure for each participant.
CalcCoxCalibRSIntsP(w, w.res, point, fit.cox.rs.ints, hz.times, Q, pts.for.ints)
CalcCoxCalibRSIntsP(w, w.res, point, fit.cox.rs.ints, hz.times, Q, pts.for.ints)
w |
A matrix of time points when measurements on the binary covariate were obtained. |
w.res |
A matrix of measurement results of the binary covariate. Each measurement corresponds to the time points in |
point |
The time point at which the probabilities are estimated |
fit.cox.rs.ints |
The result of |
hz.times |
Times used for calculating the baseline hazard function from PH calibration model |
Q |
Matrix of covariates for the PH calibration model |
pts.for.ints |
Points defining the intervals for grouping risk-sets (first one has to be zero). Should be sorted from zero up |
A vector of estimated probabilities of positive exposure status at time point
.
set.seed(17) sim.data <- ICcalib:::SimCoxIntervalCensCox(n.sample = 100, lambda = 0.1, alpha = 0.25, beta0 = 0, gamma.q = c(log(0.75), log(2.5)), gamma.z = log(1.5), mu = 0.2, n.points = 2) # The baseline hazard for the calibration model is calculated in observation times cox.hz.times <- sort(unique(sim.data$obs.tm)) # Fit proprtional hazards calibration model fit.cox.rs.ints <- FitCalibCoxRSInts(w = sim.data$w, w.res = sim.data$w.res, Q = sim.data$Q, hz.times = cox.hz.times, n.int = 5, order = 2, pts.for.ints = seq(0,4,1), tm = sim.data$obs.tm, event = sim.data$delta) # Calculate the conditional probabilities of binary covariate=1 at time one probs <- CalcCoxCalibRSIntsP(w = sim.data$w, w.res = sim.data$w.res, point = 1, fit.cox.rs.ints = fit.cox.rs.ints, pts.for.ints = seq(0,4,1), Q = sim.data$Q, hz.times = cox.hz.times) summary(probs)
set.seed(17) sim.data <- ICcalib:::SimCoxIntervalCensCox(n.sample = 100, lambda = 0.1, alpha = 0.25, beta0 = 0, gamma.q = c(log(0.75), log(2.5)), gamma.z = log(1.5), mu = 0.2, n.points = 2) # The baseline hazard for the calibration model is calculated in observation times cox.hz.times <- sort(unique(sim.data$obs.tm)) # Fit proprtional hazards calibration model fit.cox.rs.ints <- FitCalibCoxRSInts(w = sim.data$w, w.res = sim.data$w.res, Q = sim.data$Q, hz.times = cox.hz.times, n.int = 5, order = 2, pts.for.ints = seq(0,4,1), tm = sim.data$obs.tm, event = sim.data$delta) # Calculate the conditional probabilities of binary covariate=1 at time one probs <- CalcCoxCalibRSIntsP(w = sim.data$w, w.res = sim.data$w.res, point = 1, fit.cox.rs.ints = fit.cox.rs.ints, pts.for.ints = seq(0,4,1), Q = sim.data$Q, hz.times = cox.hz.times) summary(probs)
For a given time point, calculate the probability of positive exposure value for multiple observations (participants). The function uses the results of a nonparametric calibration model fit, and given collected data on the history of the binary exposure for each participant.
CalcNpmleCalibP(w, w.res, point, fit.npmle)
CalcNpmleCalibP(w, w.res, point, fit.npmle)
w |
A matrix of time points when measurements on the binary covariate were obtained. |
w.res |
A matrix of measurement results of the binary covariate. Each measurement corresponds to the time points in |
point |
The time point at which the probabilities are estimated. |
fit.npmle |
The result of |
A vector of estimated probabilities of positive exposure status at time point
.
sim.data <- ICcalib:::SimCoxIntervalCensSingle(n.sample = 200, lambda = 0.1, alpha = 0.25, beta0 = log(0.5), mu = 0.2, n.points = 2, weib.shape = 1, weib.scale = 2) # Fit nonparametric calibration model fit.npmle <- FitCalibNpmle(w = sim.data$w, w.res = sim.data$w.res) # Calculate the conditional probabilities of binary covariate=1 at time one probs <- CalcNpmleCalibP(w = sim.data$w, w.res = sim.data$w.res, point = 1, fit.npmle = fit.npmle) summary(probs)
sim.data <- ICcalib:::SimCoxIntervalCensSingle(n.sample = 200, lambda = 0.1, alpha = 0.25, beta0 = log(0.5), mu = 0.2, n.points = 2, weib.shape = 1, weib.scale = 2) # Fit nonparametric calibration model fit.npmle <- FitCalibNpmle(w = sim.data$w, w.res = sim.data$w.res) # Calculate the conditional probabilities of binary covariate=1 at time one probs <- CalcNpmleCalibP(w = sim.data$w, w.res = sim.data$w.res, point = 1, fit.npmle = fit.npmle) summary(probs)
For a given time point, calculate the probability of positive exposure value for multiple observations (participants). The function first fits the nonparametric risk-set calibration models at each main event time point and then calculates the probabilities of positive binary exposure status.
CalcNpmleRSP(w, w.res, point, obs.tm)
CalcNpmleRSP(w, w.res, point, obs.tm)
w |
A matrix of time points when measurements on the binary covariate were obtained. |
w.res |
A matrix of measurement results of the binary covariate. Each measurement corresponds to the time points in |
point |
The time point at which the probabilities are estimated |
obs.tm |
Vector of observed main event time or censoring time |
This function calculates the NPMLE at each main event time point and then provides the estimated probabilities for positive
exposure status at time point
.
A vector of estimated probabilities of positive exposure status at time point
.
# Simulate data set sim.data <- ICcalib:::SimCoxIntervalCensSingle(n.sample = 200, lambda = 0.1, alpha = 0.25, beta0 = log(0.5), mu = 0.2, n.points = 2, weib.shape = 1, weib.scale = 2) # Calculate the conditional probabilities of binary covariate=1 at time one # Unlike CalcNpmle, CalcNpmleRSP includes the calibration model fitting probs <- CalcNpmleRSP(w = sim.data$w, w.res = sim.data$w.res, point = 1, obs.tm = sim.data$obs.tm) summary(probs)
# Simulate data set sim.data <- ICcalib:::SimCoxIntervalCensSingle(n.sample = 200, lambda = 0.1, alpha = 0.25, beta0 = log(0.5), mu = 0.2, n.points = 2, weib.shape = 1, weib.scale = 2) # Calculate the conditional probabilities of binary covariate=1 at time one # Unlike CalcNpmle, CalcNpmleRSP includes the calibration model fitting probs <- CalcNpmleRSP(w = sim.data$w, w.res = sim.data$w.res, point = 1, obs.tm = sim.data$obs.tm) summary(probs)
Estimation of the covariance matrix for the parameters of the main proportional hazards model. This includes the variance of the binary exposure estimate and the other covariates, if included in the model. Each function correspond to a different calibration (or risk-set calibration model).
For nonparametric calibration, bootstrap calculations of the variance and confidence interval for the for the log hazard-ratio of the binary exposure.
CalcVarParam(theta, tm, event, Z, Q, ps, ps.deriv, w, w.res, fit.cox) CalcVarParamRSInts(theta, tm, event, Z, Q, ps, ps.deriv, w, w.res, fit.cox.rs.ints, pts.for.ints, n.etas.per.fit) CalcVarThetaWeib(beta, etas, tm, event, ps, ps.deriv.shape, ps.deriv.scale, w, w.res) CalcVarThetaWeibRS(beta, etas.matrix, tm, event, ps.rs, ps.deriv.shape.rs, ps.deriv.scale.rs, w, w.res) CalcVarNpmle(tm, event, w, w.res, BS = 100, CI = T) CalcVarNpmleRS(tm, event, w, w.res, BS = 100, CI = T)
CalcVarParam(theta, tm, event, Z, Q, ps, ps.deriv, w, w.res, fit.cox) CalcVarParamRSInts(theta, tm, event, Z, Q, ps, ps.deriv, w, w.res, fit.cox.rs.ints, pts.for.ints, n.etas.per.fit) CalcVarThetaWeib(beta, etas, tm, event, ps, ps.deriv.shape, ps.deriv.scale, w, w.res) CalcVarThetaWeibRS(beta, etas.matrix, tm, event, ps.rs, ps.deriv.shape.rs, ps.deriv.scale.rs, w, w.res) CalcVarNpmle(tm, event, w, w.res, BS = 100, CI = T) CalcVarNpmleRS(tm, event, w, w.res, BS = 100, CI = T)
theta |
Coefficient vector from main PH model. First coefficient corresponds to X, the rest to Z |
tm |
Vector of observed main event time or censoring time |
event |
Vector of censoring indicators. |
Z |
Additional variables for the main model other than the binary covariate |
Q |
For PH calibration models: additional covariates |
ps |
A matrix. Rows are observations, columns are time pointas of the events. The entry at the i-th row and j-column is the conditional probability of positive exposure status for observation i at the j-th event time. |
ps.deriv |
A matrix. Rows are observations, columns are time points of the events. The derivative of |
w |
A matrix of time points when measurements on the binary covariate were obtained. |
w.res |
A matrix of measurement results of the binary covariate. The measurement corresponding to the time points in |
fit.cox |
For PH calibration models: The result of |
fit.cox.rs.ints |
For grouped risk-set PH calibraion: The result of |
pts.for.ints |
For grouped-risk set PH calibraion: Points defining the intervals for grouping risk-sets (first one has to be zero). Should be sorted from zero up |
n.etas.per.fit |
For grouped-risk set PH calibraion: A vector. Total number of parameters for each PH calibration fit. |
beta |
Coefficient of the binary covariate. The analogue of theta for non-PH calibration models |
etas |
For Weibull calibration: Shape and scale parameters of the Weibull calibration model. |
ps.deriv.shape |
The derivative of |
ps.deriv.scale |
The derivative of |
etas.matrix |
For Weibull risk-set calibration: Two-columns matrix. Each row contains shape and scale parameters from a Weibull risk-set calibration model |
ps.rs |
A matrix. Rows are observations, columns are time points of the events. The entry at the i-th row and j-column is the conditional probability of positive exposure status for observation i at the j-th event time. |
ps.deriv.shape.rs |
For Weibull risk-set calibration:The derivative of |
ps.deriv.scale.rs |
For Weibull risk-set calibration:The derivative of |
BS |
For nonparametric calibration: Number of bootstrap iterations, Default: 100 |
CI |
For nonparametric calibration: Should the function return confidence intervals?, Default: T |
The covariance matrix. The first row and column are for the binary exposure.
For nonparametric calibration: Variance estimate and possibly confidence interval for the log hazard-ratio of the binary exposure under a nonparametric calibration model.
# Simulate data set sim.data <- ICcalib:::SimCoxIntervalCensSingle(n.sample = 200, lambda = 0.1, alpha = 0.25, beta0 = log(0.5), mu = 0.2, n.points = 2, weib.shape = 1, weib.scale = 2) case.times <- sim.data$obs.tm[sim.data$delta==1] # Fit a Weibull calibration model for the covariate starting time distribution calib.weib.params <- FitCalibWeibull(w = sim.data$w, w.res = sim.data$w.res) px <- t(sapply(case.times, CalcWeibullCalibP, w = sim.data$w, w.res = sim.data$w.res, weib.params = calib.weib.params)) # Calculate derivative matrices px.deriv.shape <- t(sapply(case.times, ICcalib:::CalcWeibullCalibPderivShape, w = sim.data$w, w.res = sim.data$w.res, weib.params = calib.weib.params)) px.deriv.scale <- t(sapply(case.times, ICcalib:::CalcWeibullCalibPderivScale, w = sim.data$w, w.res = sim.data$ w.res, weib.params = calib.weib.params)) # Point estimate est.weib.calib <- optimize(f = ICcalib:::CoxLogLikX, tm = sim.data$obs.tm, event = sim.data$delta, ps = px, interval = c(-50,50), maximum = TRUE)$maximum # Variance estimate (no addtional covariates) var.beta.wb <- CalcVarThetaWeib(beta = est.weib.calib, etas = calib.weib.params, tm = sim.data$obs.tm, event = sim.data$delta, ps = px, ps.deriv.shape = px.deriv.shape, ps.deriv.scale = px.deriv.scale, w = sim.data$w, w.res = sim.data$w.res) print(est.weib.calib) print(var.beta.wb)
# Simulate data set sim.data <- ICcalib:::SimCoxIntervalCensSingle(n.sample = 200, lambda = 0.1, alpha = 0.25, beta0 = log(0.5), mu = 0.2, n.points = 2, weib.shape = 1, weib.scale = 2) case.times <- sim.data$obs.tm[sim.data$delta==1] # Fit a Weibull calibration model for the covariate starting time distribution calib.weib.params <- FitCalibWeibull(w = sim.data$w, w.res = sim.data$w.res) px <- t(sapply(case.times, CalcWeibullCalibP, w = sim.data$w, w.res = sim.data$w.res, weib.params = calib.weib.params)) # Calculate derivative matrices px.deriv.shape <- t(sapply(case.times, ICcalib:::CalcWeibullCalibPderivShape, w = sim.data$w, w.res = sim.data$w.res, weib.params = calib.weib.params)) px.deriv.scale <- t(sapply(case.times, ICcalib:::CalcWeibullCalibPderivScale, w = sim.data$w, w.res = sim.data$ w.res, weib.params = calib.weib.params)) # Point estimate est.weib.calib <- optimize(f = ICcalib:::CoxLogLikX, tm = sim.data$obs.tm, event = sim.data$delta, ps = px, interval = c(-50,50), maximum = TRUE)$maximum # Variance estimate (no addtional covariates) var.beta.wb <- CalcVarThetaWeib(beta = est.weib.calib, etas = calib.weib.params, tm = sim.data$obs.tm, event = sim.data$delta, ps = px, ps.deriv.shape = px.deriv.shape, ps.deriv.scale = px.deriv.scale, w = sim.data$w, w.res = sim.data$w.res) print(est.weib.calib) print(var.beta.wb)
For a given time point, calculate the probability of positive exposure value for multiple observations (participants). The function uses the results of a Weibull calibration model fit, and given collected data on the history of the binary exposure for each participant.
CalcWeibullCalibP(w, w.res, point, weib.params)
CalcWeibullCalibP(w, w.res, point, weib.params)
w |
A matrix of time points when measurements on the binary covariate were obtained. |
w.res |
A matrix of measurement results of the binary covariate. Each measurement corresponds to the time points in |
point |
The time point at which the probabilities are estimated. |
weib.params |
A bivariate vector. Shape and scale parameters of the Weibull calibration model. |
A vector of estimated probabilities of positive exposure status at time point
.
# Simulate data set sim.data <- ICcalib:::SimCoxIntervalCensSingle(n.sample = 200, lambda = 0.1, alpha = 0.25, beta0 = log(0.5), mu = 0.2, n.points = 2, weib.shape = 1, weib.scale = 2) # Fit a Weibull calibration model for the covariate starting time distribution calib.weib.params <- FitCalibWeibull(w = sim.data$w, w.res = sim.data$w.res) # Calculate the conditional probabilities of binary covariate=1 at time one probs <- CalcWeibullCalibP(w = sim.data$w, w.res = sim.data$w.res, point = 1, weib.params = calib.weib.params) summary(probs)
# Simulate data set sim.data <- ICcalib:::SimCoxIntervalCensSingle(n.sample = 200, lambda = 0.1, alpha = 0.25, beta0 = log(0.5), mu = 0.2, n.points = 2, weib.shape = 1, weib.scale = 2) # Fit a Weibull calibration model for the covariate starting time distribution calib.weib.params <- FitCalibWeibull(w = sim.data$w, w.res = sim.data$w.res) # Calculate the conditional probabilities of binary covariate=1 at time one probs <- CalcWeibullCalibP(w = sim.data$w, w.res = sim.data$w.res, point = 1, weib.params = calib.weib.params) summary(probs)
For a given time point, calculate the probability of positive exposure value for multiple observations (participants). The function uses the results of a Weibull calibration model fit, and given collected data on the history of the binary exposure for each participant.
CalcWeibullRSP(w, w.res, point, weib.params)
CalcWeibullRSP(w, w.res, point, weib.params)
w |
A matrix of time points when measurements on the binary covariate were obtained. |
w.res |
A matrix of measurement results of the binary covariate. Each measurement corresponds to the time points in |
point |
The time point at which the probabilities are estimated. |
weib.params |
A bivariate vector. Shape and scale parameters of the Weibull calibration model. |
At its present form this function is identical to CalcWeibullCalibP
. This is because the current version of the ICcalib
package
(Version 1.0.005), the user loop over the main event times. Then, at each event time point, the user should include the appropriate Weibull
parameters as estimated by FitCalibWeibullRS
.
A vector of estimated probabilities of positive exposure status at time point
.
# Simulate data set sim.data <- ICcalib:::SimCoxIntervalCensSingle(n.sample = 200, lambda = 0.1, alpha = 0.25, beta0 = log(0.5), mu = 0.2, n.points = 2, weib.shape = 1, weib.scale = 2) case.times <- sim.data$obs.tm[sim.data$delta==1] # Fit Weibull risk-set calibration models calib.weib.params <- FitCalibWeibullRS(w = sim.data$w, w.res = sim.data$w.res, tm = sim.data$obs.tm, event = sim.data$delta) # Calculate the conditional probabilities of binary covariate=1 at time one probs <- CalcWeibullRSP(w = sim.data$w, w.res = sim.data$w.res, point = 1, weib.params = calib.weib.params) summary(probs) ## Not run: if(interactive()){ #EXAMPLE1 } ## End(Not run)
# Simulate data set sim.data <- ICcalib:::SimCoxIntervalCensSingle(n.sample = 200, lambda = 0.1, alpha = 0.25, beta0 = log(0.5), mu = 0.2, n.points = 2, weib.shape = 1, weib.scale = 2) case.times <- sim.data$obs.tm[sim.data$delta==1] # Fit Weibull risk-set calibration models calib.weib.params <- FitCalibWeibullRS(w = sim.data$w, w.res = sim.data$w.res, tm = sim.data$obs.tm, event = sim.data$delta) # Calculate the conditional probabilities of binary covariate=1 at time one probs <- CalcWeibullRSP(w = sim.data$w, w.res = sim.data$w.res, point = 1, weib.params = calib.weib.params) summary(probs) ## Not run: if(interactive()){ #EXAMPLE1 } ## End(Not run)
Fits a proportional hazards calibration model for time-to-exposure from interval-censored data with covariates. The exposure is a binary covariate measured
in intermittent times. The covariates (Q
) are associated with the time-to-exposure.
FitCalibCox(w, w.res, Q, hz.times, n.int = 5, order = 2)
FitCalibCox(w, w.res, Q, hz.times, n.int = 5, order = 2)
w |
A matrix of time points when measurements on the binary covariate were obtained. |
w.res |
A matrix of measurement results of the binary covariate. It corresponds to the time points in |
Q |
Matrix of covariates for PH calibration model |
hz.times |
Times used for calculating the baseline hazard function from PH calibration model |
n.int |
The number of interior knots to be used, see |
order |
the order of the basis functions. See |
An object created by ICsurv::fast.PH.ICsurv.EM, with additional variables knots
and order
.
sim.data <- ICcalib:::SimCoxIntervalCensCox(n.sample = 200, lambda = 0.1, alpha = 0.25, beta0 = 0, gamma.q = c(log(0.75), log(2.5)), gamma.z = log(1.5), mu = 0.2, n.points = 2) # The baseline hazard for the calibration model is calculated in observation times cox.hz.times <- sort(unique(sim.data$obs.tm)) # Fit proprtional hazards calibration model FitCalibCox(w = sim.data$w, w.res = sim.data$w.res, Q = sim.data$Q, hz.times = cox.hz.times, n.int = 5, order = 2)
sim.data <- ICcalib:::SimCoxIntervalCensCox(n.sample = 200, lambda = 0.1, alpha = 0.25, beta0 = 0, gamma.q = c(log(0.75), log(2.5)), gamma.z = log(1.5), mu = 0.2, n.points = 2) # The baseline hazard for the calibration model is calculated in observation times cox.hz.times <- sort(unique(sim.data$obs.tm)) # Fit proprtional hazards calibration model FitCalibCox(w = sim.data$w, w.res = sim.data$w.res, Q = sim.data$Q, hz.times = cox.hz.times, n.int = 5, order = 2)
FitCalibCoxRS
fits proportional hazards risk-set calibration models for time-to-exposure from interval-censored data with covariates. The exposure is a binary covariate measured
in intermittent times. The covariates (Q
) are associated with the time-to-exposure. This function fits a calibration model at each main event time point,
using only members of the risk set at that time point.
model is fitted (for all the data) and used for that time point.
FitCalibCoxRSInts
fits proportional hazards grouped risk-set calibration models for time-to-exposure from interval-censored data with covariates. The exposure is a binary covariate measured
in intermittent times. The covariates (Q
) are associated with the time-to-exposure. Unlike FitCalibCoxRS
, this function fits a calibration model
at each of the given points for pts.for.ints
.
FitCalibCoxRS(w, w.res, Q, hz.times, tm, n.int = 5, order = 2, event) FitCalibCoxRSInts(w, w.res, Q, hz.times, n.int = 5, order = 2, tm, event, pts.for.ints)
FitCalibCoxRS(w, w.res, Q, hz.times, tm, n.int = 5, order = 2, event) FitCalibCoxRSInts(w, w.res, Q, hz.times, n.int = 5, order = 2, tm, event, pts.for.ints)
w |
A matrix of time points when measurements on the binary covariate were obtained. |
w.res |
A matrix of measurement results of the binary covariate. It corresponds to the time points in |
Q |
Matrix of covariates for PH calibration model |
hz.times |
Times used for calculating the baseline hazard function of a PH calibration model |
tm |
Vector of observed main event time or censoring time |
n.int |
The number of interior knots to be used, see |
order |
the order of the basis functions. See |
event |
Vector of censoring indicators. |
pts.for.ints |
Points defining the intervals for grouping risk-sets (first one has to be zero). Should be sorted from zero up.
|
In case of an error in the model-fitting at a certain time point, a proportional hazards calibration model (for all the data) is fitted and used for that time point.
A list of Cox PH model fits, each supplemented with the knots and order used for the I-splines.
fast.PH.ICsurv.EM
, FitCalibCox
fast.PH.ICsurv.EM
, FitCalibCox
set.seed(2) sim.data <- ICcalib:::SimCoxIntervalCensCox(n.sample = 50, lambda = 0.1, alpha = 0.25, beta0 = log(0.2), gamma.q = c(log(0.75), log(2.5)), gamma.z = log(1.5), mu = 0.2, n.points = 2) # The baseline hazard for the calibration model is calculated in observation times cox.hz.times <- sort(unique(sim.data$obs.tm)) # Fit proprtional hazards grouped risk-sets calibration models calib.ph.rs.fit <- FitCalibCoxRSInts(w = sim.data$w, w.res = sim.data$w.res, Q = sim.data$Q, hz.times = cox.hz.times, tm = sim.data$obs.tm, event = sim.data$delta, pts.for.ints = seq(0, 3, 1.5), n.int = 5, order = 2) # Below is a more time consuming option (no grouping of risk-sets) # FitCalibCoxRS(w = sim.data$w, w.res = sim.data$w.res, Q = sim.data$Q, # hz.times = cox.hz.times, obs.tm = sim.data$obs.tm, # event = sim.data$delta, n.int = 5, order = 1)
set.seed(2) sim.data <- ICcalib:::SimCoxIntervalCensCox(n.sample = 50, lambda = 0.1, alpha = 0.25, beta0 = log(0.2), gamma.q = c(log(0.75), log(2.5)), gamma.z = log(1.5), mu = 0.2, n.points = 2) # The baseline hazard for the calibration model is calculated in observation times cox.hz.times <- sort(unique(sim.data$obs.tm)) # Fit proprtional hazards grouped risk-sets calibration models calib.ph.rs.fit <- FitCalibCoxRSInts(w = sim.data$w, w.res = sim.data$w.res, Q = sim.data$Q, hz.times = cox.hz.times, tm = sim.data$obs.tm, event = sim.data$delta, pts.for.ints = seq(0, 3, 1.5), n.int = 5, order = 2) # Below is a more time consuming option (no grouping of risk-sets) # FitCalibCoxRS(w = sim.data$w, w.res = sim.data$w.res, Q = sim.data$Q, # hz.times = cox.hz.times, obs.tm = sim.data$obs.tm, # event = sim.data$delta, n.int = 5, order = 1)
Fits a Weibull calibration model for time-to-exposure from interval-censored data. The exposure is a binary covariate measured in intermittent times.
FitCalibNpmle(w, w.res)
FitCalibNpmle(w, w.res)
w |
A matrix of time points when measurements on the binary covariate were obtained. |
w.res |
A matrix of measurement results of the binary covariate. It corresponds to the time points in |
The result of NPMLE model fitting for interval-censored data, as obtained by icenReg::ic_np
# Simulate data set sim.data <- ICcalib:::SimCoxIntervalCensSingle(n.sample = 200, lambda = 0.1, alpha = 0.25, beta0 = log(0.5), mu = 0.2, n.points = 2, weib.shape = 1, weib.scale = 2) # Calcualte the NPMLE for a nonparametric calibration model for the covariate # starting-time distribution npmle.fit <- ICcalib::FitCalibNpmle(w = sim.data$w, w.res = sim.data$w.res) # Plot the estimated survival function plot(npmle.fit)
# Simulate data set sim.data <- ICcalib:::SimCoxIntervalCensSingle(n.sample = 200, lambda = 0.1, alpha = 0.25, beta0 = log(0.5), mu = 0.2, n.points = 2, weib.shape = 1, weib.scale = 2) # Calcualte the NPMLE for a nonparametric calibration model for the covariate # starting-time distribution npmle.fit <- ICcalib::FitCalibNpmle(w = sim.data$w, w.res = sim.data$w.res) # Plot the estimated survival function plot(npmle.fit)
Fits a Weibull calibration model for time-to-exposure from interval-censored data. The exposure is a binary covariate measured in intermittent times.
FitCalibWeibull(w, w.res)
FitCalibWeibull(w, w.res)
w |
A matrix of time points when measurements on the binary covariate were obtained. |
w.res |
A matrix of measurement results of the binary covariate. It corresponds to the time points in |
A bivariate vector: the estimated Weibull shape and scale parameters
# Simulate data set sim.data <- ICcalib:::SimCoxIntervalCensSingle(n.sample = 200, lambda = 0.1, alpha = 0.25, beta0 = log(0.5), mu = 0.2, n.points = 2, weib.shape = 1, weib.scale = 2) # Fit a Weibull calibration model for the covariate starting time distribution ICcalib::FitCalibWeibull(w = sim.data$w, w.res = sim.data$w.res)
# Simulate data set sim.data <- ICcalib:::SimCoxIntervalCensSingle(n.sample = 200, lambda = 0.1, alpha = 0.25, beta0 = log(0.5), mu = 0.2, n.points = 2, weib.shape = 1, weib.scale = 2) # Fit a Weibull calibration model for the covariate starting time distribution ICcalib::FitCalibWeibull(w = sim.data$w, w.res = sim.data$w.res)
Fits Weibull risk-set calibration models for time-to-exposure from interval-censored data. The exposure is a binary covariate measured in intermittent times. This function fits a calibration model at each main event time point, using only members of the risk set at that time point.
FitCalibWeibullRS(w, w.res, tm, event, lower = 1e-04, upper = 200)
FitCalibWeibullRS(w, w.res, tm, event, lower = 1e-04, upper = 200)
w |
A matrix of time points when measurements on the binary covariate were obtained. |
w.res |
A matrix of measurement results of the binary covariate. Each measurement corresponds to the time points in |
tm |
Vector of observed main event time or censoring time. |
event |
Vector of censoring indicators. |
lower |
A value to replace zero in the left point of the interval, Default: 1e-04 |
upper |
A value to replace infinity in the right point of the interval, Default: 200 |
In case of an error in the model-fitting at a certain time point, a Weibull calibration model is fitted and used for that time point.
A 2-column matrix with the shape and scale parameter for each time-point at which a calibration model was fitted.
# Simulate data set sim.data <- ICcalib:::SimCoxIntervalCensSingle(n.sample = 200, lambda = 0.1, alpha = 0.25, beta0 = log(0.5), mu = 0.2, n.points = 2, weib.shape = 1, weib.scale = 2) # Fit Weibull risk-set calibration models for the conditional covariate # starting-time distributions ICcalib::FitCalibWeibullRS(w = sim.data$w, w.res = sim.data$w.res, tm = sim.data$obs.tm, event = sim.data$delta)
# Simulate data set sim.data <- ICcalib:::SimCoxIntervalCensSingle(n.sample = 200, lambda = 0.1, alpha = 0.25, beta0 = log(0.5), mu = 0.2, n.points = 2, weib.shape = 1, weib.scale = 2) # Fit Weibull risk-set calibration models for the conditional covariate # starting-time distributions ICcalib::FitCalibWeibullRS(w = sim.data$w, w.res = sim.data$w.res, tm = sim.data$obs.tm, event = sim.data$delta)