Simple linear regression with maximum likelihood estimation
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Linear Regression dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!