01.03.2013 Views

Applied Statistics Using SPSS, STATISTICA, MATLAB and R

Applied Statistics Using SPSS, STATISTICA, MATLAB and R

Applied Statistics Using SPSS, STATISTICA, MATLAB and R

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

10.4 Assessing the Distribution of Directional Data 391<br />

Comm<strong>and</strong>s 10.5. <strong>MATLAB</strong> <strong>and</strong> R functions for computing statistical tests of<br />

directional data.<br />

<strong>MATLAB</strong><br />

R<br />

p=rayleigh(a)<br />

[u2,uc]=watson(a,f,alphal)<br />

[u2,uc]=watsonvmises(a,alphal)<br />

[fo,fc,k1,k2]=watswill(a1,a2,alpha)<br />

[w,wc]=unifscores(a,alpha)<br />

[gw,gc]=watsongw(a,alpha)<br />

rayleigh(a)<br />

unifscores(a,alpha)<br />

Function rayleigh(a) implements the Rayleigh test of uniformity for the data<br />

matrix a (circular or spherical data).<br />

Function watson implements the Watson goodness-of-fit test, returning the<br />

test statistic u2 <strong>and</strong> the critical value uc computed for the data vector a (circular<br />

data) with theoretical distribution values in f. Vector a must be previously sorted<br />

in ascending order (<strong>and</strong> f accordingly). The valid values of alphal are 1, 2, 3, 4<br />

<strong>and</strong> 5 for α = 0.1, 0.05, 0.025, 0.01 <strong>and</strong> 0.005, respectively.<br />

The watsonvmises function implements the Watson test assessing von<br />

Misesness at alphal level. No previous sorting of the circular data a is<br />

necessary.<br />

Function watswill implements the Watson-Williams two-sample test for von<br />

Mises populations, using samples a1 <strong>and</strong> a2 (circular or spherical data), at a<br />

significance level alpha. The observed test statistic <strong>and</strong> theoretical value are<br />

returned in fo <strong>and</strong> fc, respectively; k1 <strong>and</strong> k2 are the estimated concentrations.<br />

Function unifscores implements the uniform scores test at alpha level,<br />

returning the observed statistic w <strong>and</strong> the critical value wc. The first column of<br />

input matrix a must contain the circular data of all independent groups; the second<br />

column must contain the group codes from 1 through the highest code number.<br />

Function watsongw implements the Watson test of equality of means for<br />

independent spherical data samples. The first two columns of input matrix a<br />

contain the longitudes <strong>and</strong> colatitudes. The last column of a contains group codes,<br />

starting with 1. The function returns the observed test statistic gw <strong>and</strong> the critical<br />

value gc at alpha significance value.<br />

The R functions behave in the same way as their equivalent <strong>MATLAB</strong><br />

functions. For instance, Example 10.11 is solved in R with:<br />

> rayleigh(wdf)<br />

[1] 0.1906450<br />

> rayleigh(m1)<br />

[1] 1.242340e-13

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!