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

## ----setup--------------------------------------------------------------------
library(intraclass)

## ----data---------------------------------------------------------------------
head(ratings)

## ----fit----------------------------------------------------------------------
fit <- icc(ratings, score, subject, rater, seed = 2024)
fit

## ----values, include = FALSE--------------------------------------------------
td <- tidy(fit)
a1 <- td$estimate[td$term == "ICC(A,1)"] # single rater
ak <- td$estimate[td$term == "ICC(A,k)"] # mean of the 4 raters
ak_lo <- td$conf.low[td$term == "ICC(A,k)"]
ak_hi <- td$conf.high[td$term == "ICC(A,k)"]
cons1 <- with(tidy(icc(ratings, score, subject, rater,
  type = "consistency", seed = 2024)), estimate[term == "ICC(C,1)"])
fmt <- function(x) sprintf("%.2f", x)

## ----tidy---------------------------------------------------------------------
tidy(fit)

glance(fit)

## ----summary------------------------------------------------------------------
summary(fit)

## ----consistency--------------------------------------------------------------
icc(ratings, score, subject, rater, type = "consistency", seed = 2024)

