Title: | Sensitivity Analysis for Irregular Assessment Times |
---|---|
Description: | Sensitivity analysis for trials with irregular and informative assessment times, based on a new influence function-based, augmented inverse intensity-weighted estimator. |
Authors: | Andrew Redd [aut, cre] , Yujing Gao [aut], Shu Yang [aut], Bonnie Smith [aut], Ravi Varadhan [aut], Agatha Mallett [ctb, ctr], Daniel Scharfstein [pdr, aut] , University of Utah [cph] |
Maintainer: | Andrew Redd <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.1.9000 |
Built: | 2024-11-18 21:18:18 UTC |
Source: | https://github.com/uofuepibio/sensiat |
Produces a fitted model that may be used to produce estimates of mean and variance for the given group.
fit_SensIAT_fulldata_model(data, trt, ...) fit_SensIAT_within_group_model( group.data, outcome_modeler, knots, id.var, outcome.var, time.var, alpha = 0, intensity.covariates = ~., outcome.covariates = ~. - 1, End = max({ { time.var } }, na.rm = TRUE) + 1, integration.tolerance = .Machine$double.eps^(1/3), intensity.bandwidth = NULL, ..., influence.args = list() )
fit_SensIAT_fulldata_model(data, trt, ...) fit_SensIAT_within_group_model( group.data, outcome_modeler, knots, id.var, outcome.var, time.var, alpha = 0, intensity.covariates = ~., outcome.covariates = ~. - 1, End = max({ { time.var } }, na.rm = TRUE) + 1, integration.tolerance = .Machine$double.eps^(1/3), intensity.bandwidth = NULL, ..., influence.args = list() )
data |
the full data set. |
trt |
an expression that determine what is treated as the treatment. Everything not treatment is considered control. |
... |
add parameters as needed or use this to pass forward into the outcome_modeler. |
group.data |
The data for the group that is being analyzed.
Preferably passed in as a single |
outcome_modeler |
A separate function that may be swapped out to switch between negative-binomial, single index model, or another we will dream up in the future. |
knots |
knot locations for defining the spline basis. |
id.var |
The variable that identifies the patient. |
outcome.var |
The variable that contains the outcome. |
time.var |
The variable that contains the time. |
alpha |
The sensitivity parameter. |
intensity.covariates |
A formula representing modifications to the intensity model. |
outcome.covariates |
A formula representing modifications to the outcome model. The default removes the intercept term. |
End |
The end time for this data analysis, we need to set the default value as the max value of the time |
integration.tolerance |
The tolerance for the integration. |
intensity.bandwidth |
The bandwidth for the intensity model kernel. |
influence.args |
A list of additional arguments to pass to the influence function. |
This function should be agnostic to whether it is being provided a treatment or control group.
a list with class SensIAT-fulldata-fitted-model
with two components,
control
and treatment
, each of which is an independently fitted
SensIAT-within-group-fitted-model
fit with the fit_within_group_model
function.
Should return everything needed to define the fit of the model. This can then be used for producing the estimates of mean, variance, and in turn treatment effect. For the full data model a list with two models one each for the treatment and control groups.
fit_SensIAT_fulldata_model()
: Fit the sensitivity analysis for both treatment and control groups.
model <- fit_SensIAT_within_group_model( group.data = SensIAT_example_data, outcome_modeler = SensIAT_sim_outcome_modeler, alpha = c(-0.6, -0.3, 0, 0.3, 0.6), id.var = Subject_ID, outcome.var = Outcome, time.var = Time, End = 830, knots = c(60,60,60,60,260,460,460,460,460), )
model <- fit_SensIAT_within_group_model( group.data = SensIAT_example_data, outcome_modeler = SensIAT_sim_outcome_modeler, alpha = c(-0.6, -0.3, 0, 0.3, 0.6), id.var = Subject_ID, outcome.var = Outcome, time.var = Time, End = 830, knots = c(60,60,60,60,260,460,460,460,460), )
Compute Conditional Means
pcori_conditional_means(model, alpha = 0, new.data = model.frame(model), ...)
pcori_conditional_means(model, alpha = 0, new.data = model.frame(model), ...)
model |
An object of class |
alpha |
Sensitivity parameter |
new.data |
Data to compute conditional means for, defaults to the model frame for the fitted model. |
... |
passed onto methods. |
Compute the conditional expectations needed for predictions in the models. Three additional values/expectations are computed:
$E \big[ Y(t) \exp \{ \alpha Y(t) \} | A(t)=1, \bar{O}(t) \big]$
, returned as E_y_past
, and
$E \big[ \exp \{ \alpha Y(t) \} \ | A(t)=1, \bar{O}(t) \big]$
, returned as E_exp_alphaY
.
The new.data
frame with additional columns E_Y_past
, and E_exp_alphaY
appended.
Directly estimate the probability mass function of Y.
pcoriaccel_estimate_pmf(Xb, Y, xi, y_seq, h, kernel = "K2_Biweight")
pcoriaccel_estimate_pmf(Xb, Y, xi, y_seq, h, kernel = "K2_Biweight")
Xb |
Numeric vector of individual linear predictors from the data |
Y |
Numeric vector of individual responses from the data |
xi |
value of the individuals linear predictor at the point of estimation |
y_seq |
Numeric vector of unique values of |
h |
bandwidth of the kernel |
kernel |
character string specifying the kernel to use, either |
evaluate_basis()
functionCompiled version of evaluate_basis()
function
pcoriaccel_evaluate_basis(spline_basis, x)
pcoriaccel_evaluate_basis(spline_basis, x)
spline_basis |
The spline basis, S4 class |
x |
The point to evaluate |
Vector of the basis functions evaluated at x.
SensIAT
within-group modelPredict mean and variance of the outcome for a SensIAT
within-group model
## S3 method for class 'SensIAT_fulldata_model' predict(object, time, ...) ## S3 method for class 'SensIAT_within_group_model' predict(object, time, include.var = TRUE, ..., base = object$base)
## S3 method for class 'SensIAT_fulldata_model' predict(object, time, ...) ## S3 method for class 'SensIAT_within_group_model' predict(object, time, include.var = TRUE, ..., base = object$base)
object |
SensIAT_within_group_model object |
time |
Time points of interest |
... |
Currently ignored. |
include.var |
Logical. If TRUE, the variance of the outcome is also returned |
base |
A |
If include.var is TRUE, a tibble
with columns time, mean, and var is returned.
otherwise if include.var is FALSE, only the mean vector is returned.
predict(SensIAT_fulldata_model)
: For each combination of time
and alpha
estimate the mean response and
variance for each group as well as estimate the mean treatment effect and
variance.
model <- fit_SensIAT_within_group_model( group.data = SensIAT_example_data, outcome_modeler = SensIAT_sim_outcome_modeler, alpha = c(-0.6, -0.3, 0, 0.3, 0.6), id.var = Subject_ID, outcome.var = Outcome, time.var = Time, End = 830, knots = c(60,60,60,60,260,460,460,460,460), ) predict(model, time = c(90, 180))
model <- fit_SensIAT_within_group_model( group.data = SensIAT_example_data, outcome_modeler = SensIAT_sim_outcome_modeler, alpha = c(-0.6, -0.3, 0, 0.3, 0.6), id.var = Subject_ID, outcome.var = Outcome, time.var = Time, End = 830, knots = c(60,60,60,60,260,460,460,460,460), ) predict(model, time = c(90, 180))
A simulated dataset for use in the SensIAT tutorial, testing and documentation.
SensIAT_example_data
SensIAT_example_data
A data frame with 779 rows and 4 variables consisting of 200 simulated patients. Each row in the data represents a visit for the patient. The columns are:
A unique identifier for each patient.
The ordinal number of the visit for the patient. Baseline observation is 0.
The time of the visit in days, since baseline.
The outcome of interest.
Estimate response with jackknife resampling
SensIAT_jackknife(original.object, time, ...)
SensIAT_jackknife(original.object, time, ...)
original.object |
A SensIAT_within_group_model object. |
time |
Time points for which to estimate the response. |
... |
currently ignored. |
A tibble
with columns alpha, time, jackknife_mean, and jackknife_var,
where jackknife_mean is the mean of the jackknife estimates and jackknife_var
is the estimated variances of the response at the given time points for the
specified alpha values.
## Not run: original.object <- fit_SensIAT_within_group_model( group.data = SensIAT_example_data, outcome_modeler = SensIAT_sim_outcome_modeler, alpha = c(-0.6, -0.3, 0, 0.3, 0.6), id.var = Subject_ID, outcome.var = Outcome, time.var = Time, intensity.bandwidth = 30, knots = c(60,60,60,60,260,460,460,460,460), End = 830 ) jackknife.estimates <- SensIAT_jackknife(original.object, time = c(90, 180, 270, 360, 450)) ## End(Not run)
## Not run: original.object <- fit_SensIAT_within_group_model( group.data = SensIAT_example_data, outcome_modeler = SensIAT_sim_outcome_modeler, alpha = c(-0.6, -0.3, 0, 0.3, 0.6), id.var = Subject_ID, outcome.var = Outcome, time.var = Time, intensity.bandwidth = 30, knots = c(60,60,60,60,260,460,460,460,460), End = 830 ) jackknife.estimates <- SensIAT_jackknife(original.object, time = c(90, 180, 270, 360, 450)) ## End(Not run)
SensIAT
Single Index Model.Outcome Modeler for SensIAT
Single Index Model.
SensIAT_sim_outcome_modeler( formula, data, kernel = "K2_Biweight", method = "nmk", id = ..id.., ... )
SensIAT_sim_outcome_modeler( formula, data, kernel = "K2_Biweight", method = "nmk", id = ..id.., ... )
formula |
The outcome model formula |
data |
The data to fit the outcome model to. Should only include follow-up data, i.e. time > 0. |
kernel |
The kernel to use for the outcome model. |
method |
The optimization method to use for the outcome model, either |
id |
The patient identifier variable for the data. |
... |
Currently ignored, included for future compatibility. |
Object of class SensIAT::Single-index-outcome-model
which contains the outcome model portion.
model <- fit_SensIAT_within_group_model( group.data = SensIAT_example_data, outcome_modeler = SensIAT_sim_outcome_modeler, alpha = c(-0.6, -0.3, 0, 0.3, 0.6), id.var = Subject_ID, outcome.var = Outcome, time.var = Time, End = 830, knots = c(60,60,60,60,260,460,460,460,460), )
model <- fit_SensIAT_within_group_model( group.data = SensIAT_example_data, outcome_modeler = SensIAT_sim_outcome_modeler, alpha = c(-0.6, -0.3, 0, 0.3, 0.6), id.var = Subject_ID, outcome.var = Outcome, time.var = Time, End = 830, knots = c(60,60,60,60,260,460,460,460,460), )