Skip to contents

NOTE: Example df is small and simulated, which causes non-convergence errors in some models.

library(rebl)
pacman::p_load(dplyr)

Get REBL Scores

Once we have a model we are happy with, we can get a data frame with our REBL scores (θ\theta):

rebl_items <- id_rebl_items(
  df = example, 
  pattern = '^(?!res).*', 
  perl = TRUE
)

model_cml <- get_rasch_model(
  df = example, 
  id = 'respondent_id', 
  rebl_items = rebl_items,
  type = 'cml'
)

rebl_scores <- get_rebl_scores(model = model_cml)
head(rebl_scores)
#>   id      rebl_cml
#> 1 p1 -0.1714695574
#> 2 p2 -0.1714695574
#> 3 p3  0.0005654146
#> 4 p4  0.3469324887
#> 5 p5 -0.3458996795
#> 6 p6  0.7134383210

rebl_scores are the latent person ability parameter θ\theta. We also include person fit statistics.

hist(
  rebl_scores$rebl_cml,
  main = 'Histogram of REBL Scores',
  xlab = 'REBL Score',
  ylab = 'Frequency'
)

TODO: Note symmetry

The function recognizes the model type and generates the output df accordingly. Let’s try it with the mml_uncon model:

model_con <- get_rasch_model(
  df = example, 
  id = 'respondent_id', 
  rebl_items = rebl_items,
  type = 'mml_con'
)

rebl_scores <- get_rebl_scores(
  model = model_con,
  df = example,
  rebl_items = rebl_items
)
rebl_scores %>% 
  dplyr::select(respondent_id, Exp:se.z1) %>% 
  head()
#>   respondent_id          Exp          z1     se.z1
#> 1            p1 1.233281e-06  0.01879318 0.3845670
#> 2            p2 1.133194e-05  0.01879314 0.3845670
#> 3            p3 1.827986e-06  0.16614210 0.3834232
#> 4            p4 2.463664e-05  0.46130495 0.3859749
#> 5            p5 2.323019e-05 -0.13006566 0.3873551
#> 6            p6 1.804789e-06  0.76561442 0.3953806

Here, Exp is the expected frequency of the response pattern, z1 is the person parameter (REBL score), and se.z1 is the standard error. All of the ltm varieties of models result in this same structure:

model_2pl <- get_rasch_model(
  df = example, 
  id = 'respondent_id', 
  rebl_items = rebl_items,
  type = 'mml_tpm'
)
rebl_scores <- get_rebl_scores(
  model = model_2pl,
  df = example,
  rebl_items = rebl_items
)
rebl_scores %>% 
  dplyr::select(respondent_id, z1:se.z1) %>% 
  head()
#>   respondent_id          z1     se.z1
#> 1            p1 -0.02581175 0.9826781
#> 2            p2  0.02393432 0.9812392
#> 3            p3  0.05696231 0.9829088
#> 4            p4  0.27077841 0.9820741
#> 5            p5 -0.04679345 0.9806309
#> 6            p6  0.34543170 0.9853315

TODO: interpret

model_tpm <- get_rasch_model(
  df = example, 
  id = 'respondent_id', 
  rebl_items = rebl_items,
  type = 'mml_tpm'
)
rebl_scores <- get_rebl_scores(
  model = model_tpm,
  df = example,
  rebl_items = rebl_items
)
rebl_scores %>% 
  dplyr::select(respondent_id, z1:se.z1) %>% 
  head()
#>   respondent_id          z1     se.z1
#> 1            p1 -0.02581175 0.9826781
#> 2            p2  0.02393432 0.9812392
#> 3            p3  0.05696231 0.9829088
#> 4            p4  0.27077841 0.9820741
#> 5            p5 -0.04679345 0.9806309
#> 6            p6  0.34543170 0.9853315

TODO: interpret

Person Item Maps

ICC Plots