How to obtain residuals after using 'fitrm'?
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello,
I have been trying to obtain the residuals after using 'fitrm' with this formula: 'VarLeft-VarRight~Group', so that I can test for normality and outliers, but I haven't found a way of doing this on MATLAB. I was wondering if anybody knows how to do this?
Thanks!
0 Commenti
Risposte (1)
dpb
il 23 Set 2024
It doesn't seem as they have implemented it directly; you'll have to compute the residuals as the difference between the resulting model prediction and the input data at the desired data points...
There's an example for the Fisher iris data set that doesn't specifically compute the residuals themselves, but calculates the predicted values and plots them in comparison to the input data...just follow its lead...
load fisheriris
t = table(species,meas(:,1),meas(:,2),meas(:,3),meas(:,4), ...
'VariableNames',{'species','meas1','meas2','meas3','meas4'});
Meas = dataset([1 2 3 4]','VarNames',{'Measurements'});
rm = fitrm(t,'meas1-meas4~species','WithinDesign',Meas);
Yhat=predict(rm,t([1 51 101],:))
Y=t([1 51 101],[2:end])
Res=Y-Yhat
Use your data a results similarly...
0 Commenti
Vedere anche
Categorie
Scopri di più su Spectral Measurements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!