Passing Covariance Matrix in Likelihood Maximization

3 visualizaciones (últimos 30 días)
Marco Lago
Marco Lago el 27 de Feb. de 2021
Comentada: Marco Lago el 13 de Mayo de 2021
I've a question about code design for a numerical optimization of the likelihood function of the sort:
LL = LogLik(x,y,Param,L,Ps,P)
My objective function makes use of the multivariate normal probability density in the following fashion:
eta = mvnpdf(y,x*Phi,Sigma);
Where sigma is passed throug the parameter vector 'Param' (together with Phi). I then try to numerically optimize that through fmincon but then Sigma shoud be a positive-definite covariance matrix, condition that is not always defined and causes an error.
Results = fmincon(@(Param)LogLik(X,Y1,Param,L,Ps,P),x0,[],[],Aeq',beq,[],[],[],options)
I'm asking your help as I suspect this is not the right approach to solve the problem at hand.

Respuesta aceptada

Jeff Miller
Jeff Miller el 27 de Feb. de 2021
Sometimes this kind of problem can be solved by adding code within the LogLik function to make sure that a legal (i.e., positive definite) value of Sigma is computed from any possible combination of Param values. So, the Param values are not themselves elements of Sigma, but rather values that determine the elements of Sigma. As an example with Sigma determined by parameters 2-4:
function LL = LogLik(...
VarX = Param(2)^2; % Make sure positive
VarY = Param(3)^2; % Make sure positive
rhoXY = Param(4) / (abs(Param(4)+1)); % Make sure correlation between +/- 1
covarXY = rhoXY*sqrt(VarX)*sqrt(VarY);
Sigma = [VarX covarXY;
covarXY VarY]
eta = mvnpdf(y,x*Phi,Sigma);
...
Hope that helps
  1 comentario
Marco Lago
Marco Lago el 13 de Mayo de 2021
I was thinking about it again. One could pass the LogLik function a lower triangular matrix P and then build it in a covariance matrix such as Sigma = P*P'

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Linear Least Squares en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by