Skip to contents

Log-likelihood function of the (normally mixed) multinomial probit model

Usage

f_ll_mnp(
  theta,
  data,
  neg = FALSE,
  normal_cdf = mvtnorm::pmvnorm,
  threshold = 1e-06
)

Arguments

theta

A numeric, the vector of model coefficients. The order of theta is c(b, o, l), see the details.

data

A data.frame, the output of sim_mnp.

neg

Set to TRUE to return the negative log-likelihood value.

normal_cdf

A function that evaluates the n-variate normal CDF. It must take the arguments

  • lower, the vector of lower limits of length n,

  • upper, the vector of upper limits of length n,

  • mean, the mean vector of length n,

  • sigma, the n times n covariance matrix,

and return a single numeric.

By default, normal_cdf = mvtnorm::pmvnorm.

threshold

A small numeric between 0 and 1. Choice probabilities below this value are set to this value to avoid numerical problems.

Value

A numeric, the log-likelihood value at theta given data.

Details

The order of theta is supposed to be c(b, o, l), where

  • b is the vector of mean effects without the first entry,

  • o the lower-triangular elements of the lower-triangular Cholesky root of the effect covariance matrix Omega (if any),

  • and l the lower-triangular elements of the lower-triangular Cholesky root of the differenced (with respect to the last alternative) error term covariance matrix Sigma.

References

https://en.wikipedia.org/wiki/Multinomial_probit

See also

sim_mnp() for simulating a data set from a probit model.

Examples

data <- sim_mnp(N = 500, J = 3, P = 2, b = c(1, 3), Sigma = diag(3))
theta <- attr(data, "true")
f_ll_mnp(theta = theta, data = data)
#> [1] -160.4119
# \donttest{
nlm(f_ll_mnp, p = theta, data = data, neg = TRUE)$estimate
#> [1] 2.7968937 1.1491481 0.5971256 1.1336704
# }