createDfeList: Create a List of Prepared Values to Display Later in a...

Description Usage Arguments Details Value References Examples

View source: R/create_dfe_list.R

Description

Create a list of values drawn from the specified gambles that are then later displayed. The values, i.e. outcome and probabilities etc. must be specified and given as input. For each gamble a vector of length nDraws is created containing values of the outcomes drawn from sample with the in the list specified probabilities. These values can later be sampled by calling multiOptsDfePage that will set up the html logic.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
createDfeList(
  nOpts = NULL,
  nOutcs = NULL,
  loadFile = TRUE,
  fileName = "TwoOptExample",
  gambleList = NULL,
  sepFile = "\t",
  defaultGambles = FALSE,
  nDraws = 100,
  randomizeHorizontal = TRUE,
  randomizeVertical = TRUE,
  practiceTrial = NULL,
  withPracticeTrial = FALSE,
  practiceFileName = NULL
)

Arguments

nOpts

integer. The number of gambles to be presented in each trial. Currently all trials need to have the same number of options. If you have different number of options create two separate lists

nOutcs

integer. The maximum number of outcomes a gamble can have, i.e. if the list contains one 5 outcome gamble and the rest 2 outcome gambles then set this value to 5. Different number of outcomes in a gamble list are possible.

loadFile

logical. If TRUE (default) the list specifying the gambles will be loaded from a local file.

fileName

string. Either a name if a default list is used or a full directory to the file that should be read in. See details for currently available default lists.

gambleList

data.frame. Values specifying the gamble parameters. Only needed if loadFile is FALSE.

sepFile

string. The separator in the to be loaded file. Is passed to sep in read.table.

defaultGambles

logical. If TRUE (default is FALSE) one of the default lists is used.

nDraws

integer. Specifies the lenght of the vector containing the gamble outcomes. This is the maximum number of samples the participant can take. Set this to a large enough value from which you expect that it will not be reached (default is 100).

randomizeHorizontal

logical. If TRUE (default) options displayed in one trial are positioned in random order.

randomizeVertical

logical. If TRUE (default) trial order is randomized

practiceTrial

data.frame. Contains information for a practice trial. Is only needed if withPracticeTrial is TRUE and practiceFileName is NULL.

withPracticeTrial

logical. If TRUE (default is FALSE) a practice trial has to be provided and is included.

practiceFileName

string. Full path and file name of the file to load the practice trial info in

Details

Currently available default lists: "TwoOptExample", "ThreeOptExample","FourOptExample", "Birnbaum" mostly from Birnbaum (2008), "BrooksPetersZank" from Brooks, Peters and Zank (2014), "GloecknerPachur" a subset from Gloeckner and Pachur (2012), "HertwigBarronWeberErev" from Hertwig, Barron, Weber and Erev (2004), "LoomesMoffattSugden" from Loomes, Moffatt ans Sugden (2002) and "Rieskamp", from Rieskamp (2008).

Value

A list containing lists with the option order (horizontal order), outcomes, data frame containing the gamble parameters, number of draws from a gamble, number of options, number of outcomes and gamble order (vertical order).

References

Birnbaum, M. H. (2008). New paradoxes of risky decision making. Psychological review, 115(2), 463.

Brooks, P., Peters, S., & Zank, H. (2014). Risk behavior for gain, loss, and mixed prospects. Theory and decision, 77(2), 153-182.

Gloeckner, A., & Pachur, T. (2012). Cognitive models of risky choice: Parameter stability and predictive accuracy of prospect theory. Cognition, 123(1), 21-32.

Hertwig, R., Barron, G., Weber, E. U., & Erev, I. (2004). Decisions from experience and the effect of rare events in risky choice. Psychological science, 15(8), 534-539.

Loomes, G., Moffatt, P. G., & Sugden, R. (2002). A microeconometric test of alternative stochastic theories of risky choice. Journal of risk and Uncertainty, 24(2), 103-130.

Rieskamp, J. (2008). The probabilistic nature of preferential choice. Journal of Experimental Psychology: Learning, Memory, and Cognition, 34(6), 1446.

Examples

1
2
3
4
dfeContainer <- createDfeList(defaultGambles = TRUE,
                              fileName = "HertwigBarronWeberErev",
                              withPracticeTrial = TRUE)
dfeContainer

mdsteiner/ShinyPsych documentation built on Feb. 12, 2022, 2:09 p.m.