[0, 1, 2, 3] function( attrChoices1, attrChoices2 ) { att1 = randFromArray( attrChoices1 ); att2 = randFromArray( attrChoices2 ); return [ att1, att2, att1 + " or " + att2, att1 + " and " + att2 ]; } [ "baseline", MIXER( ["blue"], ["hot"] ), "endline" ] randFromArray([ ["A local store ran a sale on two items, a watch and a shirt. There were ", ["customers who bought a watch", "customers who bought a shirt", "customers who bought a watch or a shirt", "customers who bought a watch and a shirt"], "What was the number of ", "?", false], ["A study group at a nearby high school has ", ["sophomores", "girls", "students who are a sophomore or a girl", "sophomore girls"], "How many ", " are there in the study group?", false], ["In a sample of patients, ", CHOOSE_ATTRIBUTES( ["male", "female"], ["colorblind", "overweight", "underweight", "over sixty", "healthy", "under eighteen", "healthy"] ), "What percentage of the patients are ", "?", true], ["Of the houses in a town, ", CHOOSE_ATTRIBUTES( ["white", "blue", "light green", "solar powered", "near a park"], ["air conditioned", "wooden", "stucco"] ), "What percentage of the houses are ", "?", true], ["A census was recently taken in a certain community, and the results include the following facts about the residents: ", CHOOSE_ATTRIBUTES( ["Hispanic", "Asian", "White", "Black"], ["male", "female", "under 18", "over 65"] ), "What percentage of the residents are ", "?", true], ["A car dealer advertises statistics desribing her inventory. Of the cars on her lot, the advertisement states ", CHOOSE_ATTRIBUTES( ["white", "blue", "light green", "red", "grey", "black"], ["trucks", "minivans", "SUVs", "sports cars", "sedans"] ), "What percentage of the cars are ", "?", true], ]) shuffle( [0, 1, 2, 3] ) ( function( usePercentages ) { var rangemin = usePercentages ? 1 : 2; var rangemax = usePercentages ? 100 : 10; var vals = [0, 0, 0, 0]; vals[VARINDX_X] = randRange( rangemin, rangemax ); vals[VARINDX_Y] = randRange( rangemin, rangemax ); vals[VARINDX_X_AND_Y] = randRange( max( rangemin, vals[VARINDX_X]+vals[VARINDX_Y]-100 ), min( vals[VARINDX_X], vals[VARINDX_Y] ) ); vals[VARINDX_X_OR_Y] = vals[VARINDX_X] + vals[VARINDX_Y] - vals[VARINDX_X_AND_Y]; return vals; } )( USEPERCENTAGES ) ( function() { var optionalPercentage = USEPERCENTAGES ? "% are " : " "; var qstn = INTRO; for (var i=0; i< ORDER.length-1; i++) { qstn += (i===ORDER.length-2) ? " and " : ""; qstn += VARVALS[ORDER[i]] + optionalPercentage + VARDESC[ORDER[i]]; qstn += (i< ORDER.length-2) ? ", " : ". "; } qstn += QSTNPRETEXT + VARDESC[ORDER[ORDER.length-1]] + QSTNPOSTTEXT; return qstn; } )() function (innerString) { return enFunc(innerString, USEPERCENTAGES); }

QUESTIONTEXT

VARVALS[ORDER[ORDER.length-1]]

Remember the addition rule of probability: P(A\cup B) = P(A) + P(B) - P(A\cap B)

Because the denominator of the fraction for each probability is the same, for convenience we can also just use cardinality (the number of items in each category) instead of probability: |A\cup B| = |A|+ |B| - |A\cap B|

Substituting variables, ENFUNC(VARDESC[2]) = ENFUNC(VARDESC[0]) + ENFUNC(VARDESC[1]) - ENFUNC(VARDESC[3])

Rearranging, ENFUNC(VARDESC[0]) = ENFUNC(VARDESC[3]) + ENFUNC(VARDESC[2]) - ENFUNC(VARDESC[1])

Rearranging, ENFUNC(VARDESC[1]) = ENFUNC(VARDESC[3]) + ENFUNC(VARDESC[2]) - ENFUNC(VARDESC[0])

Rearranging, ENFUNC(VARDESC[3]) = ENFUNC(VARDESC[0]) + ENFUNC(VARDESC[1]) - ENFUNC(VARDESC[2])

ENFUNC(VARDESC[0]) = VARVALS[3] + VARVALS[2] - VARVALS[1]

ENFUNC(VARDESC[1]) = VARVALS[3] + VARVALS[2] - VARVALS[0]

ENFUNC(VARDESC[2]) = VARVALS[0] + VARVALS[1] - VARVALS[3]

ENFUNC(VARDESC[3]) = VARVALS[0] + VARVALS[1] - VARVALS[2]

ENFUNC(VARDESC[0]) = VARVALS[3] + VARVALS[2] - VARVALS[1]

ENFUNC(VARDESC[1]) = VARVALS[3] + VARVALS[2] - VARVALS[0]

ENFUNC(VARDESC[2]) = VARVALS[0] + VARVALS[1] - VARVALS[3]

ENFUNC(VARDESC[3]) = VARVALS[0] + VARVALS[1] - VARVALS[2]