convert_to_TIRT_response: Convert the Latent Utility Values into Thurstonian IRT...

View source: R/convert_to_TIRT_response.R

convert_to_TIRT_responseR Documentation

Convert the Latent Utility Values into Thurstonian IRT Pairwise/Rank Responses with Pre-Specified Block Design

Description

This function simulates the responses to forced-choice blocks (both MOLE and RANK format), with the raw responses converted into pairwise or rank data to be understood by the Thurstonian IRT model.

Usage

convert_to_TIRT_response(
  Utility,
  block_design,
  format = "pairwise",
  partial = FALSE,
  block_size,
  N_blocks,
  N_response,
  verbose = TRUE
)

Arguments

Utility

The utility matrix of all items.

block_design

A numeric matrix specifying which items will be in the same forced-choice block (row).

format

What format should the converted responses be in? Can be "pairwise" or "ranks".

partial

Only used when format == "ranks". Should partial ranking responses be produced?

block_size, N_blocks

The block size and total number of the forced-choice scale. Preferably left blank and obtained through block_design.

N_response

Number of simulated responses you wish to generate. Default to nrow(Utility).

verbose

Logical. Should warning message be displayed?

Details

According to the Thurstonian IRT model, when a respondent needs to make a choice between two items, they elicit a latent utility value for the two items and choose the item that has a higher utility value. Choosing/Ranking among >2 items follows a similar procedure where the respondent generate latent utility for each item and produces a ranking or preference.

For forced-choice blocks, the above choice procedure is conducted among the block_size items in the same block, and the respondent can either indicate the most/least preferred item (MOLE format) or rank all the items in terms of preference (RANK format).

Regardless of the format, the raw responses to the forced-choice blocks need to be converted into either all pairwise comparisons (format = "pairwise"), or a full ranking (format = "ranks"), among the the block_size items in the same block.

We note that the when block_size is larger than 3 and when the MOLE format is used, some pairwise comparisons among the items in the block will be missing by design. As for now, the current technique is not yet able to handle missing pairwise responses when format = "pairwise". Thus, if users wish to simulate responses to MOLE format blocks with block_size larger than 3, we recommend using format = "ranks" and also set partial = TRUE.

Value

A data frame containing pairwise (if format == "pairwise") or rank (if format == "ranks") responses to each block for the N_response participants.

Note

Importantly, the Utility matrix produced by get_simulation_matrices() may not be directly used in this function because that utility matrix will have the item columns placed in the order they appear in the CFA model, not in the original Item 1, Item 2...order. Users need to re-order the columns of the Utility matrix produced by get_simulation_matrices() accordingly before feeding the utility matrix to this function.

Author(s)

Mengtong Li

Examples

rating_data <- HEXACO_example_data
cfa_model <- paste0("H =~ ", paste0("SS", seq(6,60,6), collapse = " + "), "\n",
                    "E =~ ", paste0("SS", seq(5,60,6), collapse = " + "), "\n",
                    "X =~ ", paste0("SS", seq(4,60,6), collapse = " + "), "\n",
                    "A =~ ", paste0("SS", seq(3,60,6), collapse = " + "), "\n",
                    "C =~ ", paste0("SS", seq(2,60,6), collapse = " + "), "\n",
                    "O =~ ", paste0("SS", seq(1,60,6), collapse = " + "), "\n")
cfa_estimates <- get_CFA_estimates(response_data = rating_data,
                                   fit_model = cfa_model, 
                                   item_names = paste0("SS",c(1:60)))
cfa_matrices <- get_simulation_matrices(loadings = cfa_estimates$loadings,
                                        intercepts = cfa_estimates$intercepts,
                                        residuals = cfa_estimates$residuals,
                                        covariances = cfa_estimates$covariances,
                                        N = 100, N_items = 60, N_dims = 6,
                                        dim_names = c("H", "E", "X", "A", "C", "O"),
                                        empirical = TRUE)

### Re-order the Utility columns!
cfa_matrices$Utility <- cfa_matrices$Utility[,c(t(matrix(1:60, ncol = 6)[,6:1]))]
### N_response need to be consistent with those specified in get_simulated_matrices()
FC_resp <- convert_to_TIRT_response(Utility = cfa_matrices$Utility,
                                    block_design = make_random_block(60, 60, 3),
                                    N_response = 100, format = "pairwise",
                                    block_size = 3, N_blocks = 20)
FC_rank_resp <- convert_to_TIRT_response(Utility = cfa_matrices$Utility,
                                         block_design = make_random_block(60, 60, 5),
                                         N_response = 100, format = "ranks",
                                         block_size = 5, N_blocks = 12) 
FC_rank_partial_resp <- convert_to_TIRT_response(Utility = cfa_matrices$Utility,
                                                 block_design = make_random_block(60, 60, 5),
                                                 N_response = 100, format = "ranks", partial = TRUE,
                                                 block_size = 5, N_blocks = 12)                                          
FC_resp
FC_rank_resp
FC_rank_partial_resp


tspsyched/autoFC documentation built on Oct. 8, 2024, 10:39 p.m.