cond_cov | R Documentation |
This function modifies the mediator and outcome model and the dataset according
to the conditions of certain covariates specified by the user.
The conditions are constructed by the character parameter cov_val
with multiple string elements.
This function then modifies the data and models based on rules of conditional regressions.
The amount of sample and model structure are changed correspondingly. The samples and model variables satisfy the conditions
are finally remain. Therefore, This function is only involved when moderated mediation effects are considered in the analysis.
This is an internal function, automatically called by the function FormalEstmed
.
cond_cov (m_model, y_model, data, X, M, cov_val)
m_model |
a fitted model object for the mediator. |
y_model |
a fitted model object for the outcome. |
data |
a dataframe used in the analysis. |
X |
a character variable of the exposure's name. |
M |
a character variable of the mediator's name. |
cov_val |
a character variable of the conditions of the covariates. Each string (element) in the character may include ==, <, >, <=, >=, etc. |
This function returns a list of three objects. A conditional dataframe, an updated mediator model and an updated outcome model.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.