Can one get fitted value without going to predict?

1 vue (au cours des 30 derniers jours)
alpedhuez
alpedhuez le 29 Juil 2021
Commenté : alpedhuez le 30 Juil 2021
I have a regression
mdl=fitlm(X,Y)
How can one obtain the fitted value of the regression without going for predict?
  1 commentaire
Scott MacKenzie
Scott MacKenzie le 30 Juil 2021
I had posted an answer but then read Jeff's answer, posted a few hours after mine. As Jeff is "guessing" so was I.
@alpedhuez, if Jeff's answer is what you are looking for, that's great. Please accept his answer.
If it's not what you are looking for, then please explain what you want. Explain what you mean by "fitted value" (why singular? coefficients? predictions? just one prediction? closeness of fit? etc.) and "without going for predict".

Connectez-vous pour commenter.

Réponse acceptée

Jeff Miller
Jeff Miller le 30 Juil 2021
From your reference to 'predict', I'm guessing you have a vector of observed x values and you want to compute the predicted y for those x's. If so, then you want something like this:
xwithintercept = [1 x]; % maybe x' depending on row vs column vector
predictedY = sum( xwithintercept .* mdl.Coeffificent.Estimate)
  1 commentaire
alpedhuez
alpedhuez le 30 Juil 2021
I had hoped that
fitlm
had saved the value so that one can just reference it.

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by