View source: R/plot_smooth_term.R
plot_smooth_term | R Documentation |
Plot non-linear functions for BHAM objects
plot_smooth_term(mdl, term, smooth, min, max, plot = TRUE)
mdl |
a model fitted using bgam, banlasso or bacoxph |
plot |
a logic variable, indicating if ggplots are produced |
terms |
a vector of characters containing the variable names |
library(glmnet); data("QuickStartExample") # Load example data
x <- QuickStartExample$x; colnames(x) <- paste0("X", 1:ncol(x))
y <- QuickStartExample$y
dat <- data.frame(x, y)
spl_df <- data.frame(
Var = colnames(x),
Func = "s",
Args ="bs='cr', k=7"
)
train_sm_dat <- construct_smooth_data(spl_df, dat)
train_smooth <- train_sm_dat$Smooth
train_smooth_data <- train_sm_dat$data
mdl <-bamlasso(x = train_smooth_data, y = y, family = "gaussian",
group = make_group(names(train_smooth_data)))
plot_smooth_term(mdl, "X3", train_smooth, min = min(x[,"X3"])-0.1, max = max(x[,"X3"]) + 0.1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.