ch.moralsQuantAnalyis: A function to analyze the quantity variation in morals data.

ch.moralsQuantAnalyisR Documentation

A function to analyze the quantity variation in morals data.

Description

This function does the following: (1) ch.moralsQuantsToGrps(); (2) ch.moralsGetQuantityPhit (); (3) plots the linear fits for p(Hit)quantity = abs(quantity difference between Item1 and Item2); (4) ch.moralsModelOvrlpPredPhitQ()

Usage

ch.moralsQuantAnalyis(
  data,
  probe1Col,
  probe2Col,
  quantValueCuts,
  respChoiceCol,
  respChoiceVal = c("Item1", "Item2"),
  targetPresentCol,
  targetPresentVals,
  overlapRoundCol,
  params,
  ...
)

Arguments

data

a morals dataframe.

quantValueCuts

a vector of numbers that specifies the cutoff values for each quantity. The first category is <= to the first cutoff value; each successive category (c1, c2, etc) is c1 < X <= c2; the final category is greater than the last number in the vector.

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).

targetPresentCol

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

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")

overlapRoundCol

a string that specifies the name of the column in "data" that contains the overlap column.

params

a list of parameters that are read in using "ch.readMoralsDBfile.r."

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.

Value

the input dataframe with 10 new columns: "p1Quant" and "p1Quant" (the quantities of probe 1 and 2 respectively); "p1" and "p2" (the singular, equalized names of probe 1 and 2 respoectively); and "p1GrpSize" and "p2GrpSize" (the group categories based on quantValueCuts for probe 1 and 2 respectively); "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.moralsQuantAnalyis (moralsData, "Item1", "Item2", c(1,10,40), "keyDef", respChoiceVal = c("Yes", "No"),"targetPresent", c(TRUE, FALSE), "overlapRound", params)

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