fitlm how to save predicted values?

18 views (last 30 days)
Tania
Tania on 10 Jul 2014
Commented: Star Strider on 10 Jul 2014
Hey! For further calculations I need to use my predicted values of my linear model. Using fitlm I get e.g. mdl =
Linear regression model: MPG ~ 1 + Weight + Year + Weight^2
Estimated Coefficients: Estimate SE tStat ________ ________ _____
(Intercept) 54.206 4.7117 11.505
Weight -0.016404 0.0031249 -5.2493
Year_76 2.0887 0.71491 2.9215
Year_82 8.1864 0.81531 10.041
Weight^2 1.5573e-06 4.9454e-07 3.149
pValue
__________
(Intercept) 2.6648e-19
Weight 1.0283e-06
Year_76 0.0044137
Year_82 2.6364e-16
Weight^2 0.0022303
Number of observations: 94, Error degrees of freedom: 89 Root Mean Squared Error: 2.78 R-squared: 0.885, Adjusted R-Squared 0.88 F-statistic vs. constant model: 172, p-value = 5.52e-41
Here I have 94 actual values, how can I get the predicted values of these? E.g if I have 94 actual prices, how can i get the predicted prices through my model (best would be in an array).
Thanks a lot!

Accepted Answer

Star Strider
Star Strider on 10 Jul 2014
See if predict does what you want.
  2 Comments

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!