                                Package ‘longsurr’
                                           October 13, 2022
Type Package
Title Longitudinal Surrogate Marker Analysis
Version 1.0
Description Assess the proportion of treatment effect explained by a longitudinal surro-
      gate marker as described in Agniel D and Parast L (2021) <doi:10.1111/biom.13310>.
License GPL
Imports stringr, splines, mgcv, Rsurrogate, dplyr, here, tidyr, fs,
      KernSmooth, stats, fdapace, grf, lme4, mvnfast, plyr, tibble,
      magrittr, glue, purrr, readr, refund, fda, fda.usc
NeedsCompilation no
Author Layla Parast [aut, cre],
      Denis Agniel [aut]
Maintainer Layla Parast <parast@austin.utexas.edu>
Depends R (>= 3.5.0)
Repository CRAN
Date/Publication 2022-09-29 10:00:02 UTC
R topics documented:
         estimate_surrogate_value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .    2
         full_data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
         presmooth_data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .    4
Index                                                                                                    5
                                                      1
2                                                                               estimate_surrogate_value
  estimate_surrogate_value
                                Estimate the surrogate value of a longitudinal marker
Description
    Estimate the surrogate value of a longitudinal marker
Usage
    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)
Arguments
    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 pro-
                        vided
    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
Value
    a tibble containing estimates of the treatment effect (Deltahat), the residual treatment effect (Delta-
    hat_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])
References
    Agniel D and Parast L (2021). Evaluation of Longitudinal Surrogate Markers. Biometrics, 77(2):
    477-489.
full_data                                                                 3
Examples
     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)
   full_data                   Example data to illustrate functions
Description
     Simulated nonsmooth data to illustrate functions
Usage
     data("full_data")
Format
     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
4                                                                                         presmooth_data
  presmooth_data                Pre-smooth sparse longitudinal data
Description
    Pre-smooth sparse longitudinal data
Usage
    presmooth_data(obs_data, ...)
Arguments
    obs_data            data.frame or tibble containing the observed data, with columns id identifying
                        the individual measured, tt identifying the time of the observation, x the value
                        of the surrogate at time tt, and a indicating 1 for treatment arm and 0 for control
                        arm.
    ...                 additional arguments passed on to fpca
Value
    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
Examples
    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)
Index
∗ datasets
     full_data, 3
estimate_surrogate_value, 2
full_data, 3
presmooth_data, 4
                            5
