get_2x2_payouts | R Documentation |
This function generates a 2x2 payout matrix for players A and B given their player type, decision space (upgrade septic or not), and associated costs.
get_2x2_payouts(tA, tB, Cs, Cd, pos = FALSE)
tA |
Player A type as 1, 2, 3, or 4 |
tB |
Player B type as 1, 2, 3, or 4 |
Cs |
Cost of upgrading septic system (positive) |
Cd |
Cost of contamination of domestic well (positive) |
pos |
If |
The function returns a tibble containing the following columns:
A, B: player decision as either 1 (Upgrade) or 0 (Neglect)
tA, tB: Type of each player
Cs_i: Expected utility (i.e., cost) of upgrading septic system
Cd_i: Expected utility (i.e., cost) of contaminated domestic well
UA, UB: Expected utility of both costs
payouts: Payout structure for each cell for A, B
payouts_pos <- get_2x2_payouts(3, 3, Cs = 1, Cd = 2, TRUE)
payouts_neg <- get_2x2_payouts(3, 3, Cs = 1, Cd = 2, FALSE)
get_2x2_ggplot(payouts_pos, TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.