pia: Integrate AUC for curves from a multigroup piecewise or...

Description Usage Arguments Value Author(s) References Examples

View source: R/pia.R

Description

Integrate AUC for curves from a multigroup piecewise or polynomial lmerMod mixed model: Piecewise/Polynomial Integration Analysis

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
pia(
  model,
  basis_choice = c("tent", "poly"),
  break_points = NULL,
  degree = NULL,
  N = 25,
  local_modeling_data_frame = NULL,
  xmin = NULL,
  xmax = NULL,
  xname = NULL,
  xrange_norm_method = c("none", "xrange", "half_xrange_squared"),
  subtract_starting_value = TRUE,
  groupname = NULL,
  contrast = c("Identity", "Dunnett", "Tukey", "Sequen", "custom"),
  custom_contrast = NULL,
  reference_Dunnett = NULL,
  glht_rhs = NULL,
  glht_alternative = c("two.sided", "less", "greater"),
  provide_warnings = TRUE,
  single_group_identifier = "group_01",
  derivative = 0,
  return_list = FALSE
)

Arguments

model

object of class 'lmerMod' from package 'lme4'.

basis_choice

character describing which basis function type to use in making a design matrix.

break_points

numeric vector with the x-locations at which to place break points.

degree

numeric degree of polynomial basis, if that is selected. Passed straight to stats::poly().

N

integer number of equally-spaced points to use in numerical integration.

local_modeling_data_frame

data.frame should be clean_DF_restricted form model_study(), or just the contents of maeve_options('modeling_data_frame').

xmin

numeric lower bound of definite integral

xmax

numeric upper bound of definite integral

xname

character name of numeric variable used in the piecewise fit. If provided, it should be a column in "maeve::maeve_options('modeling_data_frame')".

xrange_norm_method

character string determining *how* the xrange normalization within pia() should be done. Must be one of "none", "xrange", "half_xrange_squared".

subtract_starting_value

logical: Subtract from all computed AUCs the spline fit at xmin for that group (adjusted for xrange_norm_method choice).

groupname

character name of grouping factor by which the piecewise fit is conditioned. If provided, it should be the first and only component in model$xlevel.

contrast

character string with contrast type. 'Identity' gives each group fit separately. 'Dunnett', 'Tukey', etc., from multcomp::contrMat() are accepted.

custom_contrast

numeric matrix of contrasts for slope estimates. Column names must match exactly with treatment group names. If it is not NULL, it overrides whatever is specified in "contrast".

reference_Dunnett

character string with reference group for Dunnett's test. If provided, must match exactly to one of "maeve::maeve_options('modeling_data_frame')[['group']]".

glht_rhs

numeric vector for the right-hand side (rhs) of the contrast hypothesis; passed to glht() "rhs = " argument.

glht_alternative

character string passed to glht() as its "alternative = " argument.

provide_warnings

logical: provide warning messages when something looks look awry?

single_group_identifier

character string with name to give a single group in the output.

derivative

integer specifying which derivative of the fixed fits to integrate (the default, "0", means to just integrate the fixed effects curve by group).

return_list

logical: return a whole bunch of output in a list.

Value

an object of class glht from package multcomp (or a list if return_list == TRUE)

Author(s)

Bill Forrest <forrest@gene.com>

Bill Forrest forrest@gene.com

References

www.r-project.org

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
N <- 100
x <- seq( 0, pi, length = N )
set.seed( 20180425 )
dat <- data.frame( x, y = sin( x ) + rnorm( N, 0, .01 ) )
model    <- mgcv::gam( y ~ s( x ), data = dat )
pia_out  <- pia( model, xmin = 0, xmax = pi/2, glht_rhs = 1 ) # about "1.0" over [ 0, pi/2 ]...
pia_list <- pia( model, xmin = 0, xmax = pi/2, glht_rhs = 1, return_list = TRUE ) # extras...

## End(Not run)

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