| plsi.lr.auto | R Documentation |
Same model as plsi.lr.v2(), but the link function is estimated with a
penalized regression spline (mgcv::gam, REML smoothing-parameter
selection) instead of a fixed-df natural spline. This removes the need to
hand-tune spline.num: you supply an upper bound on basis complexity
(k), and REML shrinks unneeded wiggliness toward a straight line
automatically. Effective degrees of freedom actually used by the fitted
link function are reported in si.fun.edf.
plsi.lr.auto(
data,
Y.name,
X.name,
Z.name,
k = 10,
bs = "cr",
initial.random.num = 5,
seed = 2026
)
data |
A data set including all needed variables |
Y.name |
Variable name for scalar outcome |
X.name |
Variable name vector for exposures |
Z.name |
Variable name vector for confounders |
k |
Upper bound on basis dimension for the smooth link function
(analogous to |
bs |
Smooth basis type passed to |
initial.random.num |
Number of random initials for the single-index direction search |
seed |
A single integer used to seed the RNG so results (random initials and downstream optim() convergence) are reproducible. Set to NULL to skip seeding and use whatever RNG state is already active in the calling environment. Default is 2026. |
A list of model estimation and prediction results, structured
analogously to plsi.lr.v2()'s output.
Yuyan Wang
## Not run:
# example to run plsi.lr.auto
data(nhanes.new)
data <- nhanes.new
Y.name <- "log.triglyceride"
X.name <- c("X1_trans.b.carotene", "X2_retinol", "X3_g.tocopherol", "X4_a.tocopherol",
"X5_PCB99", "X6_PCB156", "X7_PCB206",
"X8_3.3.4.4.5.pncb", "X9_1.2.3.4.7.8.hxcdf", "X10_2.3.4.6.7.8.hxcdf")
Z.name <- c("AGE.c", "SEX.Female", "RACE.NH.Black",
"RACE.MexicanAmerican", "RACE.OtherRace", "RACE.Hispanic" )
k <- 10
bs <- "cr"
initial.random.num <- 1
seed = 2026
model_lr_auto <- plsi.lr.auto(data = data, Y.name = Y.name, X.name = X.name, Z.name = Z.name,
k = k, bs = bs, initial.random.num = initial.random.num, seed = seed)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.