power_analysis {psycho} | R Documentation |
Power analysis for fitted models.
Description
Compute the n models based on n sampling of data.
Usage
power_analysis(
fit,
n_max,
n_min = NULL,
step = 1,
n_batch = 1,
groups = NULL,
verbose = TRUE,
CI = 90
)
Arguments
fit |
A lm or stanreg model. |
n_max |
Max sample size. |
n_min |
Min sample size. If null, take current nrow. |
step |
Increment of the sequence. |
n_batch |
Number of iterations at each sample size. |
groups |
Grouping variable name (string) to preserve proportions. Can be a list of strings. |
verbose |
Print progress. |
CI |
Confidence level. |
Value
A dataframe containing the summary of all models for all iterations.
Author(s)
Examples
## Not run:
library(dplyr)
library(psycho)
fit <- lm(Sepal.Length ~ Sepal.Width, data = iris)
results <- power_analysis(fit, n_max = 300, n_min = 100, step = 5, n_batch = 20)
results %>%
filter(Variable == "Sepal.Width") %>%
select(n, p) %>%
group_by(n) %>%
summarise(
p_median = median(p),
p_mad = mad(p)
)
## End(Not run)
[Package psycho version 0.6.1 Index]