Simple linear regression with maximum likelihood estimation

조회 수: 7 (최근 30일)
Melisa Akan
Melisa Akan 2019년 9월 17일
Hello,
I have a very simple question that I couldn't find an answer to. Any guidance would be greatly appreciated.
All I have is 5 pairs of x,y values and I am trying to fit a line to these points using maximum likelihood estimation (MLE).
I have already done this using least squares estimation (code below) and came up with the parameter estimates, 0.3368 and 1.2805, for the slope and the intercept respectively. I would like to compare these with parameter estimates that the MLE method would produce.
I have already looked into the MLE function explained on MATLAB's website but I couldn't be sure how to implement it.
Thanks again!
x= [0.1 0.1 0.5 0.8 0.9];% probability values FAR
y= [0.8 0.8 0.9 0.95 0.95];% probability values HR
x = transpose(norminv(x)); % convert to z, the line will be fit to z-scores
y = transpose(norminv(y));
Xz =[ones(length(x),1) x]; % add ones before the x values to get it ready for linear regression
b=Xz\y; % returns vector with intercept and slope

답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear Regression에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by