I am following a very detailed post from Quantitative Finance, however, my problem is a coding one.
I am trying to estimate a GARCH(1,1) model (not using a statistical toolbox and rather a long hand method, the reason for this is I really want to understand the in's and outs of the model).
I have posted a picture of the steps I need to complete for ease,
I am stuck on how I can write this log-likelihood in MATLAB. I essentially need to maximize the log-likehood over the iterations:
My attempt:
custlogpdf = @(u1,sigma) -1/2*sum( log(2*pi) + log(sigma^2) + (u1^2)./sigma^2 );
phat = mle(u1,'nloglf', custlogpdf, 'start' 0.05)
Could anyone point me in the right direction to use maximum likelihood estimation of the function?
The error I am getting from my attempt:
Error in test (line 40)
phat = mle(u1,'nloglf', custlogpdf, 'start', 0.05)
Caused by:
Error using test>@(u1,sigma)-1/2*sum(log(2*pi)+log(sigma^2)+((u1)^2)/sigma^2)
Too many input arguments.