power_lm: Conduct a priori power analysis, and plan the sample size for...

View source: R/power_lm.R

power_lmR Documentation

Conduct a priori power analysis, and plan the sample size for regression analysis

Description

Conduct a priori power analysis, and plan the sample size for regression analysis

Usage

power_lm(
  PRE = 0.02,
  PC = 1L,
  PA = 2L,
  sig_level = 0.05,
  power = 0.8,
  n_ul = 1450000000L
)

Arguments

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 PC would be converted to be an integer using as.integer().

PA

Number of parameters of model A (augmented model) with focal predictors of interest. Non-integer PA would be converted to be an integer using as.integer(). as.integer(PA) should be larger than as.integer(PC).

sig_level

Expected significance level for effects of focal predictors.

power

Expected statistical power for effects of focal predictors.

n_ul

The upper limit of the sample size below which the minimum required sample size is searched for. Non-integer n_ul would be converted to be an integer using as.integer(). as.integer(n_ul) should be at least as.integer(PA) + 1.

Details

n_ul determines the upper limit of the interval below which power_lm() searches for the minimum required sample size, hence the number of rows of the returned power table priori and the right limit of the horizontal axis of the returned power plot. 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 searching, you could set n_ul to be a value less than 1.45e+09 (e.g., 10000).

Value

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]]⁠ n_ul, the upper limit of sample size; ⁠[[8]]⁠ root, the exact decimal n found by internal uniroot() to reach the expected power; ⁠[[9]]⁠ minimum, the minimum sample size required for focal predictors to reach the expected statistical power and significance level; ⁠[[10]]⁠ priori, a priori power table with increasing sample sizes (n_i), 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).

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.

References

Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). Routledge.

Examples

power_lm()
print(power_lm())
plot(power_lm())

Keng documentation built on Sept. 1, 2026, 5:07 p.m.