power_lm | R Documentation |
Conduct post-hoc and prior power analysis, and plan the sample size for regression analysis
power_lm(
PRE = 0.02,
PC = 1,
PA = 2,
sig_level = 0.05,
power = 0.8,
power_ul = 1,
n_ul = 1.45e+09,
n = NULL
)
PRE |
Proportional Reduction in Error. PRE = The square of partial correlation. Cohen (1988) suggested >=0.02, >=0.13, and >=0.26 as cut-off values of PRE for small, medium, and large effect sizes, respectively. |
PC |
Number of parameters of model C (compact model) without focal predictors of interest.
Non-integer |
PA |
Number of parameters of model A (augmented model) with focal predictors of interest.
Non-integer |
sig_level |
Expected significance level for effects of focal predictors. |
power |
Expected statistical power for effects of focal predictors. |
power_ul |
The upper limit of power below which the minimum sample size is searched.
|
n_ul |
The upper limit of sample size below which the minimum required sample size is searched.
Non-integer |
n |
The current sample size. Non-integer |
power_ul
and n_ul
determine the total times of power_lm()'s attempts searching for the minimum required sample size,
hence the number of rows of the returned power table prior
and the right limit of the horizontal axis of the returned power plot.
power_lm()
will keep running and gradually raise the sample size to n_ul
until the sample size pushes the power level to power_ul
.
When PRE is very small (e.g., less than 0.001) and power is larger than 0.8,
a huge increase in sample size only brings about a trivial increase in power, which is cost-ineffective.
To make power_lm()
omit unnecessary attempts, you could set power_ul
to be a value less than 1 (e.g., 0.90),
and/or set n_ul
to be a value less than 1.45e+09 (e.g., 10000).
A Keng_power class, also a list. If sample size n
is not given, the following results would be returned:
[[1]]
PRE
;
[[2]]
f_squared
, Cohen's f_squared derived from PRE;
[[3]]
PC
;
[[4]]
PA
;
[[5]]
sig_level
, expected significance level for effects of focal predictors;
[[6]]
power
, expected statistical power for effects of focal predictors;
[[7]]
power_ul
, the upper limit of power;
[[8]]
n_ul
, the upper limit of sample size;
[[9]]
minimum
, the minimum sample size n_i
required for focal predictors to reach the
expected statistical power and significance level, and corresponding
df_A_C
(the df of the numerator of the F-test, i.e., the difference of the dfs between model C and model A),
df_A_i
(the df of the denominator of the F-test, i.e., the df of the model A at the sample size n_i
),
F_i
(the F-test of PRE
at the sample size n_i
),
p_i
(the p-value of F_i
),
lambda_i
(the non-centrality parameter of the F-distribution for the alternative hypothesis, given PRE
and n_i
),
power_i
(the actual power of PRE
at the sample size n_i
);
[[10]]
prior
, a prior power table with increasing sample sizes (n_i
) and power(power_i
).
If sample size n
is given, the following results would also be returned:
Integer n
, the F_test of PRE
at the sample size n
with
df_A_C
,
df_A
(the df of the model A at the sample size n
),
F
(the F-test of PRE
at the sample size n
),
p
(the p-value of F-test at the sample size n
), and the post-hoc power analysis with
lambda_post
(the non-centrality parameter of F
at the sample size n
),
and power_post
(the post-hoc power at the sample size n
).
By default, print()
prints the primary but not all contents of the Keng_power
class.
To inspect more contents, use print.AsIs()
or list extracting.
Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). Routledge.
power_lm()
print(power_lm())
plot(power_lm())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.