| Title: | Semi-Parametric Shape-Restricted Fixed/Mixed Effect(s) Regression Spline |
|---|---|
| Description: | Select the most suitable shape to describe the relationship between the exposure and the outcome among increasing, decreasing, convex, and concave shapes (Yin et al. (2021) <DOI:10.1007/s13571-020-00246-7>); estimate the direct and indirect effects with prior knowledge on the relationship between the mediator and the outcome with binary exposure (Yin et al. (2024) <DOI:10.1007/s13571-024-00336-w>); estimate the direct and indirect effects using linear regression-based approach (VanderWeele (2015, ISBN:9780199325870)). |
| Authors: | Qing Yin [aut, cre], Shyamal Das Peddada [aut], Jennifer Joan Adibi [aut], Jong-Hyeon Jeong [aut] |
| Maintainer: | Qing Yin <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1.1 |
| Built: | 2026-05-14 06:45:11 UTC |
| Source: | https://github.com/cran/SRMERS |
Simulated dataset for SRMERS FERS example
data(data.sim.fixed)data(data.sim.fixed)
A dataframe with 245 rows and 14 variables
continuous variable (main x)
continuous variable (confounder x)
continuous variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
continuous varible (y)
Simulated dataset for SRMERS FERSInt example
data(data.sim.fixed.int)data(data.sim.fixed.int)
A dataframe with 500 rows and 15 variables
continuous variable (mediator)
continuous variable (confounder x)
continuous variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (exposure)
continuous varible (y)
Simulated dataset for SRMERS SRSplineMed, LRMed, LRMed2 example
data(data.sim.med)data(data.sim.med)
A dataframe with 500 rows and 16 variables
continuous variable (mediator)
continuous variable (confounder x)
continuous variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (exposure)
continuous varible (y)
continuous variable (exposure)
Simulated dataset for SRMERS MERS example
data(data.sim.mixed)data(data.sim.mixed)
A dataframe with 245 rows and 15 variables
categorical variable (random factor)
continuous variable (main x)
continuous variable (confounder x)
continuous variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
binary variable (confounder x)
continuous varible (y)
P values for shapes obtained from semi-parametric shape-restricted fixed effect regression splines.
FERS( y, xMain, xConf = NULL, dataset, knotType = 2, preKnot = NULL, nBasis = 5, nIter )FERS( y, xMain, xConf = NULL, dataset, knotType = 2, preKnot = NULL, nBasis = 5, nIter )
y |
The name of the outcome. |
xMain |
The name of the main effect. |
xConf |
The name vector of the confounders. |
dataset |
A data frame. |
knotType |
The knot type: 1=equal-spaced, 2=quantile, 3=pre-specified. |
preKnot |
The pre-specified knots. |
nBasis |
The number of bases. |
nIter |
The number of iterations. |
A list of weights of beta distribution and p-values.
shape <- FERS(y = "ySim", xMain = "hormone", xConf = c("age", "invwt", "race2", "race3", "race4", "race5", "season2", "season3", "season4", "smoking1", "ovum1", "diabetes1"), dataset = data.sim.fixed, nBasis = 5, nIter = 50) shapeshape <- FERS(y = "ySim", xMain = "hormone", xConf = c("age", "invwt", "race2", "race3", "race4", "race5", "season2", "season3", "season4", "smoking1", "ovum1", "diabetes1"), dataset = data.sim.fixed, nBasis = 5, nIter = 50) shape
P values for shapes obtained from semi-parametric shape-restricted fixed effect regression splines with factor-by-curve interaction.
FERSInt( y, xExp, xMed, xConf = NULL, dataset, knotType = 2, preKnot = NULL, nBasis = 5, nIter )FERSInt( y, xExp, xMed, xConf = NULL, dataset, knotType = 2, preKnot = NULL, nBasis = 5, nIter )
y |
The name of the outcome. |
xExp |
The name of the exposure (must be a binary variable). |
xMed |
The name of the mediator (must be a continuous variable). |
xConf |
The name vector of the confounders. |
dataset |
A data frame. |
knotType |
The knot type: 1=equal-spaced, 2=quantile, 3=pre-specified. |
preKnot |
The pre-specified knots. |
nBasis |
The number of bases. |
nIter |
The number of iterations. |
A list of weights of beta distribution and p-values for both exposure groups.
This function has not been validated through simulation studies. Please use with caution. shape <- FERSInt(y = "ySim", xExp = "pesticide1", xMed = "hormone", xConf = c("pesticide1", "age", "invwt", "race2", "race3", "race4", "race5", "season2", "season3", "season4", "smoking1", "ovum1", "diabetes1"), dataset = data.sim.fixed.int, nBasis = 5, nIter = 50) shape
Calculate the CDE, NDE and NIE (linear models, binary exposure).
LRMed(data, exposure, mediator, outcome, confounderVec, mValue)LRMed(data, exposure, mediator, outcome, confounderVec, mValue)
data |
A data frame. |
exposure |
The name of the exposure (must be a binary variable). |
mediator |
The name of the mediator (must be a continuous variable). |
outcome |
The name of the outcome (must be a continuous variable). |
confounderVec |
The name vector of the confounders. |
mValue |
The controlled mediator value for CDE estimation. |
A list of exposure-outcome model, exposure-mediator model, CDE, NDE and NIE and their asymptotic variances.
medModel <- LRMed(data = data.sim.med, exposure = "pesticide1", mediator = "hormone", outcome = "ySim", confounderVec = c("age", "invwt", "race2", "race3", "race4", "race5", "season2", "season3", "season4", "smoking1", "ovum1", "diabetes1"), mValue = 0.15) medModelmedModel <- LRMed(data = data.sim.med, exposure = "pesticide1", mediator = "hormone", outcome = "ySim", confounderVec = c("age", "invwt", "race2", "race3", "race4", "race5", "season2", "season3", "season4", "smoking1", "ovum1", "diabetes1"), mValue = 0.15) medModel
Calculate the CDE, NDE and NIE (linear models, continuous exposure).
LRMed2( data, exposure, mediator, outcome, confounderVec, mValue, eValueLow, eValueHigh )LRMed2( data, exposure, mediator, outcome, confounderVec, mValue, eValueLow, eValueHigh )
data |
A data frame. |
exposure |
The name of the exposure (must be a continuous variable). |
mediator |
The name of the mediator (must be a continuous variable). |
outcome |
The name of the outcome (must be a continuous variable). |
confounderVec |
The name vector of the confounders. |
mValue |
The controlled mediator value for CDE estimation. |
eValueLow |
The low reference level of exposure. |
eValueHigh |
The high reference level of exposure. |
A list of exposure-outcome model, exposure-mediator model, CDE, NDE and NIE and their asymptotic variances.
medModel <- LRMed2(data = data.sim.med, exposure = "pesticideCont", mediator = "hormone", outcome = "ySim", confounderVec = c("age", "invwt", "race2", "race3", "race4", "race5", "season2", "season3", "season4", "smoking1", "ovum1", "diabetes1"), mValue = 0.15, eValueLow = 0.1, eValueHigh = 1.1) medModelmedModel <- LRMed2(data = data.sim.med, exposure = "pesticideCont", mediator = "hormone", outcome = "ySim", confounderVec = c("age", "invwt", "race2", "race3", "race4", "race5", "season2", "season3", "season4", "smoking1", "ovum1", "diabetes1"), mValue = 0.15, eValueLow = 0.1, eValueHigh = 1.1) medModel
P values for shapes obtained from semi-parametric shape-restricted mixed effects regression splines.
MERS( y, xMain, xConf = NULL, xRand, dataset, knotType = 2, preKnot = NULL, nBasis = 5, nIter )MERS( y, xMain, xConf = NULL, xRand, dataset, knotType = 2, preKnot = NULL, nBasis = 5, nIter )
y |
The name of the outcome. |
xMain |
The name of the main effect. |
xConf |
The name vector of the confounders. |
xRand |
The name of the random effect. |
dataset |
A data frame. |
knotType |
The knot type: 1=equal-spaced, 2=quantile, 3=pre-specified. |
preKnot |
The pre-specified knots. |
nBasis |
The number of bases. |
nIter |
The number of iterations. |
A list of weights of beta distribution and p-values.
shape <- MERS(y = "ySim", xMain = "hormone", xConf = c("age", "invwt", "race2", "race3", "race4", "race5", "season2", "season3", "season4", "smoking1", "ovum1", "diabetes1"), xRand = "cluster", dataset = data.sim.mixed, nBasis = 5, nIter = 50) shapeshape <- MERS(y = "ySim", xMain = "hormone", xConf = c("age", "invwt", "race2", "race3", "race4", "race5", "season2", "season3", "season4", "smoking1", "ovum1", "diabetes1"), xRand = "cluster", dataset = data.sim.mixed, nBasis = 5, nIter = 50) shape
Calculate the CDE, NDE and NIE.
SRSplineMed( data, nBasis, exposure, mediator, outcome, confounderVec, shapeExp, shapeNonExp, mValue, varAsymp = FALSE )SRSplineMed( data, nBasis, exposure, mediator, outcome, confounderVec, shapeExp, shapeNonExp, mValue, varAsymp = FALSE )
data |
A data frame. |
nBasis |
The number of bases. |
exposure |
The name of the exposure (must be a binary variable). |
mediator |
The name of the mediator (must be a continuous variable). |
outcome |
The name of the outcome (must be a continuous variable). |
confounderVec |
The name vector of the confounders. |
shapeExp |
The shape of mediator in exposure group ("increasing", "decreasing", "convex", or "concave"). |
shapeNonExp |
The shape of mediator in non-exposure group ("increasing", "decreasing", "convex", or "concave"). |
mValue |
The controlled mediator value for CDE estimation. |
varAsymp |
Whether to output the asymptotic variance (T/F) |
A list of exposure-outcome model, exposure-mediator model, knot sequence, coefficient vector of exposure spline, coefficient vector of non-exposure spline, residuals, sds and coefficients, CDE, NDE and NIE and their asymptotic variances.
medModel <- SRSplineMed(data = data.sim.med, nBasis = 5, exposure = "pesticide1", mediator = "hormone", outcome = "ySim", confounderVec = c("age", "invwt", "race2", "race3", "race4", "race5", "season2", "season3", "season4", "smoking1", "ovum1", "diabetes1"), shapeExp = "concave", shapeNonExp = "increasing", mValue = 0.15, varAsymp = TRUE) medModelmedModel <- SRSplineMed(data = data.sim.med, nBasis = 5, exposure = "pesticide1", mediator = "hormone", outcome = "ySim", confounderVec = c("age", "invwt", "race2", "race3", "race4", "race5", "season2", "season3", "season4", "smoking1", "ovum1", "diabetes1"), shapeExp = "concave", shapeNonExp = "increasing", mValue = 0.15, varAsymp = TRUE) medModel