get_affect_ppc: Extract posterior predictions from affect data models and...

View source: R/helper_funcs.R

get_affect_ppcR Documentation

Extract posterior predictions from affect data models and assess fit

Description

get_affect_ppc combines posterior predictions contained in a posterior::draws_df() outputted from a fit model with raw affect ratings, and returns various fit metrics (pseudo-R^2, MAE, RMSE), for each individual. We follow Ferrari & Cribari-Neto (2004) in defining pseudo-R^2 as the squared correlation between observed and mean posterior predictions.

Usage

get_affect_ppc(draws, raw, adj)

Arguments

draws

A posterior::draws_df(). Draws outputted from fit_learning_model (as a posterior::draws_list()) should be converted via posterior::as_draws_df() - this is memory intensive, hence it is not done internally.

raw

Raw data, e.g., saved by fit_learning_model().

adj

Name of the affect adjective - one of "happy", "confident" or "engaged".

Value

List containing a dataframe with participant identifiers, numbers, and pseudo R^2, MAE and RMSE for each individual; and a named list (by ID) of data frames with individuals' mean posterior predictions and raw affect data.

Examples

## Not run: 
fit_affect <- fit_learning_model(
  example_data$nd,
  model = "2a",
  affect = TRUE,
  exp_part = "training",
  algorithm = "fullrank"
 )

 fit_ls_happy <- get_affect_ppc(
   draws = fit_affect$draws,
   raw = fit_affect$raw_df,
   adj = "happy"
 )
 
## End(Not run)


qdercon/pstpipeline documentation built on June 1, 2025, 1:11 p.m.