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).
Arguments
- data
A data frame containing the HiTOP-SR items (numerically coded): all 405 of them, or, when
moduleis 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, whenmoduleis supplied, that module's items. Items must be supplied in instrument order, or in the form's printed order underlayout = "printed"; duplicated entries are an error. The ascending-name warningscore_hitopsr()describes applies here too. Underlayout = "printed", names whose trailing numbers equal the module'sitem_orderare in the printed order and pass with no warning. Whenitemsis omitted orNULL, the names on themodule'scolumnsattribute are used, as inscore_hitopsr(). A call withitemsomitted is an error if nomoduleis supplied, if the module has nocolumnsattribute, or underlayout = "printed". A supplieditemsis always used, whether or not the module has the attribute. Each column must be numeric or logical, or character holding only numbers (blank cells andNAvalues 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 classhitop_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 withiconv(). So is an SPSS column (haven_labelled_spss) that holds a value it declares missing; turn those codes intoNAwithhaven::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, buthaven::zap_missing()leaves it unchanged, so set the values itsna_valuesorna_rangeattribute declares toNAfirst.- 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_moduleobject, as returned byhitop_module(), describing a module of the instrument. When supplied,dataanditemshold only that module's item columns — in ascending instrument order, as thegenerate_*_hitopsr()forms lay them out — and one row is returned per module scale. WhenNULL, all 405 items are expected and all 76 scales are estimated. A module whoseitems,nItems,camelCaseorinstrumentdiffer from a freshhitop_module()build of its scales, as after an edit by hand, or that cannot be rebuilt from itsinstrumentandscales, is refused with an error of classhitop_module_mismatch. (default =NULL)- layout
The order the item columns are in.
"instrument"(the default) is ascending HiTOP-SR order, as thegenerate_*_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 amodulecarrying anitem_orderattribute, the record a module descriptor written bygenerate_docx_hitopsr()withrandomize = TRUEkeeps andread_module()returns; the columns are put back into instrument order through that attribute before the estimates run. A call withlayout = "printed"and no module, a module with noitem_order, or anitem_orderthat 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'sScaleis the subscale's name (Subscalein hitopsr_subscales), and itscamelCaseandnItemscome from the same row. With amodule, 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 bothmoduleandsubsetis 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
