How do I improve my multiple regression model?
5 views (last 30 days)
Show older comments
I am attaching my code, if you look at my coefficents they are huge and even my max error. How can I improve my results?
T = readtable('a.csv');
x1 = T.T;
x2 = T.Hour;
x3 = T.is_holiday;
x4 = T.month;
y = T.load;
A model of this data looks like :
Multiple regressions solves for coefficents by using a least squares fit.
Following line forms a matrix , X which has the first row set as 1, as it is necessary to do so in stats to have a constant term.
X = [ones(size(x1)) x1 x2 x3];
Solve for the different coefficents.
a = X\y
2.7423e+03\\ 0.8635 \\ 42.1795 \\ -87.1325 \\
The least- square fit model of the data is y = 27380+0.9x_1+42.2x_2-87.1x_3
Y = X*a;
MaxErr = max(abs(Y-y))
Answers (0)
See Also
Categories
Find more on Linear and Nonlinear Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!