View source: R/growthrate_gam.R
gam_growthrate_plot_combine | R Documentation |
save two figures (only use if you need to mess with titles)
gam_growthrate_plot_combine(ageplot_luna, tile_luna, PDFout = NA)
ageplot_luna |
ggplot plot of subject coef by age (top part of figure) |
tile_luna |
tile heatmap of slope (bottom part of figure) |
PDFout |
PDF name to save output into, NA no saved, NULL not plotted |
data <- data.frame(age=1:100,fd_mean=1:100,subj=as.factor(letters[1:25]), conn_ahpc_vmpfc=randu[1:100,1])
mod<-mgcv::gam(conn_ahpc_vmpfc~s(age)+s(fd_mean)+s(subj, bs="re"), data=data)
ci<-LNCDR::gam_growthrate(mod, 'age', n = 10000, qnt = c(0.025, 0.975), idvar='subj')
plist <- gam_growthrate_plot(data, mod, ci, 'age', idvar='subj')
plist$tile <- plist$tile + xlab('AGE')
g <- gam_growthrate_plot_combine(plist$ageplot, plist$tile, 'gammod.pdf')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.