# SeqKL: Sequential Kullback-Leibler based algorithm for the MNL... In idefix: Efficient Designs for Discrete Choice Experiments

## Description

Selects the choice set that maximizes the Kullback-Leibler divergence between the prior parameter values and the expected posterior, assuming a MNL model.

## Usage

 ```1 2``` ```SeqKL(des = NULL, cand.set, n.alts, par.draws, alt.cte = NULL, no.choice = NULL, weights = NULL, allow.rep = FALSE) ```

## Arguments

 `des` A design matrix in which each row is a profile. If alternative specific constants are present, those should be included as the first column(s) of the design. Can be generated with `Modfed` or `CEA`. `cand.set` A numeric matrix in which each row is a possible profile. The `Profiles` function can be used to generate this matrix. `n.alts` Numeric value indicating the number of alternatives per choice set. `par.draws` A matrix or a list, depending on `alt.cte`. `alt.cte` A binary vector indicating for each alternative if an alternative specific constant is desired. `no.choice` An integer indicating the no choice alternative. The default is `NULL`. `weights` A vector containing the weights of the draws. Default is `NULL`, See also `ImpsampMNL`. `allow.rep` Logical value indicating whether repeated choice sets are allowed in the design.

## Details

This algorithm is ideally used in an adaptive context. The algorithm selects the choice set that maximizes the Kullback-Leibler divergence between prior and expected posterior. Otherwisely framed the algorithm selects the choice set that maximizes the expected information gain.

If `alt.cte = NULL`, `par.draws` should be a matrix in which each row is a sample from the multivariate parameter distribution. In case that `alt.cte` is not `NULL`, a list containing two matrices should be provided to `par.draws`. The first matrix containing the parameter draws for the alternative specific parameters. The second matrix containing the draws for the rest of the parameters.

The list of potential choice sets are created using `combn`. The `weights` argument can be used when the `par.draws` have weights. This is for example the case when parameter values are updated using `ImpsampMNL`.

## Value

 `set` Numeric matrix containing the choice set that maximizes the expected KL divergence. `kl` Numeric value which is the Kullback leibler divergence.

\insertRef

crabbeidefix

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21``` ```# KL efficient choice set, given parameter draws. # Candidate profiles cs <- Profiles(lvls = c(3, 3), coding = c("E", "E")) m <- c(0.3, 0.2, -0.3, -0.2) # Prior mean (4 parameters). pc <- diag(length(m)) # Prior variance set.seed(123) ps <- MASS::mvrnorm(n = 10, mu = m, Sigma = pc) # 10 draws. # Efficient choice set to add. SeqKL(cand.set = cs, n.alts = 2, alt.cte = NULL, par.draws = ps, weights = NULL) # KL efficient choice set, given parameter draws. # Candidate profiles cs <- Profiles(lvls = c(3, 3), coding = c("C", "E"), c.lvls = list(c(5,3,1))) m <- c(0.7, 0.3, -0.3, -0.2) # Prior mean (4 parameters). pc <- diag(length(m)) # Prior variance set.seed(123) ps <- MASS::mvrnorm(n = 10, mu = m, Sigma = pc) # 10 draws. sample <- list(ps[ , 1], ps[ , 2:4]) ac <- c(1, 0) # Alternative specific constant. # Efficient choice set to add. SeqKL(cand.set = cs, n.alts = 2, alt.cte = ac, par.draws = sample, weights = NULL) ```

idefix documentation built on Nov. 27, 2020, 1:07 a.m.