MATLAB Answers

Can one get fitted value without going to predict?

2 ビュー (過去 30 日間)
alpedhuez
alpedhuez 2021 年 7 月 29 日
コメント済み: alpedhuez 2021 年 7 月 30 日
I have a regression
mdl=fitlm(X,Y)
How can one obtain the fitted value of the regression without going for predict?
  1 件のコメント
Scott MacKenzie
Scott MacKenzie 2021 年 7 月 30 日
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".

サインインしてコメントする。

採用された回答

Jeff Miller
Jeff Miller 2021 年 7 月 30 日
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 件のコメント
alpedhuez
alpedhuez 2021 年 7 月 30 日
I had hoped that
fitlm
had saved the value so that one can just reference it.

サインインしてコメントする。

その他の回答 (0 件)

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by