Create grouping for spline design matrix [Experimental]

make_group(.names, penalize_null = TRUE, shared_null = TRUE)

Arguments

.names

spline matrix names, always in the format "var_name.baseX". Directly from Construct_Smooth_Data #param null_group A indicator if the null space are in its own group, i.e. if null space are penalized

penalize_null

do we penalize the null space, i.e. do we fit the null space into group parameter in bglm group parameter.

shared_null

A indicator if the null space have a shared indicator with the penalized space

Value

A vector of lists, where each element list contains variables that belong to the same group

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"
)

dsn_mat <- construct_smooth_data(sm_df, raw_dat)$data

make_group(names(dsn_mat))
#> [[1]]
#> [1] "x1.pen1"  "x1.pen2"  "x1.pen3"  "x1.null1"
#> 
#> [[2]]
#> [1] "x2.pen1"  "x2.pen2"  "x2.pen3"  "x2.null1"
#> 
#> [[3]]
#> [1] "x3.pen1"  "x3.pen2"  "x3.pen3"  "x3.null1"
#> 
#> [[4]]
#> [1] "x4.pen1"  "x4.pen2"  "x4.pen3"  "x4.null1"
#> 
#> [[5]]
#> [1] "x5.pen1"  "x5.pen2"  "x5.pen3"  "x5.null1"
#>