This function calculates the statistical power of SEM models based on simulation results, providing a detailed summary including the convergence rate of simulations.
Arguments
- data
A dataframe containing the results of SEM simulations, typically produced by a function like
simulate_power
. It should include parameters estimates, p-values, and confidence intervals.- target
A vector of strings specifying which parameters (paths) to analyze for power. These should match entries in the 'Parameter' column of the
data
.
Value
A dataframe summarizing the power analysis results for specified paths. Each row corresponds to a path with the following columns:
ValueMean estimate of the path coefficient across simulations.
MedianMedian estimate of the path coefficient.
PowerProportion of simulations where the path was statistically significant (p < 0.05), excluding NA values.
Power (All Cases)
Proportion of simulations where the path was significant, treating NAs as non-significant.CI_lowerAverage lower bound of the confidence interval for the path estimate.
CI_upperAverage upper bound of the confidence interval for the path estimate.
Examples
# Assume 'sim_results' is a dataframe from simulate_power()
target_paths <- c("M ~ X", "Y ~ M")
power_summary <- extract_power(sim_results, target_paths)
#> Error in eval(expr, envir, enclos): object 'sim_results' not found