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 |
... |
Additional arguments. Currently not used. |
minimal |
If |
id_col |
If |
Value
The return value is always a tibble but its content depends mainly on the minimal
argument:
If
minimal = FALSE
(default), the original data frame is returned with the creativity scores columns added.If
minimal = TRUE
, only the creativity scores are returned (i.e., one row per person).
Functions
-
predict(mtscr_list)
: Extract scores from a model list fitted withmtscr()
.
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]