mvregresslike
statistics: nlogL = mvregresslike (X, Y, beta, Sigma, alg)
statistics: [nlogL, COVB] = mvregresslike (…)
Negative log-likelihood for a multivariate regression model.
mvregresslike (X, Y, beta, Sigma, alg)
returns the negative log-likelihood nlogL of the multivariate normal
regression model with responses Y (an n-by-d matrix, one
row per observation), coefficients beta, and residual covariance
Sigma (d-by-d).
X specifies the design. It is either a numeric n-by-p matrix, in which case the same p predictors apply to every response and beta is p-by-d; or a cell array of n design matrices, each d-by-K, in which case beta is K-by-1.
alg selects how missing responses (NaN entries of Y) are
handled: "ecm" (the default) and "cwls" use every observed
response through the marginal likelihood of the observed components, while
"mvn" discards any observation that has a missing response. With no
missing data all three agree.
The optional second output COVB is the covariance matrix of the
coefficient estimates, computed as the inverse of the observed Fisher
information at beta and Sigma. With missing data and the
"ecm"/"cwls" algorithms this is the standard observed-data
covariance and can differ from MATLAB’s value (which uses a different
information convention) at the 1e-3 level; nlogL agrees exactly.
See also: mvregress
Source Code: mvregresslike
Negative log-likelihood of a two-response regression at the true params.
X = [ones(20,1), (1:20)'/20]; B = [1 -2; 0.5 3]; Y = X * B + 0.3 * randn (20, 2); nll = mvregresslike (X, Y, B, cov (Y - X*B))
nll = 5.3688