Code covered by the BSD License  

Highlights from
MyRegression

3.88889

3.9 | 9 ratings Rate this file 32 Downloads (last 30 days) File Size: 4.64 KB File ID: #15473

MyRegression

by Giuseppe Cardillo

 

02 Jul 2007 (Updated 17 Nov 2011)

A simple function on LS linear regression with many informative outputs

| Watch this File

File Information
Description

After the Dimitri's comment I deeply reviewed this file. Now this file use the Regress function (but the results with Polyfit were the same). Anyway I wrote this function exclusively for the common use of a one estimator linear regression; a common laboratory use where a simple regression is required.
Now this function checks the presence of outliers (as the Robustfit).
This function computes a least-squares linear regression suppling several output informations:
     - Presence of outliers
     - Slope with standard error an 95% C.I.
     - Intercept with standard error an 95% C.I.
     - Pearson's Correlation coefficient with 95% C.I. and its adjusted form (depending on the elements of X and Y arrays)
     - Spearman's Correlation coefficient
     - Regression Standard Error
     - Total Variability
     - Variability due to regression
     - Residual Variability
     - Student's t-Test on Slope (to check if slope=0), with power
     - Student's t-Test on Intercept (to check if intercept=0) with power
     - Power of the regression
     - Modified Levene's test for homoschedasticity of residuals
     - a plot with:
         o Data points
         o Least square line
         o Red dotted lines: 95% Confidence interval of regression
         o Green dotted lines: 95% Confidence interval of new y evaluation using this regression.
     - the residuals plot

The function requires the Statistics Toolbox because calls TINV and TCDF to perform the Student's t-test.
To compute power, Myregr requires powerStudent by Trujillo-Ortiz, A. and R. Hernandez-Walls. If this function is not present on the computer, it try to download it from FEX

My profile on XING http://www.xing.com/go/invita/13675097
My profile on LinkedIN http://it.linkedin.com/in/giuseppecardillo

Required Products Statistics Toolbox
MATLAB release MATLAB 7.3 (R2006b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (10)
05 Jul 2007 Dimitri Shvorob

REGRESS of Statistics Toolbox already does most of the calculations, and is not restricted to the single-regressor case. The author is apparently unaware of the 'b = inv(x'*x)*(x'*y)' formula, and computes OLS coefficients with POLYFIT.(?!). Redundant and badly written.

10 Dec 2007 Kai M

This is a great file. It's way simpler than the theoretically overloaded MatLab code. Very nice gimmicks include outlier exclusion, plotted confidence intervals etc. This really saves time, because all you need is plugging in the two vectors you want to correlate. Thanks a lot to the author!!!

13 Mar 2008 C C

It might already be in stat toolbox, but for those of use that can't afford the toolbox, this is great.

04 Sep 2009 Ben  
23 Dec 2009 Oleg Komarov

In spite of the many useful fcns written by giuseppe, I don't see much use for this one, especially if we consider that the Statistics TB is mandatory (not to talk about fcns by other authors...). Regress, regstats and my personal enhanced variation do already the most...

16 Feb 2010 Kushsairy

useful for me

02 Mar 2010 Andre Guy Tranquille  
12 Mar 2010 hamed nozari

very good. thanks

19 Nov 2011 Suryo Kusumo  
30 Jan 2012 Chris Choi

Having a few statistics that MATLAB default functions do not provide is awesome especially when it's too cumbersome to write a new one. Good job!

Please login to add a comment or rating.
Updates
23 Jul 2007

Deep review

18 Aug 2007

Spearman's correlation coefficient added.
Adjusted for using with MYREGRINV and MYREGRCOMP

13 Sep 2007

minor editing

20 May 2008

minor make-up

12 Jun 2008

Added PowerStudent to compute the power of t-Student tests on regression parameters.

12 Nov 2008

Changes in help section

23 Dec 2009

Changes in description

09 Mar 2010

To compute power, Myregr requires powerStudent by Trujillo-Ortiz, A. and R. Hernandez-Walls. If this function is not present on the computer, Sandler try to download it from FEX

12 Mar 2010

change in description

13 Jan 2011

Now Y can be a matrix of repeated measures

17 Nov 2011

The modified Levene's test for homoschedasticity of residuals and residuals plot were added

Tag Activity for this File
Tag Applied By Date/Time
statistics Giuseppe Cardillo 22 Oct 2008 09:17:58
probability Giuseppe Cardillo 22 Oct 2008 09:17:58
leastsquares linear regression Giuseppe Cardillo 22 Oct 2008 09:17:58
probability Cristina McIntire 12 Nov 2008 14:02:55
statistics Cristina McIntire 12 Nov 2008 14:02:55
least squares linear regression Giuseppe Cardillo 14 Jan 2011 09:12:52
statistics Bryna Flaim 15 Sep 2011 21:22:53

Contact us at files@mathworks.com