The HiTOP-PRO instrument has 405 items and yields 76 scale scores. To demonstrate the ability of the package to calculate these scale scores, we can use real example data (n=143) that was collected at the University of Kansas (KU) by Girard & Gray in 2024. This data is stored in the package under the name ku_hitoppro
.
First, we load the package into memory using the library()
function. If this doesn’t work, make sure you installed the package properly (see the README on GitHub).
Next, we can load the example dataset from the package using the data()
function. It is a large tibble that contains a participant
column with a unique identifier for each participant, a biosex
column indicating whether each participant is “female” or “male”, and then 405 columns numbered hitop001
to hitop405
containing each participant’s rating on each item of the HiTOP-PRO (on a numerical scale from 1 to 4).
data("ku_hitoppro")
ku_hitoppro
#> # A tibble: 143 × 407
#> participant biosex hitop001 hitop002 hitop003 hitop004 hitop005 hitop006
#> <chr> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 R_3KOxNF2JCWCT9… female 1 1 1 1 1 1
#> 2 R_1RLNDHA6qwM6v… female 1 1 1 2 2 1
#> 3 R_61bkFQweO6uye… female 1 1 1 1 1 1
#> 4 R_3kO0nXySSg3nW… female 1 2 1 1 1 1
#> 5 R_5yGEvYGy4YqwY… female 3 3 4 2 4 1
#> 6 R_3Pv6gPT8dxYkB… female 1 2 1 1 1 1
#> 7 R_3KBAdhGCugaGG… female 1 2 2 1 2 2
#> 8 R_5fkRaVh1ZiNvm… male 1 1 1 1 1 1
#> 9 R_5hbvtJ91lzoGS… male 3 3 4 2 3 1
#> 10 R_5dWEI8k79ahEZ… female 1 1 1 1 1 1
#> # ℹ 133 more rows
#> # ℹ 399 more variables: hitop007 <dbl>, hitop008 <dbl>, hitop009 <dbl>,
#> # hitop010 <dbl>, hitop011 <dbl>, hitop012 <dbl>, hitop013 <dbl>,
#> # hitop014 <dbl>, hitop015 <dbl>, hitop016 <dbl>, hitop017 <dbl>,
#> # hitop018 <dbl>, hitop019 <dbl>, hitop020 <dbl>, hitop021 <dbl>,
#> # hitop022 <dbl>, hitop023 <dbl>, hitop024 <dbl>, hitop025 <dbl>,
#> # hitop026 <dbl>, hitop027 <dbl>, hitop028 <dbl>, hitop029 <dbl>, …
Basic Scoring
To turn these item-level ratings into mean scores on the 76 scales, we can use the score_hitoppro()
function. It needs to know what object contains the data and which columns contain the item-level data. There are several ways we can specify the items. First, we can provide the column numbers and use the :
shortcut. In this tibble, the items are from column 3 to column 407 so we can use items = 3:407
. I am going to also set append = FALSE
so that you can quickly see the scale scores.
scores <- score_hitoppro(
data = ku_hitoppro,
items = 3:407,
append = FALSE
)
scores
#> # A tibble: 143 × 76
#> pro_agoraphobia pro_antisocialBehavior pro_appetiteLoss pro_bingeEating
#> <dbl> <dbl> <dbl> <dbl>
#> 1 1 1 1 1.33
#> 2 1.4 1 1.33 1
#> 3 1 1 1.67 1.67
#> 4 1.2 1 2.33 3
#> 5 3.2 1 2.67 1
#> 6 1.2 1 2 1.33
#> 7 1.6 1.25 2.67 1.67
#> 8 1 1.12 1 2.33
#> 9 3 1 1.33 2
#> 10 1 1 1 1
#> # ℹ 133 more rows
#> # ℹ 72 more variables: pro_bodilyDistress <dbl>, pro_bodyDissatisfaction <dbl>,
#> # pro_bodyFocus <dbl>, pro_callousness <dbl>, pro_checking <dbl>,
#> # pro_cleaning <dbl>, pro_cognitiveProblems <dbl>,
#> # pro_conversionSymptoms <dbl>, pro_counting <dbl>,
#> # pro_dietaryRestraint <dbl>, pro_difficultiesReachingOrgasm <dbl>,
#> # pro_diseaseConviction <dbl>, pro_dishonesty <dbl>, …
Appending
If I had instead set append = TRUE
(or left it off, as that is the default), we would get back the ku_hitoppro
tibble with the scale scores added to the end as extra columns. Notice below how we now have 483 columns instead of 407.
scores <- score_hitoppro(
data = ku_hitoppro,
items = 3:407
)
scores
#> # A tibble: 143 × 483
#> participant biosex hitop001 hitop002 hitop003 hitop004 hitop005 hitop006
#> <chr> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 R_3KOxNF2JCWCT9… female 1 1 1 1 1 1
#> 2 R_1RLNDHA6qwM6v… female 1 1 1 2 2 1
#> 3 R_61bkFQweO6uye… female 1 1 1 1 1 1
#> 4 R_3kO0nXySSg3nW… female 1 2 1 1 1 1
#> 5 R_5yGEvYGy4YqwY… female 3 3 4 2 4 1
#> 6 R_3Pv6gPT8dxYkB… female 1 2 1 1 1 1
#> 7 R_3KBAdhGCugaGG… female 1 2 2 1 2 2
#> 8 R_5fkRaVh1ZiNvm… male 1 1 1 1 1 1
#> 9 R_5hbvtJ91lzoGS… male 3 3 4 2 3 1
#> 10 R_5dWEI8k79ahEZ… female 1 1 1 1 1 1
#> # ℹ 133 more rows
#> # ℹ 475 more variables: hitop007 <dbl>, hitop008 <dbl>, hitop009 <dbl>,
#> # hitop010 <dbl>, hitop011 <dbl>, hitop012 <dbl>, hitop013 <dbl>,
#> # hitop014 <dbl>, hitop015 <dbl>, hitop016 <dbl>, hitop017 <dbl>,
#> # hitop018 <dbl>, hitop019 <dbl>, hitop020 <dbl>, hitop021 <dbl>,
#> # hitop022 <dbl>, hitop023 <dbl>, hitop024 <dbl>, hitop025 <dbl>,
#> # hitop026 <dbl>, hitop027 <dbl>, hitop028 <dbl>, hitop029 <dbl>, …
Items as Strings
Alternatively, we could provide the item column names as a character string. Typing out all 405 item names would be a hassle, but luckily this dataset named them consistently so we can build the names automatically using sprintf()
. If we use the “hitop%03d” format and apply that across the numbers 1 to 405, that will create the zero-padded column names we need. If there was no zero-padding, we could have just used “hitop%d”.
scores <- score_hitoppro(
data = ku_hitoppro,
items = sprintf("hitop%03d", 1:405),
append = FALSE
)
scores
#> # A tibble: 143 × 76
#> pro_agoraphobia pro_antisocialBehavior pro_appetiteLoss pro_bingeEating
#> <dbl> <dbl> <dbl> <dbl>
#> 1 1 1 1 1.33
#> 2 1.4 1 1.33 1
#> 3 1 1 1.67 1.67
#> 4 1.2 1 2.33 3
#> 5 3.2 1 2.67 1
#> 6 1.2 1 2 1.33
#> 7 1.6 1.25 2.67 1.67
#> 8 1 1.12 1 2.33
#> 9 3 1 1.33 2
#> 10 1 1 1 1
#> # ℹ 133 more rows
#> # ℹ 72 more variables: pro_bodilyDistress <dbl>, pro_bodyDissatisfaction <dbl>,
#> # pro_bodyFocus <dbl>, pro_callousness <dbl>, pro_checking <dbl>,
#> # pro_cleaning <dbl>, pro_cognitiveProblems <dbl>,
#> # pro_conversionSymptoms <dbl>, pro_counting <dbl>,
#> # pro_dietaryRestraint <dbl>, pro_difficultiesReachingOrgasm <dbl>,
#> # pro_diseaseConviction <dbl>, pro_dishonesty <dbl>, …
Scale Prefixes
Also note that each scale column has the prefix “pro_” in its name. You can change the prefix (e.g., setting it to "htp_"
) or even turn it off (e.g., setting it to ""
) using the prefix
argument.
scores <- score_hitoppro(
data = ku_hitoppro,
items = sprintf("hitop%03d", 1:405),
prefix = "htp_",
append = FALSE
)
scores
#> # A tibble: 143 × 76
#> htp_agoraphobia htp_antisocialBehavior htp_appetiteLoss htp_bingeEating
#> <dbl> <dbl> <dbl> <dbl>
#> 1 1 1 1 1.33
#> 2 1.4 1 1.33 1
#> 3 1 1 1.67 1.67
#> 4 1.2 1 2.33 3
#> 5 3.2 1 2.67 1
#> 6 1.2 1 2 1.33
#> 7 1.6 1.25 2.67 1.67
#> 8 1 1.12 1 2.33
#> 9 3 1 1.33 2
#> 10 1 1 1 1
#> # ℹ 133 more rows
#> # ℹ 72 more variables: htp_bodilyDistress <dbl>, htp_bodyDissatisfaction <dbl>,
#> # htp_bodyFocus <dbl>, htp_callousness <dbl>, htp_checking <dbl>,
#> # htp_cleaning <dbl>, htp_cognitiveProblems <dbl>,
#> # htp_conversionSymptoms <dbl>, htp_counting <dbl>,
#> # htp_dietaryRestraint <dbl>, htp_difficultiesReachingOrgasm <dbl>,
#> # htp_diseaseConviction <dbl>, htp_dishonesty <dbl>, …
Simple Standard Errors
Finally, in addition to calculating each scale score as the mean of its corresponding items, we can also calculate each scale score’s standard error as the SD of its corresponding items divided by the square root of its number of items. These standard errors are especially useful when plotting the scores as they can be converted into confidence intervals. We turn this on using calc_se
.
scores <- score_hitoppro(
data = ku_hitoppro,
items = sprintf("hitop%03d", 1:405),
calc_se = TRUE,
append = FALSE
)
scores
#> # A tibble: 143 × 152
#> pro_agoraphobia pro_antisocialBehavior pro_appetiteLoss pro_bingeEating
#> <dbl> <dbl> <dbl> <dbl>
#> 1 1 1 1 1.33
#> 2 1.4 1 1.33 1
#> 3 1 1 1.67 1.67
#> 4 1.2 1 2.33 3
#> 5 3.2 1 2.67 1
#> 6 1.2 1 2 1.33
#> 7 1.6 1.25 2.67 1.67
#> 8 1 1.12 1 2.33
#> 9 3 1 1.33 2
#> 10 1 1 1 1
#> # ℹ 133 more rows
#> # ℹ 148 more variables: pro_bodilyDistress <dbl>,
#> # pro_bodyDissatisfaction <dbl>, pro_bodyFocus <dbl>, pro_callousness <dbl>,
#> # pro_checking <dbl>, pro_cleaning <dbl>, pro_cognitiveProblems <dbl>,
#> # pro_conversionSymptoms <dbl>, pro_counting <dbl>,
#> # pro_dietaryRestraint <dbl>, pro_difficultiesReachingOrgasm <dbl>,
#> # pro_diseaseConviction <dbl>, pro_dishonesty <dbl>, …
Note how there are now 152 columns instead of 76. The extra columns aren’t shown in the preview above, but they are named with the _se
suffix, e.g., pro_agoraphobia_se
.