## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----setup--------------------------------------------------------------------
library(contentValidity)

## -----------------------------------------------------------------------------
data(cvi_example)
head(cvi_example)

## -----------------------------------------------------------------------------
icvi(cvi_example)

## -----------------------------------------------------------------------------
mod_kappa(cvi_example)

## -----------------------------------------------------------------------------
aiken_v(cvi_example, lo = 1, hi = 4)

## -----------------------------------------------------------------------------
scvi_ave(cvi_example)   # average of I-CVIs
scvi_ua(cvi_example)    # proportion of items with universal agreement

## -----------------------------------------------------------------------------
result <- content_validity(cvi_example)
result

## -----------------------------------------------------------------------------
result$items
result$scale

## -----------------------------------------------------------------------------
apa_table(result)

## ----results = "asis"---------------------------------------------------------
apa_table(result, format = "markdown")

## -----------------------------------------------------------------------------
# 10 experts rating 3 items on Lawshe's scale
lawshe_ratings <- matrix(
  c(1, 1, 1, 1, 1, 1, 1, 1, 2, 2,    # 8 of 10 essential
    1, 1, 1, 2, 2, 2, 2, 3, 3, 3,    # 3 of 10 essential
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1),   # 10 of 10 essential
  nrow = 10,
  dimnames = list(NULL, paste0("item", 1:3))
)

cvr(lawshe_ratings)

## -----------------------------------------------------------------------------
cvr_critical(n_experts = 10)        # one-tailed alpha = 0.05
cvr_critical(n_experts = 10, alpha = 0.01)

## ----eval = FALSE-------------------------------------------------------------
# citation("contentValidity")

