// Numbas version: exam_results_page_options {"name": "Decision analysis: expected value of perfect information", "extensions": ["jsxgraph", "optimisation"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variable_groups": [{"variables": ["num_states", "num_actions", "utility_range", "prob_denom", "probs"], "name": "Setup"}, {"variables": ["utility"], "name": "Utility"}, {"variables": ["expected_value", "best_action", "evpi"], "name": "Expected value"}], "variables": {"best_action": {"templateType": "anything", "group": "Expected value", "definition": "filter(expected_value[j]=max(expected_value),j,0..num_actions-1)[0]", "description": "", "name": "best_action"}, "probs": {"templateType": "anything", "group": "Setup", "definition": "vector(random_partition(prob_denom,num_states,1))/prob_denom", "description": "", "name": "probs"}, "num_states": {"templateType": "anything", "group": "Setup", "definition": "random(2..4)", "description": "", "name": "num_states"}, "prob_denom": {"templateType": "anything", "group": "Setup", "definition": "random(num_states..9)", "description": "", "name": "prob_denom"}, "evpi": {"templateType": "anything", "group": "Expected value", "definition": "evpi(utility,probs)", "description": "", "name": "evpi"}, "utility_range": {"templateType": "anything", "group": "Setup", "definition": "1..20", "description": "

Ranges to select utility from for each state.

", "name": "utility_range"}, "expected_value": {"templateType": "anything", "group": "Expected value", "definition": "map(\n sum(map(utility[j][k]*probs[k],k,0..num_states-1)),\nj, 0..num_actions-1)", "description": "", "name": "expected_value"}, "utility": {"templateType": "anything", "group": "Utility", "definition": "matrix(repeat(repeat(random(utility_range),num_states),num_actions))", "description": "

Utility for each combination of action and state.

", "name": "utility"}, "num_actions": {"templateType": "anything", "group": "Setup", "definition": "random(round(8/num_states)..round(15/num_states))", "description": "

Pick a number of actions based on the number of states so that the utility matrix should have between 8 and 15 elements (roughly).

", "name": "num_actions"}}, "ungrouped_variables": [], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "name": "Decision analysis: expected value of perfect information", "functions": {"evpi_calculation": {"type": "string", "language": "javascript", "definition": "var num_states = utility.columns;\nvar num_actions = utility.rows;\nvar total_over_states = 0;\nvar sum = [];\n\nfor(var j=0;jWhich action gives the highest expected value?

", "showPrecisionHint": false, "scripts": {}, "type": "numberentry", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "variableReplacements": [], "marks": 1, "maxValue": "best_action+1"}, {"allowFractions": true, "showCorrectAnswer": true, "minValue": "evpi", "prompt": "

What is the expected value of perfect information (EVPI) for this decision?

", "showPrecisionHint": false, "scripts": {}, "type": "numberentry", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": true, "variableReplacements": [], "marks": 1, "maxValue": "evpi"}], "statement": "

You must decide between {num_actions} actions, in a decision based on {num_states} states of nature. The following table gives the utility for each action in each state of nature.

\n

{table(map(['\\$a_'+(j+1)+'\\$']+list(utility[j]),j,0..num_actions-1),['']+map('\\$s_'+(j+1)+'\\$',j,0..num_states-1))}

\n

{table([['\\$\\\\pi(s_i)\\$']+map(fraction(probs[j]*prob_denom,prob_denom),j,0..num_states-1)],['\\$i\\$']+map('\\$'+j+'\\$',j,1..num_states))}

", "tags": [], "rulesets": {}, "preamble": {"css": "", "js": "question.onHTMLAttached(function() {\n});"}, "type": "question", "metadata": {"notes": "", "licence": "Creative Commons Attribution 4.0 International", "description": "

Given a payoff table with two states and five actions, identify which actions are admissible, then the maximax, maximin, and minimax regret actions.

"}, "variablesTest": {"condition": "len(filter(precround(expected_value[j],2)=precround(max(expected_value),2),j,0..num_actions-1))=1 // there's exactly one best action", "maxRuns": "100"}, "advice": "

a)

\n

The expected values of each action are as follows:

\n

\\[ \\var{expected_value_calculation(utility,probs)} \\]

\n

The action with the highest expected value is $a_{\\var{best_action+1}}$, with an expected value of $\\simplify[fractionnumbers]{{expected_value[best_action]}}$.

\n

b)

\n

The expected value of perfect information is given by the following formula:

\n

\\[ \\mathrm{EVPI} = \\sum_j \\pi(s_j) \\left\\{ \\max_i \\; U(a_i,s_j) \\right \\} - \\max_i \\left\\{ \\sum_j \\pi(s_j) U(a_i,s_j) \\right\\} \\]

\n

For this decision, we have

\n

\\[ \\mathrm{EVPI} = \\var{evpi_calculation(utility,probs)} \\]

", "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}]}], "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}