function [llf] = rho_mode(x,y,X,...
        sig2draw,betadraw,murho,Vrho,T);
rho=tanh(x);
%build Omega
hat=abs(repmat([-(T-1):T-1],T,1));
int1=rho.^hat;
Om=full(spdiags(int1,-(T-1):T-1,T,T));

int = - (1/2)* log(det(Om))-(1/2)*((y-X*betadraw)'*((sig2draw*Om)\(y-X*betadraw)));


priorchunk=tnormpdf(murho,sqrt(Vrho),-1,1,rho);
llf=-(log(priorchunk)+int);
