Can one get fitted value without going to predict?

1 次查看(过去 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)

更多回答(0 个)

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by