1.0

1.0 | 2 ratings Rate this file 10 Downloads (last 30 days) File Size: 2.08 KB File ID: #25534

Spearman’s Rho test

by Simone Fatichi

 

09 Oct 2009

Spearman’s Rho non-parametric trend test

| Watch this File

File Information
Description

The code performs Spearman's rho test. It tests the null hypothesis of trend absence in the vector V, against the alternative of trend.
The result of the test is returned in Td = 1 indicates positive trend Td = -1 indicates negative trends, i.e., a rejection of the null hypothesis at the alpha significance level. Td = 0 indicates a failure to reject the null hypothesis at the alpha significance level.

Required Products Statistics Toolbox
MATLAB release MATLAB 7.5 (R2007b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
23 Feb 2012 Narine Manukyan

Great code, works perfectly!
Thanks!

26 Feb 2012 Narine Manukyan

I just realized there is a big bug in the code, if you try v= [1 2 3 4 5], you will get 0, while there is obviously a positive trend.

16 Mar 2012 Simone Fatichi

I don’t think there is a bug in the code, if you give perfectly ranked data: [1 2 3 4 5], the code is simply not able to calculate the significance of the test, because rho is exactly equal to one. I would rather say that a warning message is missing for the rare case of a perfectly ranked time series.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
statistics Simone Fatichi 09 Oct 2009 11:36:01
spearman test Simone Fatichi 09 Oct 2009 11:36:01
daniel test Simone Fatichi 09 Oct 2009 11:36:01
trend test Simone Fatichi 09 Oct 2009 11:36:01
non parametric test Simone Fatichi 09 Oct 2009 11:36:01
hydrology Simone Fatichi 09 Oct 2009 11:36:01

Contact us at files@mathworks.com