Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plotPower

Make a power plot of a parameter given varying parameters


Description

Make a power plot of a parameter given varying parameters (e.g., sample size, percent missing completely at random, or random parameters in the model)

Usage

plotPower(object, powerParam, alpha = 0.05, contParam = NULL, contN = TRUE, 
	contMCAR = TRUE, contMAR = TRUE, useContour=TRUE)

Arguments

object

SimResult that includes at least one randomly varying parameter (e.g. sample size, percent missing, model parameters)

powerParam

Vector of parameters names that the user wishes to find power for. This can be a vector of names (e.g., "f1=~y2", "f1~~f2").

alpha

Alpha level to use for power analysis.

contParam

Vector of parameters names that vary over replications that users wish to use in the plot.

contN

Include the varying sample size in the power plot if available

contMCAR

Include the varying MCAR (missing completely at random percentage) in the power plot if available

contMAR

Include the varying MAR (missing at random percentage) in the power plot if available

useContour

This argument is used when users specify to plot two varying parameters. If TRUE, the contour plot is used. If FALSE, perspective plot is used.

Details

Predicting whether each replication is significant or not by varying parameters using logistic regression (without interaction). Then, plot the logistic curves predicting the probability of significance against the target varying parameters.

Value

Not return any value. This function will plot a graph only.

Author(s)

Sunthud Pornprasertmanit (psunthud@gmail.com), Alexander M. Schoemann (East Carolina University; schoemanna@ecu.edu)

See Also

  • SimResult to see how to create a simResult object with randomly varying parameters.

  • getPower to obtain a statistical power given varying parameters values.

Examples

## Not run: 
loading <- matrix(0, 6, 1)
loading[1:6, 1] <- NA
LY <- bind(loading, 0.4)
RPS <- binds(diag(1))
RTE <- binds(diag(6))
CFA.Model <- model(LY = LY, RPS = RPS, RTE = RTE, modelType="CFA")

# Specify both continuous sample size and percent missing completely at random. 
# Note that more fine-grained values of n and pmMCAR is needed, e.g., n=seq(50, 500, 1) 
# and pmMCAR=seq(0, 0.2, 0.01)

Output <- sim(NULL, n=seq(100, 200, 20), pmMCAR=c(0, 0.1, 0.2), model=CFA.Model)

# Plot the power of the first factor loading along the sample size value
plotPower(Output, "f1=~y1", contMCAR=FALSE)

# Plot the power of the correlation along the sample size and percent missing completely at random
plotPower(Output, "f1=~y1")

## End(Not run)

simsem

SIMulated Structural Equation Modeling

v0.5-16
GPL (>= 2)
Authors
Sunthud Pornprasertmanit [aut], Patrick Miller [aut], Alexander Schoemann [aut] (<https://orcid.org/0000-0002-8479-8798>), Terrence D. Jorgensen [aut, cre] (<https://orcid.org/0000-0001-5111-6773>), Corbin Quick [ctb]
Initial release
2021-03-28

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.