How to calculate Spearman-Brown coefficient easily

I have a difficulty in finding a working code for creating a Spearman-Brown coefficient. I need to do it for a sum variable with two items, and I wish I didn't have create that function by my own. I have tried with spearman_brown from the package splithalfr

I have tried this and others without success. How would you do it?

spearman_brown(df, var1, var2, SB_only = FALSE)

Data

structure(list(var1 = c(5, 2, NA, 2, 3, 1, 6, 1, 4, 5, 5, 2, 
2, 3, 1, 3, 2, NA, 5, 7, 5, 2, 2, 2, NA, 2, NA, 2, 2, 5, 2, 4, 
2, 3, 5, 5, 2, 5, 5, 2, 4, NA, 6, 7, 7, 3), var2 = c(2, 1, NA, 
2, 2, 1, 1, 1, 2, 2, 3, 1, 2, 2, 1, 2, 2, NA, 3, 2, 1, 2, 2, 
1, NA, 1, NA, 1, 1, 2, 1, 1, 2, 2, 2, 4, 2, 3, 2, 2, 1, NA, 2, 
2, 4, 1)), class = c("rowwise_df", "tbl_df", "tbl", "data.frame"
), row.names = c(NA, -46L), groups = structure(list(.rows = structure(list(
    1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 
    15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 
    27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L, 37L, 38L, 
    39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L), ptype = integer(0), class = c("vctrs_list_of", 
"vctrs_vctr", "list"))), row.names = c(NA, -46L), class = c("tbl_df", 
"tbl", "data.frame")))

Just from the function signature, I would do it

spearman_brown(x, y, fn_cor = cor, ...)

where x and y are var1 and var2 (df$var1,df$var2 if necessay), fn_cor is your chosen function to calculate the coefficient (e.g., ICC) and \dots are the arguments to be passed to that function.

To be honest, I don't know what is ICC or the other options I have for a function to calculate the coefficient. I thought spearman_brown would have all that in it. Also, what arguments you mean, that could be in the place of ...?

Well, see the paper here, which explains the derivation and meaning of the various inter class correlation measures that are available in place of the default cor(). spearman_brown() indirectly relies on DescTools::ICC, which has an explanation of the six cases of reliability of ratings done by k raters on n targets introduced by the technique. The default for spearman_brown is simply cor(), which may inadequately capture differences.

R has a Spidey problem of conferring great statistical powers on the user without making any assumptions about the user's state of experience. Statistics is too big to know everything about and users are always having to track down detail like this. It's important to do so before relying on any statistical measure.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.