How to calculate AIC from an fmincon optimization
4 次查看(过去 30 天)
显示 更早的评论
I have some independent and dependent data measurements in two variables (vectors), called X and Y, respectively. I am using fmincon to minimize the following cost function
function SSerr = ObjFun(C, X, Y)
Yhat = Model(C, X);
T = ( Yhat - Y ).^2;
SSerr = sum(T(:));
end
the function "Model" above just calculates the predicted values (Yhat) based on the measured independent variable data (X) and some fit-parameters (C).
I assume that the errors (deviations between predicted Yhat and measured Y) come from a normal (Gaussian) distribution with mean=0 and variance sigma, G(0, sigma2)
I want to calculate the Akaikes Information Criterion (AIC).
AIC = 2k - 2ln(L)
where k is the number of parameters used for the fit (in my case the length of C) and L is the maximum value of the likelihood function.
So my question is: how do I calculate the maximum value of the likelihood function ?
I have seen here that minimising the sum of the squares of the residuals (RSS), as I do above, is equivalent to maximising the likelihood function if the residuals are normally distributed.
But this does not mean that the RSS is equal to the likelihood function - or does it ?
Thanks in advance
0 个评论
回答(1 个)
Vaibhav Awale
2016-5-3
Hi Rozh,
From the link that you have provided, it seems that maximum value of likelihood function will occur at minimum value of RSS. However, for calculating maximum value of likelihood from RSS, you will need to know the variance of the model as well.
Please refer to following documentation link which has MATLAB function 'aic', which is used to find Akaike's Information Criterion for estimated model.
I hope this helps.
Regards,
Vaibhav
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Portfolio Optimization and Asset Allocation 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!