The Keng
package is named after Loo-Keng Hua, who made
great achievements in mathematics mainly through self-study. Loo-Keng
Hua encouraged novices to show their axe skills at the gate of Ban’s
house, so the Keng
package comes. In addition,
Keng
is the abbreviation of “Knock Errors off Nice
Guesses.” Hope the functions and data gathered in the Keng
package help to ease your life.
You can install the development version of Keng
from GitHub with:
install.packages("devtools")
::install_github("qyaozh/Keng", dependencies = TRUE, build_vignettes = TRUE) devtools
Before using the Keng
package, load it using the
library()
function.
library(Keng)
Here is a list of the data and functions gathered in the
Keng
package. Their usages are detailed in the
documentation.
depress
is a subset of data from a research about
depression and coping.
Scale()
could change the origin of a numeric vector
x
(including mean-centering it), or standardize the mean
and standard deviation of x
(including transforming it to
its z-score).
cut_r()
gives you the cut-off values of Pearson’s r at
the significance levels of p = 0.1, 0.05, 0.01, and 0.001 with known
sample size n.
test_r()
tests the significance and compute the post-hoc
power of r with known sample size n.
power_r()
conducts prior power analysis and plan the
sample size for r; post-hoc power analysis would also be conducted with
known sample size n.
compare_lm()
compares lm()
’s fitted outputs
using PRE, R2, f2, and post-hoc power.
calc_PRE()
calculates PRE from partial correlation,
Cohen’s f, or f_squared.
power_lm()
conducts prior power analysis and plans the
sample size for one or a set of predictors in regression analysis;
post-hoc power analysis would also be conducted with known sample size
n.
Keng_power
classpower_r()
and power_lm()
return the
Keng_power
class, which has print()
and
plot()
methods.
print()
prints primary but not all contents of the
Keng_power
class.
plot()
plots the power against sample size for the
Keng_power
class.