The protocol below allows us to more rapidly carry out
hierarchical variance partitioning using
gam.hp() from the hp.gam package. It is
designed for Posit Workbench (RStudio Server) and
assumes pre-fitted mgcv::gam models saved as .rds files
with “model” in the title somewhere.
Link: https://bit.ly/clearRonline
Username: ubuntu
Password: (see Tory for the current password)
Start a new Session and name it YOURNAME-HP.
💡 Access to the Home directory is shared among all lab members. Please avoid overwriting each other’s files.
clearlab_gamhp_pipeline/
├── 00_uploaded_gamms_to_HP/ # Drop your .rds GAM model files here
├── 01_gamms_HPd_and_txt_output/ # Processed models + partition .txt outputs go here
├── hp_partitioning_script.R # Main R script
└── README.md # This file
mgcv::gam()
and save each as an .rds file.model (e.g., DRSP_model_beta.rds).In the Files pane, open
00_uploaded_gamms_to_HP/ and click Upload
to add your .rds model files. Your folder should look like:
00_uploaded_gamms_to_HP/
└── DRSP16_overwhelm_peri_model_beta.rds
Copy and paste this into the console and run it:
source("hp_partitioning_script.R")
For each model processed:
- A partition table (*_partition.txt) is generated.
- Both .rds and .txt are moved into
01_gamms_HPd_and_txt_output/.
For each .rds in 00_uploaded_gamms_to_HP/
containing model:
gam.hp() for variance
partitioning.txt
file.rds and .txt
into 01_gamms_HPd_and_txt_output/Before running:
00_uploaded_gamms_to_HP/
└── DRSP16_overwhelm_peri_model_beta.rds
After running:
01_gamms_HPd_and_txt_output/
├── DRSP16_overwhelm_peri_model_beta.rds
└── DRSP16_overwhelm_peri_model_beta_partition.txt
.rds files representing gam model results can be
processed..rds files with model somewhere in
the filename are processed.install.packages("mgcv")
install.packages("gam.hp")