leia: Integrate AUC for curves from a multigroup GAM

Description Usage Arguments Value Author(s) References Examples

View source: R/leia.R

Description

Integrate AUC for curves from a multigroup GAM

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
leia(
  model,
  N = 25,
  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 = maeve_options("reference_Dunnett"),
  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 'gam' from package 'mgcv' (not package 'gam').

N

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

xmin

numeric lower bound of definite integral

xmax

numeric upper bound of definite integral

xname

character name of numeric variable used in the gam smooth. If provided, it should be accessible in "model$model[[xname]]".

xrange_norm_method

character string determining *how* the xrange normalization within leia() 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 one-dimensional smooth is conditioned. If provided, it should be the first and only component in model$xlevel.

contrast

character string with contrast type. 'Identity' gives each curve separately. 'Dunnett', 'Tukey', etc. from multcomp::contrMat() are accepted, as is 'custom' to indicate a custom contrast.

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 "model$xlevel[['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 smooth to integrate (the default, "0", means to just integrate the fixed smooth).

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
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 )
leia_out  <- leia( model, xmin = 0, xmax = pi/2, glht_rhs = 1 ) # about "1.0" over [ 0, pi/2 ]...
leia_list <- leia( model, xmin = 0, xmax = pi/2, glht_rhs = 1, return_list = TRUE ) # extras...

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