e.interaction.plot: Plot interaction effect of two exposures from PLSIM

View source: R/e.interaction.plot.R

e.interaction.plotR Documentation

Plot interaction effect of two exposures from PLSIM

Description

Plot interaction effect of two exposures from PLSIM

Usage

e.interaction.plot(
  fit,
  data,
  exp_1,
  exp_2,
  type = c("linear", "logistic", "log")
)

Arguments

fit

Fitted model from plsi.lr.auto(), plsi.logistic.auto(), or plsi.log.auto()

data

Original data set

exp_1

Exposure 1 name

exp_2

Exposure 2 name

type

Which outcome scale to plot. "linear" (default) plots the predicted (continuous) outcome, for a fit from plsi.lr.auto(). "logistic" plots the predicted probability, for a fit from plsi.logistic.auto(). "log" plots the predicted count, for a fit from plsi.log.auto().

Value

Plot of interaction effect of two exposures with others at average level. Invisibly returns a list with elements panel_1 and panel_2, the data frames underlying the left and right panels respectively (predicted values at each combination of exp_1/ exp_2 value and the other exposure's quantiles).

Author(s)

Yuyan Wang

Examples

## Not run: 
# example to plot interaction effect of two exposures of continuous outcome
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)

# plot two exposures' interaction effect of predicted (continuous) outcome
e.interaction.plot(model_lr_auto, data, "X4_a.tocopherol", "X3_g.tocopherol", type = "linear")
e.interaction.plot(model_lr_auto, data, "X4_a.tocopherol", "X10_2.3.4.6.7.8.hxcdf", type = "linear")

# exchange exposures' names
e.interaction.plot(model_lr_auto, data, "X8_3.3.4.4.5.pncb", "X6_PCB156", type = "linear")
e.interaction.plot(model_lr_auto, data, "X6_PCB156", "X8_3.3.4.4.5.pncb", type = "linear")

## End(Not run)

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