fit_TIRT_model: Fit the Thurstonian IRT Model with Long Format Response Data

View source: R/fit_TIRT_model.R

fit_TIRT_modelR Documentation

Fit the Thurstonian IRT Model with Long Format Response Data

Description

Fits the Thurstonian IRT response model using either lavaan, Mplus, or stan methods. A long format response data set needs to be provided.

Usage

fit_TIRT_model(
  data_TIRT,
  method = "lavaan",
  lavaan_estimator = "WLSMV",
  stan_cores = 4,
  chains = 4,
  iter = 2000,
  verbose = TRUE
)

Arguments

data_TIRT

Long format TIRT response data as generated from get_TIRT_long_data() or thurstonianIRT::make_TIRT_data().

method

Estimation method for the TIRT model. Can be "lavaan", "mplus" or "stan".

lavaan_estimator

Which estimator to use when lavaan is chosen as the method of estimating the TIRT model. Defaults to "WLSMV".

stan_cores, chains, verbose, iter

Parameters used in thurstonianIRT::fit_TIRT_stan

Details

This function incorporates the fit TIRT models functions in the thurstonianIRT package (Bürkner, 2019) and by (a) providing a wrapper interface for users to choose from estimating from lavaan, MPLUS, or stan, (b) placing the fit object, resulting trait estimates, and the original long format response data into one list as the return object. Users need to provide a long format TIRT response data set as generated from get_TIRT_long_data() or from thurstonianIRT::make_TIRT_data(), and they can choose from three estimation methods: lavaan, MPLUS or stan. For lavaan and stan, additional arguments can be specified.

We note that currently the lavaan method does not provide standard error estimates, and for complex TIRT models (e.g., long scale or many traits) the Mplus method may also produce error due to the mechanics Mplus handles its input syntax. The stan method is the most stable but can take a very long time for estimation. Users wishing to speed up the estimation process may also consider using the Excel macro developed by Brown & Maydeu-Olivares (2012) to generate Mplus syntax and directly run the syntax in Mplus.

Value

A list containing:

final_estimates Final trait score and standard error estimates

fit_object TIRT model fit object

responses_TIRT The long format TIRT response

long_estimates Final trait score and standard error estimates, in long format

Author(s)

Mengtong Li

References

Bürkner, P. C. (2019). thurstonianIRT: Thurstonian IRT models in R. Journal of Open Source Software, 4(42), 1662. https://doi.org/10.21105/joss.01662

Brown, A., & Maydeu-Olivares, A. (2012). Fitting a Thurstonian IRT model to forced-choice data using Mplus. Behavior Research Methods, 44, 1135-1147. https://doi.org/10.3758/s13428-012-0217-x

See Also

thurstonianIRT::fit_TIRT_lavaan,

thurstonianIRT::fit_TIRT_mplus,

thurstonianIRT::fit_TIRT_stan

Examples

set.seed(2024)
test_data <- triplet_example_data
block_info <- triplet_block_info
test_data_long <- get_TIRT_long_data(block_info = triplet_block_info, response_data = test_data,
                                     response_varname = build_TIRT_var_names(N_blocks = 5, block_size = 3, item_name = "i"),
                                     block_name = "Block", item_name = "ID", trait_name = "Factor", sign_name = "Keying")
## Not run: 
    test_fit <- fit_TIRT_model(test_data_long, method = "lavaan")
    test_fit$fit_object
    test_fit$final_estimates

## End(Not run)


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