View source: R/plot.powerNLSEM.R
plot.powerNLSEM | R Documentation |
plot powerNLSEM object
## S3 method for class 'powerNLSEM'
plot(
x,
test = NULL,
plot = "power_model",
power_modeling_method = NULL,
se = FALSE,
power_aim = NULL,
alpha = NULL,
alpha_power_modeling = NULL,
min_num_bins = 10,
defaultgg = FALSE,
...
)
x |
object of class powerNLSEM |
test |
Should the parameter be tested with a directed hypothesis (onesided) or with an undirected hypothesis (twosided, also equivalent to Wald-Test for single parameter). Default to |
plot |
Character indicating what type of plot to create. Default to |
power_modeling_method |
Character indicating the power modeling method used. This is only relevant when |
se |
Logical indicating to use confidence intervals based on normal approximation using the standard errors. Default to |
power_aim |
Power level to be included into the plot with respective N. If |
alpha |
Alpha value used for confidence intervals, when |
alpha_power_modeling |
Type I-error rate for confidence band around predicted power rate. Used to ensure that the computed |
min_num_bins |
minimal number of bins used for aggregating results. Default to 10. |
defaultgg |
Logical to return default ggplot object. Default to |
... |
Additional arguments passed on to the plot function. |
Returns ggplot
object of the type specified in plot.
# write model in lavaan syntax
model <- "
# measurement models
X =~ 1*x1 + 0.8*x2 + 0.7*x3
Y =~ 1*y1 + 0.85*y2 + 0.78*y3
Z =~ 1*z1 + 0.9*z2 + 0.6*z3
# structural models
Y ~ 0.3*X + .2*Z + .2*X:Z
# residual variances
Y~~.7975*Y
X~~1*X
Z~~1*Z
# covariances
X~~0.5*Z
# measurement error variances
x1~~.1*x1
x2~~.2*x2
x3~~.3*x3
z1~~.2*z1
z2~~.3*z2
z3~~.4*z3
y1~~.5*y1
y2~~.4*y2
y3~~.3*y3
"
# run model-implied simulation-based power estimation
# for the effects: c("Y~X", "Y~Z", "Y~X:Z")
Result_Power <- powerNLSEM(model = model, POI = c("Y~X", "Y~Z", "Y~X:Z"),
method = "UPI", search_method = "adaptive",
steps = 10, power_modeling_method = "probit",
R = 1000, power_aim = .8, alpha = .05,
alpha_power_modeling = .05,
CORES = 1, seed = 2024)
Result_Power
plot(Result_Power)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.