Model classes
These classes can be used to define different available models. Curretly, 5 classes of models are implemented in rlssm:
simple reinforcement learning models: RLModel_2A
diffusion decision models: DDModel
reinforcement learning diffusion decision models: RLDDModel
race models: RDModel_2A, LBAModel_2A, ARDModel_2A, ALBAModel_2A
reinforcement learning race models: RLRDModel_2A, RLLBAModel_2A, RLARDModel_2A, RLALBAModel_2A
All classes have a hierarchical and non-hierarchical version, and come with additional cognitive mechanisms that can be added or excluded.
Note
At the moment, all model classes are meant for decisions between 2 alternatives.
Reinforcement learning models (for 2 alternatives)
- class rlssm.RLModel_2A(hierarchical_levels, increasing_sensitivity=False, separate_learning_rates=False)
RLModel_2A allows to specify a reinforcement learning model.
When initializing the model, you should specify whether the model is hierarchical or not. Additionally, you can specify the mechanisms that you wish to include or exclude.
The underlying stan model will be compiled if no previously compiled model is found. After initializing the model, it can be fitted to a particular dataset using pystan.
- __init__(hierarchical_levels, increasing_sensitivity=False, separate_learning_rates=False)
Initialize a RLModel_2A object.
Note
This model is restricted to two options per trial (coded as correct and incorrect). However, more than two options can be presented in the same learning session.
- Parameters
hierarchical_levels (int) – Set to 1 for individual data and to 2 for grouped data.
increasing_sensitivity (bool, default False) – By default, sensitivity is fixed throughout learning. If set to True, sensitivity increases throughout learning. In particular, it increases as a power function of the n times an option has been seen (as in Yechiam & Busemeyer, 2005).
separate_learning_rates (bool, default False) – By default, there is only one learning rate. If set to True, separate learning rates are estimated for positive and negative prediction errors.
- model_label
The label of the fully specified model.
- Type
str
- n_parameters_individual
The number of individual parameters of the fully specified model.
- Type
int
- n_parameters_trial
The number of parameters that are estimated at a trial level.
- Type
int
- stan_model_path
The location of the stan model code.
- Type
str
- compiled_model
The compiled stan model.
- Type
pystan.StanModel
- fit(data, K, initial_value_learning, alpha_priors=None, sensitivity_priors=None, consistency_priors=None, scaling_priors=None, alpha_pos_priors=None, alpha_neg_priors=None, include_rhat=True, include_waic=True, include_last_values=True, pointwise_waic=False, print_diagnostics=True, **kwargs)
Fits the specified reinforcement learning model to data.
- Parameters
data (DataFrame) –
A pandas DataFrame containing data observations.
Columns should include (it’s OK if some of them are column indexes too):
trial_block, the number of trial in a learning session. Should be integers starting from 1.
f_cor, the output from the correct option in the presented pair (the option with higher outcome on average).
f_inc, the output from the incorrect option in the presented pair (the option with lower outcome on average).
cor_option, the number identifying the correct option in the presented pair (the option with higher outcome on average).
inc_option, the number identifying the incorrect option in the presented pair (the option with lower outcome on average).
block_label, the number identifying the learning session. Should be integers starting from 1. Set to 1 in case there is only one learning session.
accuracy, 0 if the incorrect option was chosen, 1 if the correct option was chosen.
If the model is hierarchical, also include:
participant, the participant number. Should be integers starting from 1.
If increasing_sensitivity is True, also include:
times_seen, average number of times the presented options have been seen in a learning session.
K (int) – Number of options per learning session.
initial_value_learning (float) – The assumed value expectation in the first learning session. The learning value in the following learning sessions is set to the average learned value in the previous learning session.
alpha_priors (dict, optional) – Priors for the learning rate parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
sensitivity_priors (dict, optional) – Priors for the sensitivity parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
consistency_priors (dict, optional) – Priors for the consistency parameter (only meaningful if increasing_sensitivity is True). In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
scaling_priors (dict, optional) – Priors for the scaling parameter (only meaningful if increasing_sensitivity is True). In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
alpha_pos_priors (dict, optional) – Priors for the learning rate for the positive PE (only meaningful if separate_learning_rates is True). In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
alpha_neg_priors (dict, optional) – Priors for the learning rate for the negative PE (only meaningful if separate_learning_rates is True). In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
include_rhat (bool, default True) – Whether to calculate the Gelman-Rubin convergence diagnostic r hat (Gelman & Rubin, 1992).
include_waic (bool, default True) – Whether to calculate the widely applicable information criterion (WAIC; Watanabe, 2013).
pointwise_waic (bool, default False) – Whether to also inclue the pointwise WAIC. Only relevant if include_waic is True.
include_last_values (bool, default True) – Whether to extract the last values for each chain.
print_diagnostics (bool, default True) – Whether to print mcmc diagnostics after fitting. It is advised to leave it to True and always check, on top of the r hat.
**kwargs – Additional arguments to pystan.StanModel.sampling().
- Returns
res
- Return type
rlssm.fits.RLModelResults
Diffusion decision models
- class rlssm.DDModel(hierarchical_levels, starting_point_bias=False, drift_variability=False, starting_point_variability=False, drift_starting_point_correlation=False, drift_starting_point_beta_correlation=False, drift_starting_point_regression=False)
DDModel allows to specify a diffusion decision model.
When initializing the model, you should specify whether the model is hierarchical or not. Additionally, you can specify the mechanisms that you wish to include or exclude.
The underlying stan model will be compiled if no previously compiled model is found. After initializing the model, it can be fitted to a particular dataset using pystan.
- __init__(hierarchical_levels, starting_point_bias=False, drift_variability=False, starting_point_variability=False, drift_starting_point_correlation=False, drift_starting_point_beta_correlation=False, drift_starting_point_regression=False)
Initialize a DDModel object.
Note
This model is restricted to two options per trial (coded as correct and incorrect).
- Parameters
hierarchical_levels (int) – Set to 1 for individual data and to 2 for grouped data.
starting_point_bias (bool, default False) – By default, there is no starting point bias. If set to True, the starting point bias is estimated.
drift_variability (bool, default False) – By default, there is no drift-rate variability across trials. If set to True, the standard deviation of the drift-rate across trials is estimated.
starting_point_variability (bool, default False) – By default, there is no starting point bias variability across trials. If set to True, the standard deviation of the starting point bias across trials is estimated.
drift_starting_point_correlation (bool, default False) – By default, the correlation between these 2 parameters is not estimated. If set to True, the 2 parameters are assumed to come from a multinormal distribution. Only relevant when drift_variability and starting_point_variability are True.
drift_starting_point_beta_correlation (bool, default False) –
If True, trial-by-trial drift-rate, rel_sp and an external variable beta are assumed to come from a multinormal distribution.
Only relevant when drift_variability and starting_point_variability are True.
drift_starting_point_regression (bool, default False) – If True, two regression coefficients are estimated, for trial drift and relative starting point, and an external variable beta. Only relevant when drift_variability and starting_point_variability are True.
- model_label
The label of the fully specified model.
- Type
str
- n_parameters_individual
The number of individual parameters of the fully specified model.
- Type
int
- n_parameters_trial
The number of parameters that are estimated at a trial level.
- Type
int
- stan_model_path
The location of the stan model code.
- Type
str
- compiled_model
The compiled stan model.
- Type
pystan.StanModel
- fit(data, drift_priors=None, threshold_priors=None, ndt_priors=None, rel_sp_priors=None, starting_point=0.5, drift_trialmu_priors=None, drift_trialsd_priors=None, rel_sp_trialmu_priors=None, rel_sp_trialsd_priors=None, corr_matrix_prior=None, beta_trialmu_priors=None, beta_trialsd_priors=None, regression_coefficients_priors=None, include_rhat=True, include_waic=True, include_last_values=True, pointwise_waic=False, print_diagnostics=True, **kwargs)
Fits the specified diffusion decision model to data.
- Parameters
data (DataFrame) –
A pandas DataFrame containing data observations.
Columns should include:
rt, response times in seconds.
accuracy, 0 if the incorrect option was chosen, 1 if the correct option was chosen.
If the model is hierarchical, also include:
participant, the participant number. Should be integers starting from 1.
When either drift_starting_point_correlation, drift_starting_point_beta_correlation, or drift_starting_point_regression are True, also include:
beta, the external variable to correlate/regress to drift and rel_sp.
starting_point (float, default .5) – The relative starting point of the diffusion process. By default there is no bias, so the starting point is .5. Should be between 0 and 1.
drift_priors (dict, optional) – Priors for the drift-rate parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
threshold_priors (dict, optional) – Priors for the threshold parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
ndt_priors (dict, optional) – Priors for the non decision time parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
rel_sp_priors (dict, optional) – Priors for the relative starting point parameter (only meaningful if starting_point_bias is True). In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
drift_trialmu_priors (dict, optional) – Priors for the mean drift-rate across trials (only meaningful if drift_variability is True). In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
drift_trialsd_priors (dict, optional) – Priors for the standard deviation of the drift-rate across trials (only meaningful if drift_variability is True). In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
rel_sp_trialmu_priors (dict, optional) – Priors for the standard deviation of the relative starting point across trials (only meaningful if starting_point_variability is True). In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
rel_sp_trialsd_priors (dict, optional) – Priors for the standard deviation of the relative starting point across trials (only meaningful if starting_point_variability is True). In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
corr_matrix_prior (float, default to 1) – Prior for the eta parameter of the LKJ prior of the correlation matrix (only meaningful if drift_starting_point_correlation is True).
beta_trialmu_priors (dict, optional) – Priors for the mean beta across trials (only meaningful if drift_starting_point_beta_correlation is True). Mean and standard deviation of the prior distr.
beta_trialsd_priors (dict, optional) – Priors for the standard deviation of the beta across trials (only meaningful if drift_starting_point_beta_correlation is True). Mean and standard deviation of the prior distr.
regression_coefficients_priors (dict, optional) – Priors for the regression coefficients (only relevant if drift_starting_point_regression is True). Mean and standard deviation of the prior distr.
include_rhat (bool, default True) – Whether to calculate the Gelman-Rubin convergence diagnostic r hat (Gelman & Rubin, 1992).
include_waic (bool, default True) – Whether to calculate the widely applicable information criterion (WAIC; Watanabe, 2013).
pointwise_waic (bool, default False) – Whether to also inclue the pointwise WAIC. Only relevant if include_waic is True.
include_last_values (bool, default True) – Whether to extract the last values for each chain.
print_diagnostics (bool, default True) – Whether to print mcmc diagnostics after fitting. It is advised to leave it to True and always check, on top of the r hat.
**kwargs – Additional arguments to pystan.StanModel.sampling().
- Returns
res
- Return type
rlssm.fits.DDModelResults
Reinforcement learning diffusion decision models
- class rlssm.RLDDModel(hierarchical_levels, nonlinear_mapping=False, separate_learning_rates=False, threshold_modulation=False)
RLDDModel allows to specify a combination of reinforcement learning and diffusion decision models.
When initializing the model, you should specify whether the model is hierarchical or not. Additionally, you can specify the mechanisms that you wish to include or exclude.
The underlying stan model will be compiled if no previously compiled model is found. After initializing the model, it can be fitted to a particular dataset using pystan.
- __init__(hierarchical_levels, nonlinear_mapping=False, separate_learning_rates=False, threshold_modulation=False)
Initialize a RLDDModel object.
Note
This model is restricted to two options per trial (coded as correct and incorrect). However, more than two options can be presented in the same learning session.
- Parameters
hierarchical_levels (int) – Set to 1 for individual data and to 2 for grouped data.
nonlinear_mapping (bool, default False) – By default, the mapping between value differences and drift-rate is linear. If set to True, a non-linear mapping function is estimated.
separate_learning_rates (bool, default False) – By default, there is only one learning rate. If set to True, separate learning rates are estimated for positive and negative prediction errors.
threshold_modulation (bool, default False) – By default, the threshold is independent on the presented options. If set to True, the threshold can decrease or increase depending on the average value of the presented options.
- model_label
The label of the fully specified model.
- Type
str
- n_parameters_individual
The number of individual parameters of the fully specified model.
- Type
int
- n_parameters_trial
The number of parameters that are estimated at a trial level.
- Type
int
- stan_model_path
The location of the stan model code.
- Type
str
- compiled_model
The compiled stan model.
- Type
pystan.StanModel
- fit(data, K, initial_value_learning, alpha_priors=None, drift_scaling_priors=None, threshold_priors=None, ndt_priors=None, drift_asymptote_priors=None, threshold_modulation_priors=None, alpha_pos_priors=None, alpha_neg_priors=None, include_rhat=True, include_waic=True, pointwise_waic=False, include_last_values=True, print_diagnostics=True, **kwargs)
Fits the specified reinforcement learning diffusion decision model to data.
- Parameters
data (DataFrame) –
A pandas DataFrame containing data observations.
Columns should include (it’s OK if some of them are column indexes too):
trial_block, the number of trial in a learning session. Should be integers starting from 1.
f_cor, the output from the correct option in the presented pair (the option with higher outcome on average).
f_inc, the output from the incorrect option in the presented pair (the option with lower outcome on average).
cor_option, the number identifying the correct option in the presented pair (the option with higher outcome on average).
inc_option, the number identifying the incorrect option in the presented pair (the option with lower outcome on average).
block_label, the number identifying the learning session. Should be integers starting from 1. Set to 1 in case there is only one learning session.
rt, response times in seconds.
accuracy, 0 if the incorrect option was chosen, 1 if the correct option was chosen.
If the model is hierarchical, also include:
participant, the participant number. Should be integers starting from 1.
K (int) – Number of options per learning session.
initial_value_learning (float) – The assumed value expectation in the first learning session. The learning value in the following learning sessions is set to the average learned value in the previous learning session.
alpha_priors (dict, optional) – Priors for the learning rate parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
drift_scaling_priors (dict, optional) – Priors for the drift scaling parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
threshold_priors (dict, optional) – Priors for the threshold parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
ndt_priors (dict, optional) – Priors for the non decision time parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
drift_asymptote_priors (dict, optional) – Priors for the drift-rate asymptote (only meaningful if nonlinear_mapping is True). In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
threshold_modulation_priors (dict, optional) – Priors for the threshold coefficient (only meaningful if threshold_modulation is True). In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
alpha_pos_priors (dict, optional) – Priors for the learning rate for the positive PE (only meaningful if separate_learning_rates is True). In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
alpha_neg_priors (dict, optional) – Priors for the learning rate for the negative PE (only meaningful if separate_learning_rates is True). In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
include_rhat (bool, default True) – Whether to calculate the Gelman-Rubin convergence diagnostic r hat (Gelman & Rubin, 1992).
include_waic (bool, default True) – Whether to calculate the widely applicable information criterion (WAIC; Watanabe, 2013).
pointwise_waic (bool, default False) – Whether to also inclue the pointwise WAIC. Only relevant if include_waic is True.
include_last_values (bool, default True) – Whether to extract the last values for each chain.
print_diagnostics (bool, default True) – Whether to print mcmc diagnostics after fitting. It is advised to leave it to True and always check, on top of the r hat.
**kwargs – Additional arguments to pystan.StanModel.sampling().
- Returns
res
- Return type
rlssm.fits.DDModelResults
Race models (for 2 alternatives)
- class rlssm.RDModel_2A(hierarchical_levels)
RDModel_2A allows to specify a race diffusion model for 2 alternatives.
When initializing the model, you should specify whether the model is hierarchical or not.
The underlying stan model will be compiled if no previously compiled model is found. After initializing the model, it can be fitted to a particular dataset using pystan.
- __init__(hierarchical_levels)
Initialize a RDModel_2A object.
Note
This model is restricted to two options per trial (coded as correct and incorrect).
- Parameters
hierarchical_levels (int) – Set to 1 for individual data and to 2 for grouped data.
- model_label
The label of the fully specified model.
- Type
str
- n_parameters_individual
The number of individual parameters of the fully specified model.
- Type
int
- n_parameters_trial
The number of parameters that are estimated at a trial level.
- Type
int
- stan_model_path
The location of the stan model code.
- Type
str
- compiled_model
The compiled stan model.
- Type
pystan.StanModel
- fit(data, threshold_priors=None, ndt_priors=None, drift_priors=None, include_rhat=True, include_waic=True, pointwise_waic=False, include_last_values=True, print_diagnostics=True, **kwargs)
Fits the specified diffusion decision model to data.
- Parameters
data (DataFrame) –
A pandas DataFrame containing data observations.
Columns should include:
rt, response times in seconds.
accuracy, 0 if the incorrect option was chosen, 1 if the correct option was chosen.
If the model is hierarchical, also include:
participant, the participant number. Should be integers starting from 1.
starting_point (float, default .5) – The relative starting point of the diffusion process. By default there is no bias, so the starting point is .5. Should be between 0 and 1.
threshold_priors (dict, optional) – Priors for the threshold parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
ndt_priors (dict, optional) – Priors for the non decision time parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
drift_priors (dict, optional) – Priors for the drift-rate parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
include_rhat (bool, default True) – Whether to calculate the Gelman-Rubin convergence diagnostic r hat (Gelman & Rubin, 1992).
include_waic (bool, default True) – Whether to calculate the widely applicable information criterion (WAIC; Watanabe, 2013).
pointwise_waic (bool, default False) – Whether to also inclue the pointwise WAIC. Only relevant if include_waic is True.
include_last_values (bool, default True) – Whether to extract the last values for each chain.
print_diagnostics (bool, default True) – Whether to print mcmc diagnostics after fitting. It is advised to leave it to True and always check, on top of the r hat.
**kwargs – Additional arguments to pystan.StanModel.sampling().
- Returns
res
- Return type
rlssm.fits.DDModelResults
- class rlssm.LBAModel_2A(hierarchical_levels)
LBAModel_2A allows to specify a linear ballistic accumulator model for 2 alternatives.
When initializing the model, you should specify whether the model is hierarchical or not.
The underlying stan model will be compiled if no previously compiled model is found. After initializing the model, it can be fitted to a particular dataset using pystan.
- __init__(hierarchical_levels)
Initialize a LBAModel_2A object.
Note
This model is restricted to two options per trial (coded as correct and incorrect).
- Parameters
hierarchical_levels (int) – Set to 1 for individual data and to 2 for grouped data.
- model_label
The label of the fully specified model.
- Type
str
- n_parameters_individual
The number of individual parameters of the fully specified model.
- Type
int
- n_parameters_trial
The number of parameters that are estimated at a trial level.
- Type
int
- stan_model_path
The location of the stan model code.
- Type
str
- compiled_model
The compiled stan model.
- Type
pystan.StanModel
- fit(data, k_priors=None, A_priors=None, tau_priors=None, drift_priors=None, include_rhat=True, include_waic=True, pointwise_waic=False, include_last_values=True, print_diagnostics=True, **kwargs)
Fits the specified diffusion decision model to data.
- Parameters
data (DataFrame) –
A pandas DataFrame containing data observations.
Columns should include:
rt, response times in seconds.
accuracy, 0 if the incorrect option was chosen, 1 if the correct option was chosen.
If the model is hierarchical, also include:
participant, the participant number. Should be integers starting from 1.
starting_point (float, default .5) – The relative starting point of the diffusion process. By default there is no bias, so the starting point is .5. Should be between 0 and 1.
k_priors (dict, optional) – Priors for the k parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
A_priors (dict, optional) – Priors for the A parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
tau_priors (dict, optional) – Priors for the non decision time parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
drift_priors (dict, optional) – Priors for the drift-rate parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
include_rhat (bool, default True) – Whether to calculate the Gelman-Rubin convergence diagnostic r hat (Gelman & Rubin, 1992).
include_waic (bool, default True) – Whether to calculate the widely applicable information criterion (WAIC; Watanabe, 2013).
pointwise_waic (bool, default False) – Whether to also inclue the pointwise WAIC. Only relevant if include_waic is True.
include_last_values (bool, default True) – Whether to extract the last values for each chain.
print_diagnostics (bool, default True) – Whether to print mcmc diagnostics after fitting. It is advised to leave it to True and always check, on top of the r hat.
**kwargs – Additional arguments to pystan.StanModel.sampling().
- Returns
res
- Return type
rlssm.fits.DDModelResults
- class rlssm.ARDModel_2A(hierarchical_levels)
ARDModel_2A allows to specify a advantage race diffusion model for 2 alternatives.
When initializing the model, you should specify whether the model is hierarchical or not.
The underlying stan model will be compiled if no previously compiled model is found. After initializing the model, it can be fitted to a particular dataset using pystan.
- __init__(hierarchical_levels)
Initialize a ARDModel_2A object.
Note
This model is restricted to two options per trial (coded as correct and incorrect).
- Parameters
hierarchical_levels (int) – Set to 1 for individual data and to 2 for grouped data.
- model_label
The label of the fully specified model.
- Type
str
- n_parameters_individual
The number of individual parameters of the fully specified model.
- Type
int
- n_parameters_trial
The number of parameters that are estimated at a trial level.
- Type
int
- stan_model_path
The location of the stan model code.
- Type
str
- compiled_model
The compiled stan model.
- Type
pystan.StanModel
- fit(data, threshold_priors=None, ndt_priors=None, v0_priors=None, ws_priors=None, wd_priors=None, include_rhat=True, include_waic=True, pointwise_waic=False, include_last_values=True, print_diagnostics=True, **kwargs)
Fits the specified diffusion decision model to data.
- Parameters
data (DataFrame) –
A pandas DataFrame containing data observations.
Columns should include:
rt, response times in seconds.
accuracy, 0 if the incorrect option was chosen, 1 if the correct option was chosen.
If the model is hierarchical, also include:
participant, the participant number. Should be integers starting from 1.
starting_point (float, default .5) – The relative starting point of the diffusion process. By default there is no bias, so the starting point is .5. Should be between 0 and 1.
threshold_priors (dict, optional) – Priors for the threshold parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
ndt_priors (dict, optional) – Priors for the non decision time parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
v0_priors (dict, optional) – Priors for the v0 parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
ws_priors (dict, optional) – Priors for the ws parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
wd_priors (dict, optional) – Priors for the wd parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
include_rhat (bool, default True) – Whether to calculate the Gelman-Rubin convergence diagnostic r hat (Gelman & Rubin, 1992).
include_waic (bool, default True) – Whether to calculate the widely applicable information criterion (WAIC; Watanabe, 2013).
pointwise_waic (bool, default False) – Whether to also inclue the pointwise WAIC. Only relevant if include_waic is True.
include_last_values (bool, default True) – Whether to extract the last values for each chain.
print_diagnostics (bool, default True) – Whether to print mcmc diagnostics after fitting. It is advised to leave it to True and always check, on top of the r hat.
**kwargs – Additional arguments to pystan.StanModel.sampling().
- Returns
res
- Return type
rlssm.fits.DDModelResults
- class rlssm.ALBAModel_2A(hierarchical_levels)
ALBAModel_2A allows to specify a advantage linear ballistic accumulator model for 2 alternatives.
When initializing the model, you should specify whether the model is hierarchical or not.
The underlying stan model will be compiled if no previously compiled model is found. After initializing the model, it can be fitted to a particular dataset using pystan.
- __init__(hierarchical_levels)
Initialize a ALBAModel_2A object.
Note
This model is restricted to two options per trial (coded as correct and incorrect).
- Parameters
hierarchical_levels (int) – Set to 1 for individual data and to 2 for grouped data.
- model_label
The label of the fully specified model.
- Type
str
- n_parameters_individual
The number of individual parameters of the fully specified model.
- Type
int
- n_parameters_trial
The number of parameters that are estimated at a trial level.
- Type
int
- stan_model_path
The location of the stan model code.
- Type
str
- compiled_model
The compiled stan model.
- Type
pystan.StanModel
- fit(data, k_priors=None, A_priors=None, tau_priors=None, v0_priors=None, ws_priors=None, wd_priors=None, include_rhat=True, include_waic=True, pointwise_waic=False, include_last_values=True, print_diagnostics=True, **kwargs)
Fits the specified diffusion decision model to data.
- Parameters
data (DataFrame) –
A pandas DataFrame containing data observations.
Columns should include:
rt, response times in seconds.
accuracy, 0 if the incorrect option was chosen, 1 if the correct option was chosen.
If the model is hierarchical, also include:
participant, the participant number. Should be integers starting from 1.
starting_point (float, default .5) – The relative starting point of the diffusion process. By default there is no bias, so the starting point is .5. Should be between 0 and 1.
k_priors (dict, optional) – Priors for the k parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
A_priors (dict, optional) – Priors for the A parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
tau_priors (dict, optional) – Priors for the non decision time parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
v0_priors (dict, optional) – Priors for the v0 parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
ws_priors (dict, optional) – Priors for the ws parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
wd_priors (dict, optional) – Priors for the wd parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
include_rhat (bool, default True) – Whether to calculate the Gelman-Rubin convergence diagnostic r hat (Gelman & Rubin, 1992).
include_waic (bool, default True) – Whether to calculate the widely applicable information criterion (WAIC; Watanabe, 2013).
pointwise_waic (bool, default False) – Whether to also inclue the pointwise WAIC. Only relevant if include_waic is True.
include_last_values (bool, default True) – Whether to extract the last values for each chain.
print_diagnostics (bool, default True) – Whether to print mcmc diagnostics after fitting. It is advised to leave it to True and always check, on top of the r hat.
**kwargs – Additional arguments to pystan.StanModel.sampling().
- Returns
res
- Return type
rlssm.fits.DDModelResults
Reinforcement learning race models (for 2 alternatives)
- class rlssm.RLRDModel_2A(hierarchical_levels, separate_learning_rates=False, nonlinear_mapping=False)
RLRDModel_2A allows to specify a combination of reinforcement learning and race diffusion decision models.
When initializing the model, you should specify whether the model is hierarchical or not. Additionally, you can specify the mechanisms that you wish to include or exclude.
The underlying stan model will be compiled if no previously compiled model is found. After initializing the model, it can be fitted to a particular dataset using pystan.
- __init__(hierarchical_levels, separate_learning_rates=False, nonlinear_mapping=False)
Initialize a RLRDModel_2A object.
Note
This model is restricted to two options per trial (coded as correct and incorrect). However, more than two options can be presented in the same learning session.
- Parameters
hierarchical_levels (int) – Set to 1 for individual data and to 2 for grouped data.
separate_learning_rates (bool, default False) – By default, there is only one learning rate. If set to True, separate learning rates are estimated for positive and negative prediction errors.
nonlinear_mapping (bool, default False) – By default, the mapping between value differences and drift-rate is linear. If set to True, a non-linear mapping function is estimated.
- model_label
The label of the fully specified model.
- Type
str
- n_parameters_individual
The number of individual parameters of the fully specified model.
- Type
int
- n_parameters_trial
The number of parameters that are estimated at a trial level.
- Type
int
- stan_model_path
The location of the stan model code.
- Type
str
- compiled_model
The compiled stan model.
- Type
pystan.StanModel
- fit(data, K, initial_value_learning, alpha_priors=None, drift_scaling_priors=None, threshold_priors=None, ndt_priors=None, utility_priors=None, alpha_pos_priors=None, alpha_neg_priors=None, include_rhat=True, include_waic=True, pointwise_waic=False, include_last_values=True, print_diagnostics=True, **kwargs)
Fits the specified reinforcement learning diffusion decision model to data.
- Parameters
data (DataFrame) –
A pandas DataFrame containing data observations.
Columns should include (it’s OK if some of them are column indexes too):
trial_block, the number of trial in a learning session. Should be integers starting from 1.
f_cor, the output from the correct option in the presented pair (the option with higher outcome on average).
f_inc, the output from the incorrect option in the presented pair (the option with lower outcome on average).
cor_option, the number identifying the correct option in the presented pair (the option with higher outcome on average).
inc_option, the number identifying the incorrect option in the presented pair (the option with lower outcome on average).
block_label, the number identifying the learning session. Should be integers starting from 1. Set to 1 in case there is only one learning session.
rt, response times in seconds.
accuracy, 0 if the incorrect option was chosen, 1 if the correct option was chosen.
If the model is hierarchical, also include:
participant, the participant number. Should be integers starting from 1.
K (int) – Number of options per learning session.
initial_value_learning (float) – The assumed value expectation in the first learning session. The learning value in the following learning sessions is set to the average learned value in the previous learning session.
alpha_priors (dict, optional) – Priors for the learning rate parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
drift_scaling_priors (dict, optional) – Priors for the drift scaling parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
threshold_priors (dict, optional) – Priors for the threshold parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
ndt_priors (dict, optional) – Priors for the non decision time parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
utility_priors (dict, optional) – Priors for the utility time parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
alpha_pos_priors (dict, optional) – Priors for the learning rate for the positive PE (only meaningful if separate_learning_rates is True). In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
alpha_neg_priors (dict, optional) – Priors for the learning rate for the negative PE (only meaningful if separate_learning_rates is True). In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
include_rhat (bool, default True) – Whether to calculate the Gelman-Rubin convergence diagnostic r hat (Gelman & Rubin, 1992).
include_waic (bool, default True) – Whether to calculate the widely applicable information criterion (WAIC; Watanabe, 2013).
pointwise_waic (bool, default False) – Whether to also inclue the pointwise WAIC. Only relevant if include_waic is True.
include_last_values (bool, default True) – Whether to extract the last values for each chain.
print_diagnostics (bool, default True) – Whether to print mcmc diagnostics after fitting. It is advised to leave it to True and always check, on top of the r hat.
**kwargs – Additional arguments to pystan.StanModel.sampling().
- Returns
res
- Return type
rlssm.fits.DDModelResults
- class rlssm.RLLBAModel_2A(hierarchical_levels, separate_learning_rates=False, nonlinear_mapping=False)
RLLBAModel_2A allows to specify a combination of reinforcement learning and linear ballistic accumulator models.
When initializing the model, you should specify whether the model is hierarchical or not. Additionally, you can specify the mechanisms that you wish to include or exclude.
The underlying stan model will be compiled if no previously compiled model is found. After initializing the model, it can be fitted to a particular dataset using pystan.
- __init__(hierarchical_levels, separate_learning_rates=False, nonlinear_mapping=False)
Initialize a RLLBAModel_2A object.
Note
This model is restricted to two options per trial (coded as correct and incorrect). However, more than two options can be presented in the same learning session.
- Parameters
hierarchical_levels (int) – Set to 1 for individual data and to 2 for grouped data.
separate_learning_rates (bool, default False) – By default, there is only one learning rate. If set to True, separate learning rates are estimated for positive and negative prediction errors.
nonlinear_mapping (bool, default False) – By default, the mapping between value differences and drift-rate is linear. If set to True, a non-linear mapping function is estimated.
- model_label
The label of the fully specified model.
- Type
str
- n_parameters_individual
The number of individual parameters of the fully specified model.
- Type
int
- n_parameters_trial
The number of parameters that are estimated at a trial level.
- Type
int
- stan_model_path
The location of the stan model code.
- Type
str
- compiled_model
The compiled stan model.
- Type
pystan.StanModel
- fit(data, K, initial_value_learning, k_priors=None, A_priors=None, tau_priors=None, utility_priors=None, alpha_priors=None, drift_scaling_priors=None, alpha_pos_priors=None, alpha_neg_priors=None, include_rhat=True, include_waic=True, pointwise_waic=False, include_last_values=True, print_diagnostics=True, **kwargs)
Fits the specified reinforcement learning diffusion decision model to data.
- Parameters
data (DataFrame) –
A pandas DataFrame containing data observations.
Columns should include (it’s OK if some of them are column indexes too):
trial_block, the number of trial in a learning session. Should be integers starting from 1.
f_cor, the output from the correct option in the presented pair (the option with higher outcome on average).
f_inc, the output from the incorrect option in the presented pair (the option with lower outcome on average).
cor_option, the number identifying the correct option in the presented pair (the option with higher outcome on average).
inc_option, the number identifying the incorrect option in the presented pair (the option with lower outcome on average).
block_label, the number identifying the learning session. Should be integers starting from 1. Set to 1 in case there is only one learning session.
rt, response times in seconds.
accuracy, 0 if the incorrect option was chosen, 1 if the correct option was chosen.
If the model is hierarchical, also include:
participant, the participant number. Should be integers starting from 1.
K (int) – Number of options per learning session.
initial_value_learning (float) – The assumed value expectation in the first learning session. The learning value in the following learning sessions is set to the average learned value in the previous learning session.
alpha_priors (dict, optional) – Priors for the learning rate parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
drift_scaling_priors (dict, optional) – Priors for the drift scaling parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
k_priors (dict, optional) – Priors for the k parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
A_priors (dict, optional) – Priors for the A parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
tau_priors (dict, optional) – Priors for the tau parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
utility_priors (dict, optional) – Priors for the utility time parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
alpha_pos_priors (dict, optional) – Priors for the learning rate for the positive PE (only meaningful if separate_learning_rates is True). In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
alpha_neg_priors (dict, optional) – Priors for the learning rate for the negative PE (only meaningful if separate_learning_rates is True). In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
include_rhat (bool, default True) – Whether to calculate the Gelman-Rubin convergence diagnostic r hat (Gelman & Rubin, 1992).
include_waic (bool, default True) – Whether to calculate the widely applicable information criterion (WAIC; Watanabe, 2013).
pointwise_waic (bool, default False) – Whether to also inclue the pointwise WAIC. Only relevant if include_waic is True.
include_last_values (bool, default True) – Whether to extract the last values for each chain.
print_diagnostics (bool, default True) – Whether to print mcmc diagnostics after fitting. It is advised to leave it to True and always check, on top of the r hat.
**kwargs – Additional arguments to pystan.StanModel.sampling().
- Returns
res
- Return type
rlssm.fits.DDModelResults
- class rlssm.RLARDModel_2A(hierarchical_levels, separate_learning_rates=False)
RLARDModel_2A allows to specify a combination of reinforcement learning and advantage race diffusion decision models.
When initializing the model, you should specify whether the model is hierarchical or not. Additionally, you can specify the mechanisms that you wish to include or exclude.
The underlying stan model will be compiled if no previously compiled model is found. After initializing the model, it can be fitted to a particular dataset using pystan.
- __init__(hierarchical_levels, separate_learning_rates=False)
Initialize a RLARDModel_2A object.
Note
This model is restricted to two options per trial (coded as correct and incorrect). However, more than two options can be presented in the same learning session.
- Parameters
hierarchical_levels (int) – Set to 1 for individual data and to 2 for grouped data.
separate_learning_rates (bool, default False) – By default, there is only one learning rate. If set to True, separate learning rates are estimated for positive and negative prediction errors.
- model_label
The label of the fully specified model.
- Type
str
- n_parameters_individual
The number of individual parameters of the fully specified model.
- Type
int
- n_parameters_trial
The number of parameters that are estimated at a trial level.
- Type
int
- stan_model_path
The location of the stan model code.
- Type
str
- compiled_model
The compiled stan model.
- Type
pystan.StanModel
- fit(data, K, initial_value_learning, threshold_priors=None, ndt_priors=None, v0_priors=None, ws_priors=None, wd_priors=None, alpha_priors=None, alpha_pos_priors=None, alpha_neg_priors=None, include_rhat=True, include_waic=True, pointwise_waic=False, include_last_values=True, print_diagnostics=True, **kwargs)
Fits the specified reinforcement learning diffusion decision model to data.
- Parameters
data (DataFrame) –
A pandas DataFrame containing data observations.
Columns should include (it’s OK if some of them are column indexes too):
trial_block, the number of trial in a learning session. Should be integers starting from 1.
f_cor, the output from the correct option in the presented pair (the option with higher outcome on average).
f_inc, the output from the incorrect option in the presented pair (the option with lower outcome on average).
cor_option, the number identifying the correct option in the presented pair (the option with higher outcome on average).
inc_option, the number identifying the incorrect option in the presented pair (the option with lower outcome on average).
block_label, the number identifying the learning session. Should be integers starting from 1. Set to 1 in case there is only one learning session.
rt, response times in seconds.
accuracy, 0 if the incorrect option was chosen, 1 if the correct option was chosen.
If the model is hierarchical, also include:
participant, the participant number. Should be integers starting from 1.
K (int) – Number of options per learning session.
initial_value_learning (float) – The assumed value expectation in the first learning session. The learning value in the following learning sessions is set to the average learned value in the previous learning session.
threshold_priors (dict, optional) – Priors for the threshold parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
alpha_priors (dict, optional) – Priors for the learning rate parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
v0_priors (dict, optional) – Priors for the v0 parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
ws_priors (dict, optional) – Priors for the ws parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
wd_priors (dict, optional) – Priors for the wd parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
ndt_priors (dict, optional) – Priors for the non decision time parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
alpha_pos_priors (dict, optional) – Priors for the learning rate for the positive PE (only meaningful if separate_learning_rates is True). In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
alpha_neg_priors (dict, optional) – Priors for the learning rate for the negative PE (only meaningful if separate_learning_rates is True). In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
include_rhat (bool, default True) – Whether to calculate the Gelman-Rubin convergence diagnostic r hat (Gelman & Rubin, 1992).
include_waic (bool, default True) – Whether to calculate the widely applicable information criterion (WAIC; Watanabe, 2013).
pointwise_waic (bool, default False) – Whether to also inclue the pointwise WAIC. Only relevant if include_waic is True.
include_last_values (bool, default True) – Whether to extract the last values for each chain.
print_diagnostics (bool, default True) – Whether to print mcmc diagnostics after fitting. It is advised to leave it to True and always check, on top of the r hat.
**kwargs – Additional arguments to pystan.StanModel.sampling().
- Returns
res
- Return type
rlssm.fits.DDModelResults
- class rlssm.RLALBAModel_2A(hierarchical_levels, separate_learning_rates=False)
RLALBAModel_2A allows to specify a combination of reinforcement learning and advantage linear ballistic accumulator models.
When initializing the model, you should specify whether the model is hierarchical or not. Additionally, you can specify the mechanisms that you wish to include or exclude.
The underlying stan model will be compiled if no previously compiled model is found. After initializing the model, it can be fitted to a particular dataset using pystan.
- __init__(hierarchical_levels, separate_learning_rates=False)
Initialize a RLALBAModel_2A object.
Note
This model is restricted to two options per trial (coded as correct and incorrect). However, more than two options can be presented in the same learning session.
- Parameters
hierarchical_levels (int) – Set to 1 for individual data and to 2 for grouped data.
separate_learning_rates (bool, default False) – By default, there is only one learning rate. If set to True, separate learning rates are estimated for positive and negative prediction errors.
- model_label
The label of the fully specified model.
- Type
str
- n_parameters_individual
The number of individual parameters of the fully specified model.
- Type
int
- n_parameters_trial
The number of parameters that are estimated at a trial level.
- Type
int
- stan_model_path
The location of the stan model code.
- Type
str
- compiled_model
The compiled stan model.
- Type
pystan.StanModel
- fit(data, K, initial_value_learning, k_priors=None, A_priors=None, tau_priors=None, v0_priors=None, ws_priors=None, wd_priors=None, alpha_priors=None, alpha_pos_priors=None, alpha_neg_priors=None, include_rhat=True, include_waic=True, pointwise_waic=False, include_last_values=True, print_diagnostics=True, **kwargs)
Fits the specified reinforcement learning diffusion decision model to data.
- Parameters
data (DataFrame) –
A pandas DataFrame containing data observations.
Columns should include (it’s OK if some of them are column indexes too):
trial_block, the number of trial in a learning session. Should be integers starting from 1.
f_cor, the output from the correct option in the presented pair (the option with higher outcome on average).
f_inc, the output from the incorrect option in the presented pair (the option with lower outcome on average).
cor_option, the number identifying the correct option in the presented pair (the option with higher outcome on average).
inc_option, the number identifying the incorrect option in the presented pair (the option with lower outcome on average).
block_label, the number identifying the learning session. Should be integers starting from 1. Set to 1 in case there is only one learning session.
rt, response times in seconds.
accuracy, 0 if the incorrect option was chosen, 1 if the correct option was chosen.
If the model is hierarchical, also include:
participant, the participant number. Should be integers starting from 1.
K (int) – Number of options per learning session.
initial_value_learning (float) – The assumed value expectation in the first learning session. The learning value in the following learning sessions is set to the average learned value in the previous learning session.
k_priors (dict, optional) – Priors for the k parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
A_priors (dict, optional) – Priors for the A parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
tau_priors (dict, optional) – Priors for the tau parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
alpha_priors (dict, optional) – Priors for the learning rate parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
v0_priors (dict, optional) – Priors for the v0 parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
ws_priors (dict, optional) – Priors for the ws parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
wd_priors (dict, optional) – Priors for the wd parameter. In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
alpha_pos_priors (dict, optional) – Priors for the learning rate for the positive PE (only meaningful if separate_learning_rates is True). In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
alpha_neg_priors (dict, optional) – Priors for the learning rate for the negative PE (only meaningful if separate_learning_rates is True). In case it is not a hierarchical model: Mean and standard deviation of the prior distr. In case it is a hierarchical model: Means and standard deviations of the hyper priors.
include_rhat (bool, default True) – Whether to calculate the Gelman-Rubin convergence diagnostic r hat (Gelman & Rubin, 1992).
include_waic (bool, default True) – Whether to calculate the widely applicable information criterion (WAIC; Watanabe, 2013).
pointwise_waic (bool, default False) – Whether to also inclue the pointwise WAIC. Only relevant if include_waic is True.
include_last_values (bool, default True) – Whether to extract the last values for each chain.
print_diagnostics (bool, default True) – Whether to print mcmc diagnostics after fitting. It is advised to leave it to True and always check, on top of the r hat.
**kwargs – Additional arguments to pystan.StanModel.sampling().
- Returns
res
- Return type
rlssm.fits.DDModelResults