The output of the auto.arima
function gives log-likelihood as 93.69. However I calculate it as 99.40152 by using the residuals. What causes the difference?
resid=c( 0.0009133036, -0.0024778952, 0.0016247257, -0.0262748348,-0.0245270803, 0.0416803278, 0.0283238192,-0.0200986496, -0.0637956188,-0.0304700821, -0.0389081231, -0.0066333658, -0.0079335582, -0.0327841692, 0.0422120965, -0.0107629969, 0.0141159479, 0.0033650571, -0.0195425507, -0.0016719690, -0.0092509480,-0.0173254345, 0.0233666990, -0.0063053729, -0.0249087321, 0.0175185423, 0.0090894124, 0.0094325355,-0.0170129762, -0.0368547384, 0.0118255009, -0.0728012098, 0.0069336386, 0.0052472716, -0.0028184078, 0.0052579484, 0.0117586931, 0.0079340426, -0.0270301760, -0.0590942951, 0.0448756767, 0.0175497969,-0.0178870348, -0.0310982909, 0.0033326883)
L=length(resid)*log(1)-length(resid)*log(sd(resid)*sqrt(2*pi))-(sum(resid^2)/(2*var(resid)))
Any df for std and var of residuals is not considered.