Skip to contents

This function checks the compatibility of submitted parameters for the prior distributions and sets missing values to default values.

Usage

check_prior(
  P_f,
  P_r,
  J,
  ordered = FALSE,
  eta = numeric(P_f),
  Psi = diag(P_f),
  delta = 1,
  xi = numeric(P_r),
  D = diag(P_r),
  nu = P_r + 2,
  Theta = diag(P_r),
  kappa = if (ordered) 4 else (J + 1),
  E = if (ordered) diag(1) else diag(J - 1),
  zeta = numeric(J - 2),
  Z = diag(J - 2)
)

Arguments

P_f

The number of covariates connected to a fixed coefficient (can be 0).

P_r

The number of covariates connected to a random coefficient (can be 0).

J

The number (greater or equal 2) of choice alternatives.

ordered

A boolean, FALSE per default. If TRUE, the choice set alternatives is assumed to be ordered from worst to best.

eta

The mean vector of length P_f of the normal prior for alpha. Per default, eta = numeric(P_f).

Psi

The covariance matrix of dimension P_f x P_f of the normal prior for alpha. Per default, Psi = diag(P_f).

delta

A numeric for the concentration parameter vector rep(delta,C) of the Dirichlet prior for s. Per default, delta = 1. In case of Dirichlet process-based updates of the latent classes, delta = 0.1 per default.

xi

The mean vector of length P_r of the normal prior for each b_c. Per default, xi = numeric(P_r).

D

The covariance matrix of dimension P_r x P_r of the normal prior for each b_c. Per default, D = diag(P_r).

nu

The degrees of freedom (a natural number greater than P_r) of the Inverse Wishart prior for each Omega_c. Per default, nu = P_r + 2.

Theta

The scale matrix of dimension P_r x P_r of the Inverse Wishart prior for each Omega_c. Per default, Theta = diag(P_r).

kappa

The degrees of freedom (a natural number greater than J-1) of the Inverse Wishart prior for Sigma. Per default, kappa = J + 1.

E

The scale matrix of dimension J-1 x J-1 of the Inverse Wishart prior for Sigma. Per default, E = diag(J - 1).

zeta

The mean vector of length J - 2 of the normal prior for the logarithmic increments d of the utility thresholds in the ordered probit model. Per default, zeta = numeric(J - 2).

Z

The covariance matrix of dimension J-2 x J-2 of the normal prior for the logarithmic increments d of the utility thresholds in the ordered probit model. Per default, Z = diag(J - 2).

Value

An object of class RprobitB_prior, which is a list containing all prior parameters. Parameters that are not relevant for the model configuration are set to NA.

Details

A priori, we assume that the model parameters follow these distributions:

  • \(\alpha \sim N(\eta, \Psi)\)

  • \(s \sim Dir(\delta)\)

  • \(b_c \sim N(\xi, D)\) for all classes \(c\)

  • \(\Omega_c \sim IW(\nu,\Theta)\) for all classes \(c\)

  • \(\Sigma \sim IW(\kappa,E)\)

  • \(d \sim N(\zeta, Z)\)

where \(N\) denotes the normal, \(Dir\) the Dirichlet, and \(IW\) the Inverted Wishart distribution.

Examples

check_prior(P_f = 1, P_r = 2, J = 3, ordered = TRUE)
#> $eta
#> [1] 0
#> 
#> $Psi
#>      [,1]
#> [1,]    1
#> 
#> $delta
#> [1] 1
#> 
#> $xi
#> [1] 0 0
#> 
#> $D
#>      [,1] [,2]
#> [1,]    1    0
#> [2,]    0    1
#> 
#> $nu
#> [1] 4
#> 
#> $Theta
#>      [,1] [,2]
#> [1,]    1    0
#> [2,]    0    1
#> 
#> $kappa
#> [1] 4
#> 
#> $E
#>      [,1]
#> [1,]    1
#> 
#> $zeta
#> [1] 0
#> 
#> $Z
#>      [,1]
#> [1,]    1
#> 
#> attr(,"class")
#> [1] "RprobitB_prior" "list"