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

Description Usage Arguments Details Value References Examples

View source: R/create_dfd_list.R

Description

Create a list of tables that are then later displayed. The values, i.e. outcome and probabilities etc. must be specified and given as input. For each gamble a still incomplete html table is created to later be completed and displayed by multiOptsDfdPage (It's incomplete because some parameters need to be specified later on).

Usage

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

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.

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.

outcomeCurrency

string. The currency that should be displayed after the outcome values (e.g. "$"). If not specified only the numbers will be displayed.

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 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
dfdContainer <- createDfdList(defaultGambles = TRUE,
                              fileName = "HertwigBarronWeberErev",
                              withPracticeTrial = TRUE)
dfdContainer

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