construct_smooth_data: Creating design matrix based on spline configuration

View source: R/helper-functions.R

construct_smooth_dataR Documentation

Creating design matrix based on spline configuration

Description

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.

Usage

construct_smooth_data(sm_df, dat)

Arguments

sm_df

a data frame that has three columns, Func, Var, Args (case sensitive). See example

dat

the raw data set

Details

[Experimental]

Value

a list contains

  • datathe contructed design matrix, the intercept and outcome is not included

  • Smooth

Examples


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)



boyiguo1/BHAM documentation built on Jan. 29, 2024, 10:37 a.m.