grid_by_trace: Interpolate multiple longitudinally traced patterns of...

Description Usage Arguments Details Value Author(s) References Examples

View source: R/grid_by_trace.R

Description

Creates interpolated (x,y) values onto a common grid of x-values from each trace_ID, without any explicit model fit. The interpolation uses stats::approxfun() or stats::splinefun() with one of 'linear', 'trapezoid', 'step', 'spline' as its 'method', where 'linear' and 'trapezoid' are synonyms in this function. The grid onto which values are interpolated is the union of all the distinct x-values across all traces and an evenly spaced grid of 'grid_n' (see parameters) x-values spanning the x-grid range.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
grid_by_trace(
  study_data_frame,
  check_data = FALSE,
  method = c("linear", "trapezoid", "step", "spline"),
  VST = TRUE,
  xmin = -Inf,
  xmax = Inf,
  xtol = (.Machine$double.eps) * 100,
  x_grid = NULL,
  grid_n = 101,
  include_obs_x = TRUE,
  subtract_starting_value = FALSE,
  na.rm = TRUE,
  singleton_to_NA = TRUE,
  group_name = maeve_options("group_name"),
  subject_ID = maeve_options("subject_ID"),
  trace_ID = maeve_options("trace_ID"),
  x_name = maeve_options("x_name"),
  endpoint_name = maeve_options("endpoint_name"),
  add_to_endpoint = maeve_options("add_to_endpoint"),
  trans_func_char = maeve_options("trans_func_char"),
  inv_func_char = maeve_options("inv_func_char"),
  test_func_x = maeve_options("test_func_x")
)

Arguments

study_data_frame

data.frame a "well-prepared" data.frame (e.g., processed through maeve::check_study_data_frame() is recommended but not required) with the study data and appropriate columns.

check_data

logical whether to pass "study_data_frame" through maeve::check_study_data_frame() to check for problems.

method

character name method for computing AUC. Passed directly to DescTools::AUC( ..., method = ... ).

VST

logical whether to apply a variance stabilizing transform to endpoint_name values.

xmin

numeric left / lower end of the interval.

xmax

numeric right / uppper end of the interval.

xtol

machine epsilon value to decide whether an x-grid value matches one of the observed x-values.

x_grid

numeric vector of points at which to interpolate y-values.

grid_n

numeric number of points in the grid.

include_obs_x

logical whether to force inclusion of the union of observed 'x' times in each trace.

subtract_starting_value

logical whether to subtract, for each trace_ID, the first value in the time series so that each series starts at zero.

na.rm

logical whether to remove NA values when computing summaries.

singleton_to_NA

logical whether to assign trace_ID cases with a single observation NA or zero.

group_name

character column name for the group name factor

subject_ID

character column name for the subject name factor

trace_ID

character column name for the subject name factor

x_name

character column name for the x-axis / time field

endpoint_name

character column name for the x-axis / time field

add_to_endpoint

numeric offset value added to the endpoint before transformation

trans_func_char

character function name for transformation of (endpoint_name + add_to_endpoint)

inv_func_char

character inverse function for transformation of (endpoint_name + add_to_endpoint)

test_func_x

numeric values with which to test that trans_func and inv_func are inverse functions.

Details

The 'trace_ID' factor can have two or more levels nested within a subject ID. Two trace levels can denote, e.g., longitudinal scans on two different tissues within the same animal, or two sequential longitudinal scans on the same tissue but with different, sequentially applied treatments.

If VST == TRUE, each ID-level vector of endpoint values (specified in 'endpoint_name') will be transformed for variance stabilization by adding a constant then transforming (e.g., "y = log( 1 + [[endpoint_name]] )"). The ID-level vector can be optionally centered to its first (in time-order) value, i.e, each y-value can have the first y-value subtracted from it.

Value

An R data.frame with one row per ID.

Author(s)

Bill Forrest <forrest@gene.com>

Bill Forrest forrest@gene.com

References

www.r-project.org

Examples

1
2
 vismo21 <- dplyr::filter( vismodegib, DAY_OF_STUDY <= 21 )
 vismo_grid_by_trace <- grid_by_trace( vismo21 )

wfforrest/maeve documentation built on Jan. 1, 2021, 12:47 p.m.