function lnLc = LVsarma(rho,n,n2,y,X,W1,W2)

lambda = rho(2);

A = eye(n2) - rho(1)*W1;
% p = colamd(A);
% [l,u] = lu(A(:,p));
% detrho = sum(log(abs(diag(u))));
detrho = log(det(A));

B = eye(n2) + lambda*W2;
% q = colamd(B);
% [m,v] = lu(B(:,q));
% detlambda = sum(log(abs(diag(v))));
detlambda = log(det(B));

Bi = inv(B);
Ay = A*y;
BAy = Bi*Ay;
BX = Bi*X;
beta = inv(BX'*BX)*BX'*BAy;
e = BAy - BX*beta;

lnLc = - detrho + detlambda + (n2/2)*log((e'*e)/n2);
