Learn R Programming

autoFC (version 0.2.0.1002)

predict_scores: Predict trait scores based on estimated model

Description

An easy wrapper for the thurstonianIRT::predict() function

Usage

predict_scores(estimated_model, newdata, output_file = NULL)

Value

A data frame containing estimated trait scores of the new response sample

Arguments

estimated_model

Estimated model

newdata

Response data from new response samples, in TIRT data format. Preferably be generated from thurstonianIRT::make_TIRT_data() or get_TIRT_long_data().

output_file

Character string. If specified, output the trait scores into a specified csv file.

Author

Mengtong Li

Examples

Run this code
test_data <- triplet_example_data[1:20,]
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")
if (FALSE) {
    test_fit <- fit_TIRT_model(test_data_long, method = "mplus")
    predict_scores(test_fit$fit_object, newdata = test_data[21:40,])
}

Run the code above in your browser using DataLab