Knock Errors Off Nice Guesses

Miscellaneous functions and data used in psychological research and teaching. Keng currently has four built-in datasets, and could (1) scale a vector; (2) divide a vector into three groups, (3) compute the cut-off values of Pearson's r with known sample size; (4) test the significance and compute the post-hoc power for Pearson's r with known sample size; (5) conduct a priori power analysis and plan the sample size for Pearson's r; (6) compare lm()'s fitted outputs using R-squared, f_squared, post-hoc power, and PRE (Proportional Reduction in Error, also called partial R-squared or partial Eta-squared); (7) calculate PRE from partial correlation, Cohen's f, or f_squared; (8) conduct a priori power analysis and plan the sample size for one or a set of predictors in regression analysis; (9) conduct post-hoc power analysis for one or a set of predictors in regression analysis with known sample size; (10) randomly pick numbers for Chinese Super Lotto and Double Color Balls; (11) assess course objective achievement in Outcome-Based Education.


Keng Keng

CRANstatus

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.

Installation

You can install the development version of Keng from GitHub with:

# install pak if it is not installed
if (!requireNamespace("pak", quietly = TRUE)) {
  install.packages("pak")
}

# install the developing version of Keng from GitHub
pak::pak("qyaozh/Keng")

Load

Before using the Keng package, load it using the library() function.

library(Keng)

List of contents

Here is a list of the data and functions gathered in the Keng package. Their usages are detailed in the documentation.

Data

Four data sets (i.e., depress, depress1, depress2, depress3) from the D (depression) research.

Four data sets (i.e., well, well1, well2, well3) from the W (well-being) research.

Variable transformation

Scale() could standardize the mean and standard deviation of x (including transforming it to its z-score). To change the origin of x, just change its mean.

divide() could divide a vector into three groups, using the criterion of 1 SD, or proportions like 0.27.

Pearson’s r

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.

powered_r() conducts post-hoc power analysis with known sample size n.

power_r() conducts a priori power analysis and plan the sample size for r.

The linear model

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.

powered_lm() conducts post-hoc power analysis with known sample size n.

power_lm() conducts a priori power analysis and plans the sample size for one or a set of predictors in regression analysis.

The Keng_power class

power_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.

pick_* tools

pick_sl() and pick_dcb() have been added to randomly pick numbers for Chinese Super Lotto and Double Color Balls.

Assess OBE-based course objective achievement

assess_coa() calculates course objective achievement based on students’ grades per session, weights of each session, and weights of course objectives within each session.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("Keng")

2026.9.0 by Qingyao Zhang, a month ago


https://github.com/qyaozh/Keng


Report a bug at https://github.com/qyaozh/Keng/issues


Browse source code at https://github.com/cran/Keng


Authors: Qingyao Zhang [aut, cre] (ORCID:


Documentation:   PDF Manual  


CC BY 4.0 license


Imports stats

Suggests ggplot2, knitr, rmarkdown, car, effectsize, tidyr, testthat


See at CRAN