Title: | Longitudinal Surrogate Marker Analysis |
---|---|
Description: | Assess the proportion of treatment effect explained by a longitudinal surrogate marker as described in Agniel D and Parast L (2021) <doi:10.1111/biom.13310>. |
Authors: | Layla Parast [aut, cre], Denis Agniel [aut] |
Maintainer: | Layla Parast <[email protected]> |
License: | GPL |
Version: | 1.0 |
Built: | 2025-02-14 02:56:31 UTC |
Source: | https://github.com/cran/longsurr |
Estimate the surrogate value of a longitudinal marker
estimate_surrogate_value(y_t, y_c, X_t, X_c, method = c("gam", "linear", "kernel"), k = 3, var = FALSE, bootstrap_samples = 50, alpha = 0.05)
estimate_surrogate_value(y_t, y_c, X_t, X_c, method = c("gam", "linear", "kernel"), k = 3, var = FALSE, bootstrap_samples = 50, alpha = 0.05)
y_t |
vector of n1 outcome measurements for treatment group |
y_c |
vector of n0 outcome measurements for control or reference group |
X_t |
n1 x T matrix of longitudinal surrogate measurements for treatment group, where T is the number of time points |
X_c |
n0 x T matrix of longitudinal surrogate measurements for control or reference group, where T is the number of time points |
method |
method for dimension-reduction of longitudinal surrogate, either 'gam', 'linear', or 'kernel' |
k |
number of eigenfunctions to use in semimetric |
var |
logical, if TRUE then standard error estimates and confidence intervals are provided |
bootstrap_samples |
number of bootstrap samples to use for standard error estimation, used if var = TRUE, default is 50 |
alpha |
alpha level, default is 0.05 |
a tibble containing estimates of the treatment effect (Deltahat), the residual treatment effect (Deltahat_S), and the proportion of treatment effect explained (R); if var = TRUE, then standard errors of Deltahat_S and R are also provided (Deltahat_S_se and R_se), and quantile-based 95% confidence intervals for Deltahat_S and R are provided (Deltahat_S_ci_l [lower], Deltahat_S_ci_h [upper], R_ci_l [lower], R_ci_u [upper])
Agniel D and Parast L (2021). Evaluation of Longitudinal Surrogate Markers. Biometrics, 77(2): 477-489.
library(dplyr) data(full_data) wide_ds <- full_data %>% dplyr::select(id, a, tt, x, y) %>% tidyr::spread(tt, x) wide_ds_0 <- wide_ds %>% filter(a == 0) wide_ds_1 <- wide_ds %>% filter(a == 1) X_t <- wide_ds_1 %>% dplyr::select(`-1`:`1`) %>% as.matrix y_t <- wide_ds_1 %>% pull(y) X_c <- wide_ds_0 %>% dplyr::select(`-1`:`1`) %>% as.matrix y_c <- wide_ds_0 %>% pull(y) estimate_surrogate_value(y_t = y_t, y_c = y_c, X_t = X_t, X_c = X_c, method = 'gam', var = FALSE) estimate_surrogate_value(y_t = y_t, y_c = y_c, X_t = X_t, X_c = X_c, method = 'linear', var = TRUE, bootstrap_sample = 50)
library(dplyr) data(full_data) wide_ds <- full_data %>% dplyr::select(id, a, tt, x, y) %>% tidyr::spread(tt, x) wide_ds_0 <- wide_ds %>% filter(a == 0) wide_ds_1 <- wide_ds %>% filter(a == 1) X_t <- wide_ds_1 %>% dplyr::select(`-1`:`1`) %>% as.matrix y_t <- wide_ds_1 %>% pull(y) X_c <- wide_ds_0 %>% dplyr::select(`-1`:`1`) %>% as.matrix y_c <- wide_ds_0 %>% pull(y) estimate_surrogate_value(y_t = y_t, y_c = y_c, X_t = X_t, X_c = X_c, method = 'gam', var = FALSE) estimate_surrogate_value(y_t = y_t, y_c = y_c, X_t = X_t, X_c = X_c, method = 'linear', var = TRUE, bootstrap_sample = 50)
Simulated nonsmooth data to illustrate functions
data("full_data")
data("full_data")
A data frame with 10100 observations on the following 5 variables.
id
a unique person ID
a
treatment group, 0 or 1
tt
time
x
surrogate marker value
y
primary outcome
Pre-smooth sparse longitudinal data
presmooth_data(obs_data, ...)
presmooth_data(obs_data, ...)
obs_data |
data.frame or tibble containing the observed data, with columns |
... |
additional arguments passed on to |
list containing matrices X_t
and X_c
, which are the smoothed surrogate values for the treated and control groups, respectively, for use in downstream analyses
library(dplyr) data(full_data) obs_ds <- group_by(full_data, id) obs_data <- sample_n(obs_ds, 5) obs_data <- ungroup(obs_data) head(obs_data) presmooth_X <- presmooth_data(obs_data)
library(dplyr) data(full_data) obs_ds <- group_by(full_data, id) obs_data <- sample_n(obs_ds, 5) obs_data <- ungroup(obs_data) head(obs_data) presmooth_X <- presmooth_data(obs_data)