varcomp: Variance components

View source: R/varcomp.R

varcompR Documentation

Variance components

Description

Variance components

Usage

varcomp(formula, data)

Arguments

formula

a two-sided linear formula object describing both the fixed-effects and random-effects part of the model, with the response on the left of a ~ operator and the terms, separated by + operators, on the right. Random-effects terms are distinguished by vertical bars (|) separating expressions for design matrices from grouping factors. Two vertical bars (||) can be used to specify multiple uncorrelated random effects for the same grouping variable. (Because of the way it is implemented, the ||-syntax works only for design matrices containing numeric (continuous) predictors; to fit models with independent categorical effects, see dummy or the lmer_alt function from the afex package.)

data

a data.frame containing the variables named in 'formula'.

Value

data.frame with the variance components in rows

Examples

library(dplyr)
pch <- breast[,c("PCH1_score", "PCH2_score","PCH3_score",
"PCH4_score","PCH5_score")] %>%
mutate(id = 1:nrow(breast))
pch_l <- tidyr::pivot_longer(pch, cols= PCH1_score:PCH5_score,
names_to = "rater", values_to = "score")
varcomp(formula = score ~ (1|id) + (1|rater),  data = pch_l)


iriseekhout/Agree documentation built on July 28, 2023, 11:24 p.m.