This function both
draws a spline-difference plot for 2 splines,
and returns a dataframe of differences at each node
Usage
spline_diff(
gam_model,
tract,
group_by = "group",
factor_a,
factor_b,
save_output = TRUE,
sim.ci = FALSE,
out_dir
)
Arguments
- gam_model
GAM object, produced by gam/bam
- tract
AFQ tract name
- group_by
The grouping variable used to group nodeID smoothing terms
- factor_a
First group factor, string
- factor_b
Second group factor, string
- save_output
Boolean. If TRUE, save plot output
- sim.ci
Logical: Using simultaneous confidence intervals or not (default set to FALSE). The implementation of simultaneous CIs follows Gavin Simpson's blog of December 15, 2016: http://www.fromthebottomoftheheap.net/2016/12/15/simultaneous-interval-revisited/. This interval is calculated from simulations based. Please specify a seed (e.g., set.seed(123)) for reproducable results. Note: in contrast with Gavin Simpson's code, here the Bayesian posterior covariance matrix of the parameters is uncertainty corrected (unconditional=TRUE) to reflect the uncertainty on the estimation of smoothness parameters.
- out_dir
Directory in which to save plots