How could I do a linear regression forecasting in Matlab, please? I am not asking for the code itself, but for some guidelines on how can I structure the problem and what to use. I have three variables in a dataset (sample 1: V1, v2, v3; sample 2: v1, v2, v3; ...; n) The variables are: 1) Energy production (variable to be predicted); 2) ambient temperature; 3) solar radiation. I have a dataset of 60k samples, and would like to have a start and last for define to period to be predicted within the dataset, computing also the prediction error considering the predicted and the target values.

My problem is that I have no idea on how to structure it.. So, in advance, sorry for the question.

  • $\begingroup$ If you really want to use matlab (which imho is not the best language to do machine learning), I would use something like this : mathworks.com/help/matlab/data_analysis/linear-regression.html . I warn you of one thing : if you want a prediction error, beware overfitting (it is a common mistake) and use things like cross-validation (see stackexchange posts on cross-validation and overfitting). For your "start and last", maybe you are talking about confidence interval ? In which case, here it is : mathworks.com/help/stats/linearmodel.coefci.html. $\endgroup$ – TMat Sep 14 '20 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.