Linear regression analysis can be done using the LinearModel class (which only exists from Matlab R2012b (Statistics toolbox) (as always it is good to check the help of this class type help LinearModel in the command window)
As an example, we here fit a very simple model:
This can be done typing:
mdl = LinearModel.fit(X,Y);
assuming X is data matrix with and along the columns, and Y is a vector of Y data.
to see the outcome of the fit.
Next we want to predict from the data using the model we fitted above. This is done using the 'predict' function.
Y2 = predict(mdl,X2);
tutorial/how_to_run_linear_regression_analysis_in_matlab.txt · Last modified: 2013/06/06 20:31 by Simon-Shlomo Poil