Clear Filters
Clear Filters

Multilinear Regression using regstats

2 views (last 30 days)
Lindsey
Lindsey on 15 Jul 2014
Answered: Roger Wohlwend on 16 Jul 2014
I have a series of data points that I would like to find a regression for. There are 97 data points and I want to use regstats to find the linear regression. I tried using:
regstats(X,Y,'linear')
For X, I inputted the x values of my data points and for Y, I inputted the y values for all of the points. I am not understanding how regstats works, does anyone know what I should be inputting instead?
This is the error I am getting:
Undefined function 'regstats' for input arguments of type 'double'.
Error in Test_Import_ASCII (line 13) stat = regstats(X,Y, 'linear','beta');
Thank you

Answers (1)

Roger Wohlwend
Roger Wohlwend on 16 Jul 2014
Use the function as follows:
stat = regstats(Y, X);
Ommit the third and forth arguments. Especially the last. The function returns a lot of useful information on the regression (t-values, r-square, ...), and if your forth argument is 'beta', you only get the coefficients. If you are only interested in coefficients, use the function regress because it is faster than regstats. Use regstats if you want that whole other stuff about the regression (t-values, r-square, mse, f-statistics, ...), too.

Community Treasure Hunt

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

Start Hunting!