View source: R/growthrate_gam.R
gam_growthrate | R Documentation |
posterior simulation for confidence intervals of local slope/growth rate (deriv) of mgcv gam modeled variable (age) - random effects: intercepts only (not predicted)
gam_growthrate(
m,
agevar,
idvar = NULL,
n.iterations = 10000,
qnt = c(0.025, 0.975)
)
m |
mgcv gam model object (only) |
agevar |
variable for growth rate |
idvar |
random effects/subject id variable, set to NULL if none |
nnumber |
of iterations to run (quick) |
qntquantiles |
to use for confidence interval |
https://people.maths.bris.ac.uk/~sw15190/mgcv/tampere/mgcv-advanced.pdf https://stats.stackexchange.com/questions/190348/can-i-use-bootstrapping-to-estimate-the-uncertainty-in-a-maximum-value-of-a-gam
d <- read.csv("/Volumes/Phillips/R03_BehavioralBTC/data/btc_R03scoredmeasures_20190313.csv") %>%
group_by(id) %>%
mutate(visit=rank(d8))
f <- f1score ~ s(Ageatvisit) + s(visit) + s(id, bs="re")
m <- mgcv::gam(f, data=d)
ci <- gam_growthrate(m, 'Ageatvisit', 'id')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.