How to calculate the log likelihood of a fit

4 views (last 30 days)
I wonder how to calculate the log likelihood value given a general fit on Matlab, for example: what is the log likelihood of the fit results of this data?
xData = linspace(1,10,1000)';
yData = xData + randn(1000,1);
%%Fit: 'Linear'
% Set up fittype and options.
ft = fittype( 'T0+T1*D', 'independent', 'D', 'dependent', 'T' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.Robust = 'Bisquare';
opts.StartPoint = [0.568823660872193 0.469390641058206];
% Fit model to data.
[fitresult, gof] = fit( xData, yData, ft, opts );

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!