mle.tmvnorm: Maximum Likelihood Estimation for the Truncated Multivariate...

View source: R/tmvnorm-estimation.R

mle.tmvnormR Documentation

Maximum Likelihood Estimation for the Truncated Multivariate Normal Distribution

Description

Maximum Likelihood Estimation for the Truncated Multivariate Normal Distribution

Usage

mle.tmvnorm(X, 
  lower = rep(-Inf, length = ncol(X)), 
  upper = rep(+Inf, length = ncol(X)), 
  start = list(mu = rep(0, ncol(X)), sigma = diag(ncol(X))), 
  fixed = list(), method = "BFGS", 
  cholesky = FALSE,
  lower.bounds = -Inf,
  upper.bounds = +Inf,
  ...)

Arguments

X

Matrix of quantiles, each row is taken to be a quantile.

lower

Vector of lower truncation points, default is rep(-Inf, length = ncol(X)).

upper

Vector of upper truncation points, default is rep( Inf, length = ncol(X)).

start

Named list with elements mu (mean vector) and sigma (covariance matrix). Initial values for optimizer.

fixed

Named list. Parameter values to keep fixed during optimization.

method

Optimization method to use. See optim

cholesky

if TRUE, we use the Cholesky decomposition of sigma as parametrization

lower.bounds

lower bounds/box constraints for method "L-BFGS-B"

upper.bounds

upper bounds/box constraints for method "L-BFGS-B"

...

Further arguments to pass to optim

Details

This method performs a maximum likelihood estimation of the parameters mean and sigma of a truncated multinormal distribution, when the truncation points lower and upper are known. mle.tmvnorm() is a wrapper for the general maximum likelihood method mle, so one does not have to specify the negative log-likelihood function.

The log-likelihood function for a data matrix X (T x n) can be established straightforward as

\log L(X | μ,Σ) = -T \log{α(μ,Σ)} + {-T/2} \log{\|Σ\|} -\frac{1}{2} ∑_{t=1}^{T}{(x_t-μ)' Σ^{-1} (x_t-μ)}

As mle, this method returns an object of class mle, for which various diagnostic methods are available, like profile(), confint() etc. See examples.

In order to adapt the estimation problem to mle, the named parameters for mean vector elements are "mu_i" and the elements of the covariance matrix are "sigma_ij" for the lower triangular matrix elements, i.e. (j <= i).

Value

An object of class mle-class

Author(s)

Stefan Wilhelm wilhelm@financial.com

See Also

mle and mle-class

Examples

## Not run: 
set.seed(1.2345)

# the actual parameters
lower <- c(-1,-1)
upper <- c(1, 2)
mu    <- c(0, 0)
sigma <- matrix(c(1, 0.7,
               0.7, 2), 2, 2)
               
# generate random samples               
X <- rtmvnorm(n=500, mu, sigma, lower, upper)
method <- "BFGS"

# estimate mean vector and covariance matrix sigma from random samples X
# with default start values
mle.fit1 <- mle.tmvnorm(X, lower=lower, upper=upper)

# diagnostic output of the estimated parameters
summary(mle.fit1)
logLik(mle.fit1)
vcov(mle.fit1)

# profiling the log likelihood and confidence intervals
mle.profile1 <- profile(mle.fit1, X, method="BFGS", trace=TRUE)
confint(mle.profile1)

par(mfrow=c(3,2))
plot(mle.profile1)

# choosing a different start value
mle.fit2 <- mle.tmvnorm(X, lower=lower, upper=upper, 
  start=list(mu=c(0.1, 0.1), 
  sigma=matrix(c(1, 0.4, 0.4, 1.8),2,2)))
summary(mle.fit2)

## End(Not run)

tmvtnorm documentation built on March 22, 2022, 9:06 a.m.