File Exchange

image thumbnail

MyRegression

version 1.8 (5.09 KB) by

A simple function on LS linear regression with many informative outputs

3 Downloads

Updated

View License

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
- Deming regression parameters
- 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 will try to download it from FEX

My profile on LinkedIN http://it.linkedin.com/in/giuseppecardillo

Comments and Ratings (12)

Why people always talk before read? Robert Did you read "Description" and "Updates" sections before posting your comments?

Robert

Robert (view profile)

In the code you have a line where it tries to automatically download dependent software. That is a a super bad design and really puts a bad taste in ones mouth for your package. You should just tell people they need to download powerStudent and indicate the dependency.

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!

Suryo Kusumo

hamed nozari

very good. thanks

Kushsairy

useful for me

Oleg Komarov

Oleg Komarov (view profile)

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...

Ben

Ben (view profile)

C C

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

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!!!

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.

Updates

1.8

Deming's regression added

1.7

fixed a bug in plot computation

1.6

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

1.5

Now Y can be a matrix of repeated measures

1.4

change in description

1.3

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

1.2

Changes in description

1.1

Changes in help section

minor make-up

minor editing

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

Deep review

MATLAB Release
MATLAB 7.3 (R2006b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video