Skip to contents

Compute per-scale internal-consistency reliability — Cronbach's alpha and McDonald's omega — for the HiTOP Self-Report (405 items). Reliability is estimated on the reverse-keyed item responses for each of the scales that score_hitopsr() outputs and, with include_subscales = TRUE, for each of its 17 subscales (fewer under a module).

Usage

reliability_hitopsr(
  data,
  items,
  srange = c(1, 4),
  alpha = TRUE,
  omega = TRUE,
  module = NULL,
  layout = c("instrument", "printed"),
  include_subscales = FALSE,
  subset = NULL
)

Arguments

data

A data frame containing the HiTOP-SR items (numerically coded): all 405 of them, or, when module is supplied, that module's items.

items

A vector of column names (as strings) or numbers (as integers) corresponding to the HiTOP-SR items held in data — all 405, or, when module is supplied, that module's items. Items must be supplied in instrument order, or in the form's printed order under layout = "printed"; duplicated entries are an error. The ascending-name warning score_hitopsr() describes applies here too. Under layout = "printed", names whose trailing numbers equal the module's item_order are in the printed order and pass with no warning. When items is omitted or NULL, the names on the module's columns attribute are used, as in score_hitopsr(). A call with items omitted is an error if no module is supplied, if the module has no columns attribute, or under layout = "printed". A supplied items is always used, whether or not the module has the attribute. Each column must be numeric or logical, or character holding only numbers (blank cells and NA values count as missing, but the text "NA" is refused). A haven labelled column is read as its plain values. Any other column, such as the choice text of an online export or a factor, is an error of class hitop_nonnumeric_items. So is a 64-bit integer (integer64) column, and, in a UTF-8 session, a column holding text that is not valid UTF-8 (text marked Latin-1 is read as its text); convert such text with iconv(). So is an SPSS column (haven_labelled_spss) that holds a value it declares missing; turn those codes into NA with haven::zap_missing() first. A declared value that is blank is not refused, since blank cells count as missing. The SPSS class of haven before 2.0 (labelled_spss) is refused the same way, but haven::zap_missing() leaves it unchanged, so set the values its na_values or na_range attribute declares to NA first.

srange

An optional numeric vector specifying the minimum and maximum values of the HiTOP-SR items, used for reverse-coding. (default = c(1, 4))

alpha

Optional logical; if TRUE, include a column of Cronbach's alpha per scale. (default = TRUE)

omega

Optional logical; if TRUE, include a column of McDonald's omega (total) per scale, estimated via a one-factor CFA (requires the lavaan package). (default = TRUE)

module

An optional hitop_module object, as returned by hitop_module(), describing a module of the instrument. When supplied, data and items hold only that module's item columns — in ascending instrument order, as the generate_*_hitopsr() forms lay them out — and one row is returned per module scale. When NULL, all 405 items are expected and all 76 scales are estimated. A module whose items, nItems, camelCase or instrument differ from a fresh hitop_module() build of its scales, as after an edit by hand, or that cannot be rebuilt from its instrument and scales, is refused with an error of class hitop_module_mismatch. (default = NULL)

layout

The order the item columns are in. "instrument" (the default) is ascending HiTOP-SR order, as the generate_*_hitopsr() forms lay the items out. "printed" is the order a shuffled Word form printed them: column k holds the answer to the form's printed item k. It needs a module carrying an item_order attribute, the record a module descriptor written by generate_docx_hitopsr() with randomize = TRUE keeps and read_module() returns; the columns are put back into instrument order through that attribute before the estimates run. A call with layout = "printed" and no module, a module with no item_order, or an item_order that is not a permutation of the module's items is an error. (default = "instrument")

include_subscales

A logical. If TRUE, one row per subscale in hitopsr_subscales follows the scale rows, in that table's row order. A subscale row's Scale is the subscale's name (Subscale in hitopsr_subscales), and its camelCase and nItems come from the same row. With a module, only the subscales whose parent scale is in the module get a row. (default = FALSE)

subset

Deprecated. The former name of module; supplying it warns. Supplying both module and subset is an error. (default = NULL)

Value

A tibble with one row per scale (and per subscale under include_subscales = TRUE) and columns Scale (the scale's canonical display name, as the instrument's keying table spells it), camelCase (the stem that names the scale's column in the matching score_*() output, read from the same keying-table row), nItems (integer), and (when requested) alpha and omega.

Details

Alpha is computed by calc_alpha() (covariance-based, pairwise deletion) and omega by calc_omega() (one-factor lavaan CFA, FIML). A scale whose estimate cannot be computed (e.g. too few items or, for omega, a non-converging CFA or an uninstalled lavaan) is returned as NA rather than aborting the call. Omega needs at least 3 items: for a scale with fewer, no model is fitted and omega is NA.

Examples

# Per-scale alpha for the HiTOP-SR
reliability_hitopsr(sim_hitopsr, items = 1:405, omega = FALSE)
#> # A tibble: 76 × 4
#>    Scale                camelCase           nItems    alpha
#>    <chr>                <chr>                <int>    <dbl>
#>  1 Agoraphobia          agoraphobia              5 -0.108  
#>  2 Antisocial Behavior  antisocialBehavior       8 -0.136  
#>  3 Appearance Focus     appearanceFocus          5 -0.0282 
#>  4 Appetite Loss        appetiteLoss             3  0.00603
#>  5 Binge Eating         bingeEating              3  0.0509 
#>  6 Bodily Distress      bodilyDistress           6  0.0879 
#>  7 Body Dissatisfaction bodyDissatisfaction      4 -0.0891 
#>  8 Callousness          callousness              6 -0.347  
#>  9 Checking             checking                 5 -0.247  
#> 10 Cleaning             cleaning                 6  0.174  
#> # ℹ 66 more rows

# Per-scale alpha for data collected with a two-scale module. Select the
# item columns by name: `m$items` holds original HiTOP-SR numbers, which are
# column positions only in a data frame that is exactly the 405 items in order.
m <- hitop_module("hitopsr", scales = c("Agoraphobia", "Appetite Loss"))
collected <- sim_hitopsr[sprintf("hsr_%03d", m$items)]
reliability_hitopsr(collected, items = names(collected), module = m, omega = FALSE)
#> # A tibble: 2 × 4
#>   Scale         camelCase    nItems    alpha
#>   <chr>         <chr>         <int>    <dbl>
#> 1 Agoraphobia   agoraphobia       5 -0.108  
#> 2 Appetite Loss appetiteLoss      3  0.00603

# The same for data entered off a shuffled form: the columns are in the
# order the form printed its items, recorded on the module's `item_order`
# attribute (here set by hand; a descriptor written with `randomize = TRUE`
# carries it).
attr(m, "item_order") <- c(144L, 202L, 66L, 389L, 260L, 109L, 291L, 118L)
printed <- collected[match(attr(m, "item_order"), m$items)]
reliability_hitopsr(printed, items = seq_along(printed), module = m,
                    layout = "printed", omega = FALSE)
#> # A tibble: 2 × 4
#>   Scale         camelCase    nItems    alpha
#>   <chr>         <chr>         <int>    <dbl>
#> 1 Agoraphobia   agoraphobia       5 -0.108  
#> 2 Appetite Loss appetiteLoss      3  0.00603