ch.moralsGetQuantityPhit: A function to get the predicted p(hit)Quant: that is,...

ch.moralsGetQuantityPhitR Documentation

A function to get the predicted p(hit)Quant: that is, p(hit)==TRUE if the participant chooses the item with the greatest quantity.

Description

This function calculates the predicted p(hit)Quant: that is, p(hit)==TRUE if the participant chooses the item with the greatest quantity.

Usage

ch.moralsGetQuantityPhit(
  data,
  p1QuantCol,
  p2QuantCol,
  respChoiceCol,
  respChoiceVal = c("Item1", "Item2"),
  targetPresent,
  targetPresentVals = c(TRUE, FALSE)
)

Arguments

data

a morals dataframe.

p1QuantCol

a string the specifies the column name in "data" that contains the numerical quantity assocaited with Item1.

p2QuantCol

a string the specifies the column name in "data" that contains the numerical quantity assocaited with Item2.

respChoiceCol

a string that specifies the name of the column in "data" 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) value (index 1) and the choose Item1 option ("no" take no action in many morals experimants) value (index 2).

targetPresentVals

a vector of two values that specifies the "target present" value (index 1) and the "target absent" value (index 2). e.g, c("yes", "no")

targetPresentCol

a string that specifies the name of the column in "data" that contains the whether or not the target was presented.

Value

the input dataframe with three new columns: "pHitQ" which contains a "1" if the participant chose the item with the greatest quantity and a "0" if they did not; and "OvrlpQuantConsistent" which contains a TRUE if the value and quantity of item1 vs item2 make the same prediction and a FALSE if they do not; and "targetPresentQ" contains a TRUE if the quantity of item1 > item2 so the participant should act and a FALSE if not; and "qDiff" which is the absolute value of the quantity difference between the items.

Examples

ch.moralsGetDirOverlapByGrp (overlapData, "probe1", "p1Quant", "dirOverlap")

ccpluncw/ccpl_R_chMorals documentation built on Feb. 4, 2024, 3:30 p.m.