stayProbPlot: Plot the Stay Probability

Description Usage Arguments Details Value

View source: R/plots.R

Description

This function graphs an agent's probability of choosing the same action in State FC based on the prior trial's transition type (common or rare) as well as whether the last trial was rewarded. This "stay probability" is calculated according to a logistic regression model, predicting on the data from which it was fit. This function checks whether the data has been pre-modeled, meaning the logistic regression probabilities have already been calculated. If so, this function just plots the probabilities. If not, this function calls logSetup, getLogFit, getLogPreds, and then plots the data.

Usage

1
stayProbPlot(data, preModeled, dataType, x = NULL, alpha = TRUE, gamma = TRUE)

Arguments

data

The output of generateData. Data can be passed through manipulateData first for model-free simulations, though that is unnecessary. However, simulated data should be processed. Data can also be passed through getLogPreds, though this is also unnecessary (see parameter preModeled).

preModeled

Logical: TRUE if the data has been passed through getLogPreds; FALSE otherwise.

dataType

Should be a character string. Either "MF" if the simulation was purely model-free (x = 0) or "MB" if the simulation had model-based influence (x > 0).

x

If the parameter dataType is "MB", please enter the x used in generating simulation data. This will add more information to the plot, though it is unnecessary.

alpha

Logical: TRUE means the plot will be faceted by the learning rate alpha; false otherwise. Default is TRUE.

gamma

Logical: TRUE means the plot will be faceted by the temporal discount rate gamma; false otherwise. Default is TRUE.

Details

Please indicate whether the data was "MF" or "MB" (see parameter dataType) for plot title purposes. The plot can be faceted by learning rates and temporal discount terms (see parameters alpha and gamma).

Value

A plot showing the stay probabilities for a given simulation/agent.


jdtrat/dynaq documentation built on July 24, 2020, 7:18 a.m.