library(tidyverse)
library(idefix)
library(MASS)
Here is an package for finding optimal the algorithm of a discrete choice experiment. The player chooses between two alternatives, and the attributes are the amount of payment of the self and the match.
#second mover
#two alternatives,two attributes:
#1. continous reward, k = 8 levels, 4=selling price (or = 100 if optout), level k = k/4 * price
#2. binary, opponent gets or lose reward 50 (get benefit = 1)
at.lvls <- c(7, 3)
c.type <- c("C", "D")
con.lvls <- list(c(0, 1, 2, 3, 4, 5, 6))
cs <- Profiles(lvls = at.lvls, coding = c.type, c.lvls = con.lvls)
option 2: you get 0, your match get 0 (this algorithm fail to set this though) option 1: you change your statement, get p, your match get 5/lose 5
var1: payment for the self var21: no payment for the match var22:5 shekal for the match var23: -5 shekal for the match
mu <- c(1, -1, 1)
sigma <- diag(length(mu))
set.seed(123)
M <- MASS::mvrnorm(n = 500, mu = mu, Sigma = sigma)
asc <- matrix(data = rnorm(500, mean = 1), ncol = 1)
ps <- list(asc, M)
D <- Modfed(cand.set = cs, n.sets = 8, n.alts = 2, alt.cte = c(0, 1), par.draws = ps)
D
## $design
## alt2.cte Var1 Var22 Var23
## set1.alt1 0 1 0 1
## set1.alt2 1 1 0 0
## set2.alt1 0 5 0 1
## set2.alt2 1 4 1 0
## set3.alt1 0 6 0 0
## set3.alt2 1 6 1 0
## set4.alt1 0 2 0 0
## set4.alt2 1 0 0 1
## set5.alt1 0 1 1 0
## set5.alt2 1 0 0 1
## set6.alt1 0 5 0 1
## set6.alt2 1 6 0 0
## set7.alt1 0 3 1 0
## set7.alt2 1 1 0 0
## set8.alt1 0 3 0 0
## set8.alt2 1 5 1 0
##
## $error
## [1] 1.635096
##
## $inf.error
## [1] 0
##
## $probs
## Pr(alt1) Pr(alt2)
## set1 0.4967264 0.5032736
## set2 0.7638602 0.2361398
## set3 0.4906189 0.5093811
## set4 0.4966427 0.5033573
## set5 0.2187247 0.7812753
## set6 0.3291092 0.6708908
## set7 0.4958412 0.5041588
## set8 0.2398285 0.7601715