function F=normstud(theta,e2) omega=theta(1); alpha=theta(2); beta=theta(3); nu=theta(4); T=max(size(e2)); s2=zeros(size(e2)); s2(1)=e2(1); for i=2:T s2(i)=omega+alpha*e2(i-1)+beta*s2(i-1); end F=-(T-1)*log(Gamma(0.5*(nu+1))/(sqrt(pi*nu)*Gamma(0.5*(nu-2))))+0.5*(nu+1)*sum(log(1+(e2(2:T))./(s2(2:T)*(nu-2))))+0.5*sum(s2(2:T));