utils function

Utility functions

Utility functions

rmse computes the root mean squared error (RMSE) of two numeric vectors/matrices

freq computes the frequency counts of a numeric or character vector

cronbach_alpha computes the Cronbach's alpha internal consistency reliability index

spearman_brown predicts the reliability when the current test is extended to n times longer

spearman_brown_reverse computes how many times the current test length needs to be extended in order to reach targeted reliability

quadratic kappa computes the quadratic weighted kappa of two numeric vectors

rmse(x1, x2) freq(x, vals = NULL, decimal = NULL) cronbach_alpha(u) spearman_brown(rho, n_len) spearman_brown_reverse(rho, target_rho) quadratic_kappa(x1, x2)

Arguments

  • x1: a numeric vector or matrix
  • x2: a numeric vector or matrix
  • x: a numeric or character vector
  • vals: valid values, NULL to include all values
  • decimal: round results to n-th decimal places
  • u: oberved responses, 2d matrix
  • rho: the reliability of the current test
  • n_len: extend the test to n times longer
  • target_rho: the targeted reliability

Returns

freq returns the frequency counts and percentages in a data.frame

Examples

rmse(rnorm(10), rnorm(10)) freq(round(runif(100, 1, 5))) cronbach_alpha(model_3pl_gendata(1000, 20)$u) spearman_brown(.70, 2) spearman_brown_reverse(.70, .85) quadratic_kappa(round(runif(100, 1, 5)), round(runif(100, 1, 5)))
  • Maintainer: Xiao Luo
  • License: GPL (>= 3)
  • Last published: 2019-10-23