Synthetic Data

class fitr.models.synthetic_data.SyntheticData

Object representing synthetic data

Attributes

data (dict) Dictionary containing data formatted for fitr’s model fitting tools (except MCMC via Stan)
data_mcmc (dict) Dictionary containing task data formatted for use with MCMC via Stan
params (ndarray(shape=(nsubjects X nparams))) Subject parameters
groupnames (list) Strings representing names of groups whose data are represented

Methods

append_group(self, data=SyntheticData)  
get_nparams(self) Returns the number of parameters in the data
get_nsubjects(self) Returns the number of subjects in the data
cumreward_param_plot(self, alpha=0.9) Plots the cumulative reward against model parameters. Useful to determine the relationship between reward acquisition and model parameters for a given task.
plot_cumreward(self) Plots the cumulative reward over time for each subject
append_group(data, which='all')

Appends data from other groups to the SyntheticData object

Parameters:

data : SyntheticData object

all : {‘all’, ‘opt’, ‘mcmc’}

Whether to append all data, optimization data only, or MCMC data

cumreward_param_plot(alpha=0.9, save_figure=False, filename='cumreward-param-plot-sim.pdf')

Plots parameter values against cumulative reward

Parameters:

save_figure : bool

Whether to save the figure to disk

filename : str

The name of the file to which to save the figure

get_nparams()

Finds the number of parameters in the model

Returns:int
get_nsubjects()

Finds the number of subjects in the data

Returns:int
plot_cumreward(save_figure=False, filename='cumreward-plot-sim.pdf')

Plots cumulative reward over time for each subject

Parameters:

save_figure : bool

Whether to save the figure to disk

filename : str

The name of the file to which to save the figure

fitr.models.synthetic_data.combine_groups(x, y)

Combines synthetic data objects for multiple groups

Parameters:

x : SyntheticData

Data for first simulated group

y : SyntheticData

Data for second simulated group

Returns:

SyntheticData

Combined groups