randomwalk: randomwalk_example

View source: R/randomwalk.R

randomwalkR Documentation

randomwalk_example

Description

This function generates random reward probabilities for the whole experiment

Usage

randomwalk(
  Narms = 2,
  Ntrials = 100,
  tau = 0.02,
  rho = 0,
  upper.bound = 0.85,
  lower.bound = 0.15,
  plot = TRUE,
  save_csv = TRUE
)

Arguments

Narms

Number of bandit arms, Default: 2

Ntrials

Number of trials, Default: 100

tau

Standard deviation for the noise normal distribution of each arm, Default: 0.02

rho

True correlation between all arms. default should be zero, Default: 0

upper.bound

Maximal limit of reward probability, Default: 0.85

lower.bound

Minimal limit of reward probability, Default: 0.15

plot

Whether to plot the bandits

save_csv

Whether to save the csv for your experiment

Details

The randomwalk function is responsible for generating the rewards in your experiment. Each arm has a different reward probability and it drifts along the experiment. The rational behind the drift is to maintain learning.

Value

Returns a matrix (Ntrials X Narms) showing the reward probabilities in each trial.

See Also

mvrnorm

Examples

## Not run: 
{
R=
randomwalk(Narms=4,
          Ntrials=50,
          tau            =.02,#standard deviation for the noise normal distribution of each arm
          rho            =0, #true correlation between all arms. default should be zero
          upper.bound   =0.85,
          lower.bound   =0.15)
#check correlations
cor(R)
 }

## End(Not run)

shahar-lab/RLR documentation built on March 2, 2024, 4:40 a.m.