predict.mtscr {mtscr}R Documentation

Extract scores from mtscr model

Description

Extract the scores from a model fitted with mtscr().

Usage

## S3 method for class 'mtscr'
predict(object, ..., minimal = FALSE, id_col = TRUE)

## S3 method for class 'mtscr_list'
predict(object, ..., minimal = FALSE, id_col = TRUE)

Arguments

object

A model or a model list fitted with mtscr().

...

Additional arguments. Currently not used.

minimal

If TRUE, returns only the person-level scores without the original data.

id_col

If TRUE, returns the id column in the result. If FALSE, the id column is not returned. Only has an impact when minimal = TRUE.

Value

The return value is always a tibble but its content depends mainly on the minimal argument:

Functions

Examples

data("mtscr_creativity", package = "mtscr")

mtscr_creativity <- mtscr_creativity |>
  dplyr::slice_sample(n = 500) # for performance, ignore

fit <- mtscr(mtscr_creativity, id, SemDis_MEAN, item, top = 1:3)

# for a single model from a list
predict(fit$top1)

# for a whole list of models
predict(fit)

# person-level scores only
predict(fit, minimal = TRUE)

# you can also achieve more classic predict() behaviour
mtscr_creativity$score <- predict(fit, id_col = FALSE)

mtscr_creativity |>
  tidyr::unnest_wider(score, names_sep = "_") # Use to expand list-col


[Package mtscr version 2.0.0 Index]