What is the difference between the regress function and the lscov function?

6 views (last 30 days)
I would like to perform multiple linear regression, and it seems that there are two options for MATLAB functions, regress and lscov. What is the difference between these two functions? Does regress also use least square's minimization?

Answers (1)

Shashank Prasanna
Shashank Prasanna on 8 Jul 2013
This is well explained in the documentation.
REGRESS and LSCOV use \ or mldivide to solve a least squares problem.
LSCOV:
  2 Comments
Nicole
Nicole on 8 Jul 2013
Where does it say that regress and lscov use mldivide? It's not on their respective documentation pages. Furthermore, if they both use mldivide, then why have two separate functions at all?
Shashank Prasanna
Shashank Prasanna on 8 Jul 2013
You can open the function to see what goes on under the hood:
>> edit regress, edit lscov
Also you can scroll down in lscov documentation to the first example to see the mention of \ or mldivide.
Depending on what you want to do you may choose either. If you want to do simple linear regression go with regress. LSCOV can also do weighted least squares solutions for positive semidefinite covariance matrices. LSCOV can also be used for multivariate regression. Implementation details are covered in the documentation and the references.

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!