This function generates ggplot objects for each smooth term in a GAM model. Predictions vary one smooth term at a time, keeping all other terms fixed at reference values. Confidence intervals are computed using ci_resp(), supporting multiple methods: "delta_link", "delta_resp", "bootstrap_link", "bootstrap_resp", and "posterior". Small samples automatically trigger the "posterior" method for more robust CIs.

plot_resp(robj, model.ci_method = "posterior", ...)

Arguments

robj

R object from the modelling functions.

model.ci_method

Character. One of "delta_link", "delta_resp", "bootstrap_link", "bootstrap_resp", "posterior".

...

Additional arguments passed to ci_resp().

Value

A list of ggplot objects, one per smooth term.

Examples


# loading processed data
dt.samples_trt <- readRDS(system.file("extdata", "dt.samples_trt.rds", package = "growthTrendR"))
# climate
dt.clim <- data.table::fread(system.file("extdata", "dt.clim.csv", package = "growthTrendR"))
# pre-data for model
dt.samples_clim <- prepare_samples_clim(dt.samples_trt, dt.clim)
dt.m <- dt.samples_clim[ageC >1]
# gamm_site model
m.spatial <-gamm_spatial(
  data = dt.m, resp_scale = "resp_log",
  m.candidates = c( "bai_cm2 ~ log(ba_cm2_t_1) + s(ageC) + s(FFD)"))
plots.lst <- plot_resp(m.spatial, model.ci_resp = "posterior")
#> Small sample detected (n < 30). Switching CI method to 'posterior' for robustness.