View source: R/helper-functions.R
construct_smooth_data | R Documentation |
contruct_smooth_data creates the design matrix according to the spline function defined in sm_df. The spline design matrix is created using smoothCon from the pacakge mgcv.
construct_smooth_data(sm_df, dat)
sm_df |
a data frame that has three columns, Func, Var, Args (case sensitive). See example |
dat |
the raw data set |
a list contains
datathe contructed design matrix, the intercept and outcome is not included
Smooth
raw_dat <- sim_Bai(100, 5)$dat %>% data.frame
sm_df <- data.frame(
Var = setdiff(names(raw_dat), "y"),
Func = "s",
Args ="bs='cr', k=5"
)
construct_smooth_data(sm_df, raw_dat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.