plsi.lr.auto: Partial linear single index regression with automatic...

View source: R/plsi.lr.auto.R

plsi.lr.autoR Documentation

Partial linear single index regression with automatic smoothness selection

Description

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.

Usage

plsi.lr.auto(
  data,
  Y.name,
  X.name,
  Z.name,
  k = 10,
  bs = "cr",
  initial.random.num = 5,
  seed = 2026
)

Arguments

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 spline.num in plsi.lr.v2, but not a fixed df, REML penalizes down from this ceiling). Default 10.

bs

Smooth basis type passed to mgcv::s(); default "cr" (cubic regression spline).

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.

Value

A list of model estimation and prediction results, structured analogously to plsi.lr.v2()'s output.

Author(s)

Yuyan Wang

Examples

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

EPLSIM documentation built on Nov. 5, 2026, 1:08 a.m.