Title figure out likelihood by hand NGroups 1 Calculation Begin Matrices; E symm 2 2 ! Expected Covariance Matrix H full 1 1 ! One half T full 1 1 ! Two M full 2 1 ! Mean vector P full 1 1 ! Pi X full 2 1 ! Observed Data End Matrices; Matrix E 1 0.5 1 Matrix H 0.5 Matrix M 0 0 Matrix P 3.141592 Matrix T 2 Matrix X 0.5 -0.3 Begin Algebra; O=T*P*\sqrt\det(E); ! Fractional part, 2pi*sqrt(det(e)) Q=(X-M)'&(E~); ! Mahalanobis Distance, (indiv score - mean)’& inverse of covariance matrix R=\exp(-H*Q); ! e to the power -.5*Mahalanobis distance S=-T*\ln(R%O); ! minus twice log-likelihood Z=-T*\ln(\pdfnor(X'_M'_E)); ! an easier way End Algebra; End Group;