mbco | R Documentation |
This function computes asymptotic MBCO chi-squared test for a smooth function of model parameters including a function of indirect effects.
mbco(
h0 = NULL,
h1 = NULL,
R = 10L,
type = "asymp",
alpha = 0.05,
checkHess = "No",
checkSE = "No",
optim = "SLSQP",
precision = 1e-09
)
h0 |
An |
h1 |
An |
R |
The number of bootstrap draws. |
type |
If 'asymp' (default), the asymptotic MBCO chi-squares test comparing fit of h0 and h1. If 'parametric', the parametric bootstrap MBCO chi-squared test is computed. If 'semi', the semi-parametric MBCO chi-squared is computed. |
alpha |
Significance level with the default value of .05 |
checkHess |
If 'No' (default), the Hessian matrix would not be calculated. |
checkSE |
if 'No' (default), the standard errors would not be calculated. |
optim |
Choose optimizer available in OpenMx. The default optimizer is "SLSQP". Other optimizer choices are available. See mxOption for more details. |
precision |
Functional precision. The default value is set to 1e-9. See mxOption for more details. |
A list that contains
chisq |
asymptotic chi-squared test statistic value |
df |
chi-squared df |
p |
chi-squared p-value computed based on the method specified by the argument |
Davood Tofighi dtofighi@gmail.com
Tofighi, D., & Kelley, K. (2020). Indirect effects in sequential mediation models: Evaluating methods for hypothesis testing and confidence interval formation. Multivariate Behavioral Research, 55, 188–210. \Sexpr[results=rd]{tools:::Rd_expr_doi("https://doi.org/10.1080/00273171.2019.1618545")}
Tofighi, D. (2020). Bootstrap Model-Based Constrained Optimization Tests of Indirect Effects. Frontiers in Psychology, 10, 2989. \Sexpr[results=rd]{tools:::Rd_expr_doi("https://doi.org/10.3389/fpsyg.2019.02989")}
library(OpenMx)
data(memory_exp)
memory_exp$x <- as.numeric(memory_exp$x) - 1 # manually creating dummy codes
endVar <- c("x", "repetition", "imagery", "recall")
manifests <- c("x", "repetition", "imagery", "recall")
full_model <- mxModel(
"memory_example",
type = "RAM",
manifestVars = manifests,
mxPath(
from = "x",
to = endVar,
arrows = 1,
free = TRUE,
values = .2,
labels = c("a1", "a2", "cp")
),
mxPath(
from = "repetition",
to = "recall",
arrows = 1,
free = TRUE,
values = .2,
labels = "b1"
),
mxPath(
from = "imagery",
to = "recall",
arrows = 1,
free = TRUE,
values = .2,
labels = "b2"
),
mxPath(
from = manifests,
arrows = 2,
free = TRUE,
values = .8
),
mxPath(
from = "one",
to = endVar,
arrows = 1,
free = TRUE,
values = .1
),
mxAlgebra(a1 * b1, name = "ind1"),
mxAlgebra(a2 * b2, name = "ind2"),
mxCI("ind1", type = "both"),
mxCI("ind2", type = "both"),
mxData(observed = memory_exp, type = "raw")
)
## Reduced Model for indirect effect: a1*b1
null_model1 <- mxModel(
model = full_model,
name = "Null Model 1",
mxConstraint(ind1 == 0, name = "ind1_eq0_constr")
)
full_model <- mxTryHard(full_model, checkHess = FALSE, silent = TRUE)
null_model1 <- mxTryHard(null_model1, checkHess = FALSE, silent = TRUE)
mbco(null_model1, full_model)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.