DBerr: DB error

View source: R/efficiency_criterions.R

DBerrR Documentation

DB error

Description

Function to calculate the DB-error given a design, and parameter values.

Usage

DBerr(par.draws, des, n.alts, weights = NULL, mean = TRUE)

Arguments

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 par.draws. The default is NULL.

mean

A logical value indicating whether the mean (DB) error should be returned or not. Default = TRUE.

Value

Numeric value indicating the DB-error of the design given the parameter draws.

Examples

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)

traets/idefix documentation built on April 7, 2022, 1:56 p.m.