Adding indices and computing reliability estimates"

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Tidycomm provides a workflow to quickly add mean/sum indices of several variables to the dataset and compute reliability estimates for those added indices:

library(tidycomm)

Once again, we will again sample data from the Worlds of Journalism 2012-16 study for demonstration purposes.

WoJ

ethics_1 to ethics_4 measure agreement with statements concerning ethics in journalism and may be combined into an index of 'ethical flexbility', while the items starting with trust_ measure trust in various political institutions and thus may be combined into an index of trust in politics.

Add mean and sum indices

add_index() adds a mean index of specified variables to the data. The second (or first, if used in a pipe) argument is the name of index variable to be created:

WoJ %>% 
  add_index(ethical_flexibility, ethics_1, ethics_2, ethics_3, ethics_4) %>%
  # Select variables of relevance for output
  dplyr::select(ethical_flexibility, ethics_1, ethics_2, ethics_3, ethics_4)

To create a sum index instead, set type = "sum":

WoJ %>% 
  add_index(ethical_flexibility, ethics_1, ethics_2, ethics_3, ethics_4, type = "sum") %>%
  # Select variables of relevance for output
  dplyr::select(ethical_flexibility, ethics_1, ethics_2, ethics_3, ethics_4)

Compute reliability estimates of created indices

Use get_reliability() to compute reliability/internal consistency estimates for indices created with add_index(). Passing no further arguments to the function will automatically compute reliability estimates for all indices created with add_index() found in the data and output Cronbach's $\alpha$ along with descriptives and index information.

# Add two indices to data
WoJ <- WoJ %>% 
  add_index(ethical_flexibility, ethics_1, ethics_2, ethics_3, ethics_4) %>%
  add_index(trust_in_politics, trust_parliament, trust_government, trust_parties, trust_politicians)

WoJ %>% 
  get_reliability()

If you only want reliability estimates for specific indices, pass their names as function arguments.

WoJ %>% 
  get_reliability(trust_in_politics)

Essentially, get_reliability() provides a wrapper for the ci.reliability function from the MBESS package. Thus, all arguments of MBESS::ci.reliability() can be passed to get_reliability(). For example, to output $\omega$ instead of Cronbach's $\alpha$ including robust maximum likelihood confidence intervals, you can type:

WoJ %>% 
  get_reliability(type = 'omega', interval.type = 'mlr')

See the function documentation for more info (and don't forget to cite the MBESS package if using get_reliability()).



Try the tidycomm package in your browser

Any scripts or data that you put into this service are public.

tidycomm documentation built on July 6, 2021, 5:07 p.m.