View source: R/efficiency_criterions.R
DBerr | R Documentation |
Function to calculate the DB-error given a design, and parameter values.
DBerr(par.draws, des, n.alts, weights = NULL, mean = TRUE)
par.draws |
Numeric matrix in which each row is a draw from a multivariate parameter distribution. |
des |
A design matrix in which each row is an alternative. |
n.alts |
Numeric value indicating the number of alternatives per choice set. |
weights |
A numeric vector containing weights of |
mean |
A logical value indicating whether the mean (DB) error should be returned or not. Default = TRUE. |
Numeric value indicating the DB-error of the design given the parameter draws.
des <- example_design mu = c(-1, -1.5, -1, -1.5, 0.5, 1) Sigma = diag(length(mu)) par.draws <- MASS::mvrnorm(100, mu = mu, Sigma = Sigma) n.alts = 2 DBerr(par.draws = par.draws, des = des, n.alts = n.alts) mu = c(-0.5, -1, -0.5, -1, 0.5, 1) Sigma = diag(length(mu)) par.draws <- MASS::mvrnorm(100, mu = mu, Sigma = Sigma) DBerr(par.draws = par.draws, des = des, n.alts = n.alts)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.