gstudy | R Documentation |
Functions for running generalizability (G) and decision (D) studies for estimating reliability in multi-faceted designs.
gstudy(x, ...)
## Default S3 method:
gstudy(x, data = NULL, ...)
## S3 method for class 'formula'
gstudy(x, data = NULL, id = "person", ...)
## S3 method for class 'data.frame'
gstudy(x, random = TRUE, column_label = "rater", id = "person", ...)
## S3 method for class 'merMod'
gstudy(x, n, id = "person", ...)
x |
for the default method, a |
... |
further arguments passed to or from other methods. |
data |
a data frame containing the variables named in formula. Required when x is not a data frame. |
id |
character string naming the id variable for the unit of observation,
defaulting to |
random |
logical indicating whether the facet given in columns when
|
column_label |
string for labeling the column facet when |
n |
vector of counts used in adjusting the g coefficient. Not currently used. |
Returns a list containing the original call, model formula, reliabilities, variance components, and n counts by facet.
gstudy(default)
: Method defaults to formula interface.
gstudy(formula)
: Method for formula objects.
gstudy(data.frame)
: Method for wide data frames with people as rows and a
single facet as columns
gstudy(merMod)
: Method for objects of class merMod
.
# Reading items
ritems <- c("r414q02", "r414q11", "r414q06", "r414q09",
"r452q03", "r452q04", "r452q06", "r452q07", "r458q01",
"r458q07", "r458q04")
rsitems <- paste0(ritems, "s")
# Subset of PISA09 data for Belgium
pisa <- subset(PISA09, cnt == "BEL")[, rsitems]
# Convert to long format
np <- nrow(pisa)
ni <- ncol(pisa)
pisal <- data.frame(person = factor(rep(1:np, ni)),
item = rep(rsitems, each = np),
score = unlist(pisa), row.names = 1:(np * ni))
# Compare coefficient alpha using rstudy and gstudy
rout <- rstudy(pisa, use = "complete.obs")
gout <- gstudy(pisa, column_label = "item")
rout$alpha
gout$g
# Alternatively, find g using long data and formula method
# Results differ slightly because missing data are excluded with the
# data frame method but included by default with the formula method
goutl <- gstudy(score ~ (1 | person) + (1 | item), data = pisal)
goutl$g
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.