View source: R/rrwIdentifyReferenceDistributionSGS.r
rrwIdentifyReferenceDistributionSGS | R Documentation |
Function that takes raw choice data, raw values data, and the rrwModelList as input, and identifies the reference distributions using smartGridSearch, and outputs the smartGridSearch results.
rrwIdentifyReferenceDistributionSGS(
choiceData,
valueData,
rrwModelList,
refDistGenFn = rnorm,
item1cols,
item2cols,
respChoiceCol,
respChoiceVal,
RTcol,
chanceThreshold = 0,
lowRTquantileThreshold = 0,
highRTquantileThreshold = 0,
minOverlapN = 0,
pars.n = NULL,
equalizeRTandPhit = TRUE,
minimizeStat = "BIC",
roundThreshold = 0.1,
roundDirection = ceiling,
numOverlapBins = 10,
overlapNumRuns = 1000,
combFun = ch.maxAveComb,
useTwoParameterModel = FALSE,
onlyMinimizeOnPhvoFit = FALSE,
splitByRefDist = TRUE,
fitByRefDist = FALSE,
splitByCorrect = TRUE,
numLoops = 200,
numIntervals = 25,
optParamListN = 10,
optBoundLoops = 10,
multicore = FALSE,
multicorePackages = NULL,
fileTag = NULL,
...
)
rrwModelList |
A list that specifies the rrw model. Build the rrwModelList useing rrwAddEffectToRRWModel |
refDistGenFn |
A function to generate the observation for the reference distribution. This function must take the following arguments: n, mean, sd. DEFAULT = rnorm. |
item1cols |
a vector of strings that specifies the names of the columns in "df.choiceDat" that contains the the probes in Item 1. |
item2cols |
a vector of strings that specifies the names of the columns in "df.choiceDat" that contains the the probes in Item 2. |
respChoiceCol |
a string that specifies the name of the column in "df.choiceDat" that contains the the participant's response to the prompt - yes take action or no take no action. |
respChoiceVal |
a vector of two values that specifies the choose Item1 option ("yes" take action in many morals experimants, thus saving Item1) value (index 1) and the choose Item1 option ("no" take no action in many morals experimants, thus saving Item2) value (index 2). |
RTcol |
a string that specifies the name of the column in "df.choiceDat" that contains the RT for each trial. |
chanceThreshold |
A number specifying the quantile that all subjects whose p(HVO) falls below it will be removed from the dataset. DEFAULT = 0 (none removed) |
lowRTquantileThreshold |
A number specifying the quantile that, for each overlapRound, individual RTs that fall below it will be removed from the dataset. DEFAULT = 0.0 (none removed) |
highRTquantileThreshold |
A number specifying the quantile that, for each overlapRound, individual RTs that fall above it will be removed from the dataset. DEFAULT = 1.0 (none removed) |
minOverlapN |
A number specifying the minimum number of responses an overlapRound condition must have to remain in the dataset. DEFAULT = 0 (none removed) |
pars.n |
The number of free parameters. When NULL, the program will attempt to calculate the number of free parameters from the input. Default = 3. |
equalizeRTandPhit |
A boolean that specifies whether the influence of the pHit should be equal to that of rt. Influence is a function of the number of observations. RT has more observations than pHit because it has both correct RTs and incorrect RTs. If this is set to TRUE, then the influence of the pHit and RT is equalized in the minimization statistic. If it is set to FALSE, then the the minimazation statistic is calculated as usual. DEFAULT = FALSE. |
minimizeStat |
A string that specifies which statistic to minimize when optimizing the model fit. The options are: "BIC" , "AIC" , or "R_Square". Default is "BIC". |
roundThreshold |
An integer that specifies the nearest interval that the overlaps should be rounded to. DEFAULT = 0.1 (round to the nearest 0.1) |
roundDirection |
An option that specifies the rounding direction: ceiling (always round up), floor (always round down), or round (round to the nearest value, up or down). DEFAULT = ceiling |
numOverlapBins |
An integer that specifies the number of bins the overlaps should be binned into. This is only used if roundThreshold = NULL. DEFAULT = 10 (round overlaps so that there are 10 bins) |
overlapNumRuns |
the number of runs to do in the bootstrap that calculates the overlap of the reference distribution and the choice itms. DEFAULT = 1000. |
combFun |
If there are multiple items contributing to a single distribution, this function describes how the values will be combined across items in both the X and Y distributions. The function must combine elements of a list that might be of different different lengths. The default just flattens the list into one large vector. DEFAULT = ch.maxAveComb (with probMax = 0.5) |
useTwoParameterModel |
A boolean that specifies whether to use a two parameter p(HOV) model. If this is set to TRUE, then this function will fit a p(HVO) model whereby the rightmost point (overlap = 1.0) is not fixed at p(HVO) = 0.5. DEFAULT = FALSE. |
onlyMinimizeOnPhvoFit |
A boolean that specifies whether to minimize the function only on the fit of the p(HVO) data (if set to TRUE). If set to false, the function will be minimized on the basis of both the fit of the p(HVO) and RT data. DEFAULT = FALSE. |
splitByRefDist |
A boolean that specifies whether to group the dataset by those trial that are above the reference distribution and those that are below the reference distribution. DEFAULT = TRUE. |
fitByRefDist |
A boolean that specifies whether fit the p(HVO) and RT functions by the grouping created when splitByRefDist = TRUE. If splitByRefDist = FALSE, then this argument is irrelevant. Generally, you want splitByRefDist = TRUE and fitByRefDist = FALSE to find a reference distribution that fits an unbiased observer for a particular condition in your experiment and then see how your manipulations influence either another reference distribution or the response biases in the RRW. DEFAULT = FALSE. |
splitByCorrect |
A boolean that specifies whether to use the "correct/incorrect" column as a grouping variable for the RT data when fitting the RT function. When set to FALSE, the RT function will be fit to the collapsed correct and incorrect responses. DEFAULT = TRUE. |
numLoops |
An integer that specifies the number of loops with different parameter values to be searched in each run of the smartGridSearch before the best fits for that run are identified. DEFAULT = 200. |
numIntervals |
An integer that specifies the number of intervals that the range between the upper and lower bounds of each parameter space will be segmented into. DEFAULT = 25. |
optParamListN |
An integer that specifies the number of best fit runs that will be used to extract the new bounds for next set of grid search loops. So, if optParamListN == 10, then the parameter values from the 10 best runs will be used to refine the upper and lower bounds of for each parameter. DEFAULT = 10. |
optBoundLoops |
An integer that specifies the number of times to re-simulate the best fit run in order to get a mean and SD for the minimized fit statistic. If the mean fit statistic is no longer the best fit, the program will move to the next best fit run, and so on until the it identifies the best mean fit run. DEFAULT = 10. |
multicore |
An boolean that specifies whether the program should be run using multiple processing cores. DEFAULT = FALSE. |
multicorePackages |
An vector of strings specifying the package names that are used in "fn." This needs to be used when multicore = TRUE. DEFAULT = NULL. |
fileTag |
A string that is appended to the name of files to identify the analysis and experiment. The default is NULL, whereby the filetag will just be based on a timestamp. ' |
df.choiceDat |
A dataframe with the choice data from a typical PVT experiment. |
df.valueDat |
A dataframe with the raw values data from a typical values experiment. |
The file containing the overlaps with the identified reference distribution is saved (<fileTag>Overlaps.txt) and the final parameters of the reference distribution with the fits (<fileTag>FitResults.txt). The function returns a list containing the fitted data to the p(HVO) and RT relative to the overlaps of the reference distribution.
rrwIdentifyReferenceDistributionSGS(df.choiceDat=moralsData, df.valueDat = allValues, myModelList, item1cols = "Item1", item2cols = "Item2", respChoiceCol = "keyDef", respChoiceVal = c("Yes", "No"), RTcol = "res.rt",chanceThreshold = 0.5, lowRTquantileThreshold = 0.025, highRTquantileThreshold = 0.975, minOverlapN = 20, pars.n = 3, equalizeRTandPhit = TRUE, minimizeStat = "BIC", roundThreshold = 0.1, roundDirection = ceiling, overlapNumRuns = 1000, combFun = ch.maxAveComb, numLoops = 2500, numIntervals = 100, optParamListN = 10, optBoundLoops = 10, multicore = TRUE, multicorePackages = c('RRW'), fileTag = NULL, probMax = 0.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.