ad_ktest SYNOPSIS k-sample Anderson-Darling test USAGE p = ad_ktest ({X1, X2, ...} [,&statistic] [;qualifiers]) DESCRIPTION The `ad_ktest' function performs a k-sample Anderson-Darling test, which may be used to test the hypothesis that two or more statistical samples come from the same underlying parent population. The function returns the p-value representing the probability that the samples are consistent with a common parent distribution. If the last parameter is a reference, then the variable that it references will be set to the value of the statistic upon return. The paper that this test is based upon presents two statistical tests: one for continuous data where ties are improbable, and one for data where ties can occur. This function returns the p-value and statistic for the latter case. A qualifier may be used to obtain the p-value and statistic for the continuous case. QUALIFIERS ; pval2=&var: Set the variable `var' to the p-value for continuous case ; stat2=&var: Set the variable `var' to the statistic for the continuous case. NOTES The k-sample test was implemented from the equations found in Scholz F.W. and Stephens M.A., "K-Sample Anderson-Darling Tests", Journal of the American Statistical Association, Vol 82, 399 (1987). SEE ALSO ks_test2, ad_test -------------------------------------------------------------- ad_test SYNOPSIS Anderson-Darling test for normality USAGE pval = ad_test (X [,&statistic] [;qualifiers]) DESCRIPTION The `ad_test' function may be used to test the hypothesis that random samples `X' come from a normal distribution. It returns the p-value representing the probability of obtaining such a dataset under the assumption that the data represent random samples of the underlying distribution. If the optional second parameter is present, then it must be a reference to a variable that will be set to the value of the statistic upon return. QUALIFIERS ; mu=value: Specifies the known mean of the normal distribution. ; sigma: Specifies the known standard deviation of the normal distribution ; cdf: If present, the data will be interpreted as a CDFs of a known, but unspecified, distribution. NOTES For testing the hypothesis that a dataset is sampled from a known, not necessarily normal, distribution, convert the random samples into CDFs and pass those as the value of X to the `ad_test' function. Also use the `cdf' qualifier to let the function know that the values are CDFs and not random samples. When this is done, the values of the CDFs will range from 0 to 1, and the p-value returned by the function will be computed using an algorithm by Marsaglia and Marsaglia: Evaluating the Anderson-Darling Distribution, Journal of Statistical Software, Vol. 9, Issue 2, Feb 2004. SEE ALSO ad_ktest, ks_test, t_test, z_test, normal_cdf, -------------------------------------------------------------- median SYNOPSIS Compute the median of an array of values USAGE m = median (a [,i]) DESCRIPTION This function computes the median of an array of values. The median is defined to be the value such that half of the the array values will be less than or equal to the median value and the other half greater than or equal to the median value. If the array has an even number of values, then the median value will be the smallest value that is greater than or equal to half the values in the array. If called with a second argument, then the optional argument specifies the dimension of the array over which the median is to be taken. In this case, an array of one less dimension than the input array will be returned. NOTES This function makes a copy of the input array and then partially sorts the copy. For large arrays, it may be undesirable to allocate a separate copy. If memory use is to be minimized, the `median_nc' function should be used. SEE ALSO median_nc, mean -------------------------------------------------------------- median_nc SYNOPSIS Compute the median of an array USAGE m = median_nc (a [,i]) DESCRIPTION This function computes the median of an array. Unlike the `median' function, it does not make a temporary copy of the array and, as such, is more memory efficient at the expense increased run-time. See the `median' function for more information. SEE ALSO median, mean -------------------------------------------------------------- mean SYNOPSIS Compute the mean of the values in an array USAGE m = mean (a [,i]) DESCRIPTION This function computes the arithmetic mean of the values in an array. The optional parameter `i' may be used to specify the dimension over which the mean it to be take. The default is to compute the mean of all the elements. EXAMPLE Suppose that `a' is a two-dimensional MxN array. Then m = mean (a); will assign the mean of all the elements of `a' to `m'. In contrast, m0 = mean(a,0); m1 = mean(a,1); will assign the N element array to `m0', and an array of M elements to `m1'. Here, the jth element of `m0' is given by `mean(a[*,j])', and the jth element of `m1' is given by `mean(a[j,*])'. SEE ALSO stddev, median, kurtosis, skewness -------------------------------------------------------------- stddev SYNOPSIS Compute the standard deviation of an array of values USAGE s = stddev (a [,i]) DESCRIPTION This function computes the standard deviation of the values in the specified array. The optional parameter `i' may be used to specify the dimension over which the standard-deviation it to be taken. The default is to compute the standard deviation of all the elements. NOTES This function returns the unbiased N-1 form of the sample standard deviation. SEE ALSO mean, median, kurtosis, skewness -------------------------------------------------------------- skewness SYNOPSIS Compute the skewness of an array of values USAGE s = skewness (a) DESCRIPTION This function computes the so-called skewness of the array `a'. SEE ALSO mean, stddev, kurtosis -------------------------------------------------------------- kurtosis SYNOPSIS Compute the kurtosis of an array of values USAGE s = kurtosis (a) DESCRIPTION This function computes the so-called kurtosis of the array `a'. NOTES This function is defined such that the kurtosis of the normal distribution is 0, and is also known as the ``excess-kurtosis''. SEE ALSO mean, stddev, skewness -------------------------------------------------------------- binomial SYNOPSIS Compute binomial coefficients USAGE c = binomial (n [,m]) DESCRIPTION This function computes the binomial coefficients (n m) where (n m) is given by n!/(m!(n-m)!). If `m' is not provided, then an array of coefficients for m=0 to n will be returned. -------------------------------------------------------------- chisqr_cdf SYNOPSIS Compute the Chisqr CDF USAGE cdf = chisqr_cdf (Int_Type n, Double_Type d) DESCRIPTION This function returns the probability that a random number distributed according to the chi-squared distribution for `n' degrees of freedom will be less than the non-negative value `d'. NOTES The importance of this distribution arises from the fact that if `n' independent random variables `X_1,...X_n' are distributed according to a gaussian distribution with a mean of 0 and a variance of 1, then the sum X_1^2 + X_2^2 + ... + X_n^2 follows the chi-squared distribution with `n' degrees of freedom. SEE ALSO chisqr_test, poisson_cdf -------------------------------------------------------------- poisson_cdf SYNOPSIS Compute the Poisson CDF USAGE cdf = poisson_cdf (Double_Type m, Int_Type k) DESCRIPTION This function computes the CDF for the Poisson probability distribution parameterized by the value `m'. For values of `m>100' and `abs(m-k)= 1/2 (right-tail) side="<" : H0: P(X= Var[Y] (right-tail) side="<" : H0: Var[X] <= Var[Y] (left-tail) SEE ALSO f_cdf, ks_test2, chisqr_test -------------------------------------------------------------- t_test SYNOPSIS Perform a Student t-test USAGE pval = t_test (X, mu [,&t]) DESCRIPTION The one-sample t-test may be used to test that the population mean has a specified value under the null hypothesis. Here, `X' represents a random sample drawn from the population and `mu' is the specified mean of the population. This function computes Student's t-statistic and returns the p-value that the data X were randomly sampled from a population with the specified mean. If the optional parameter is passed to the function, then it must be a reference to a variable that, upon return, will be set to the value of the statistic. QUALIFIERS The following qualifiers may be used to specify a 1-sided test: side="<" Perform a left-tailed test side=">" Perform a right-tailed test NOTES While the parent population need not be normal, the test assumes that random samples drawn from this distribution have means that are normally distributed. Strictly speaking, this test should only be used if the variance of the data are equal to that of the assumed parent distribution. Use the Mann-Whitney-Wilcoxon (`mw_test') if the underlying distribution is non-normal. SEE ALSO mw_test, t_test2 -------------------------------------------------------------- t_test2 SYNOPSIS Perform a 2-sample Student t-test USAGE pval = t_test2 (X, Y [,&t]) DESCRIPTION This function compares two data sets `X' and `Y' using the Student t-statistic. It is assumed that the the parent populations are normally distributed with equal variance, but with possibly different means. The test is one that looks for differences in the means. NOTES The `welch_t_test2' function may be used if it is not known that the parent populations have the same variance. SEE ALSO t_test2, welch_t_test2, mw_test -------------------------------------------------------------- welch_t_test2 SYNOPSIS Perform Welch's t-test USAGE pval = welch_t_test2 (X, Y [,&t]) DESCRIPTION This function applies Welch's t-test to the 2 datasets `X' and `Y' and returns the p-value that the underlying populations have the same mean. The parent populations are assumed to be normally distributed, but need not have the same variance. If the optional parameter is passed to the function, then it must be a reference to a variable that, upon return, will be set to the value of the statistic. QUALIFIERS The following qualifiers may be used to specify a 1-sided test: side="<" Perform a left-tailed test side=">" Perform a right-tailed test SEE ALSO t_test2 -------------------------------------------------------------- z_test SYNOPSIS Perform a Z test USAGE pval = z_test (X, mu, sigma [,&z]) DESCRIPTION This function applies a Z test to the data `X' and returns the p-value that the data are consistent with a normally-distributed parent population with a mean of `mu' and a standard-deviation of `sigma'. If the optional parameter is passed to the function, then it must be a reference to a variable that, upon return, will be set to the value of the Z statistic. SEE ALSO t_test, mw_test -------------------------------------------------------------- kendall_tau SYNOPSIS Kendall's tau Correlation Test USAGE pval = kendall_tau (x, y [,&tau]) DESCRIPTION This function computes Kendall's tau statistic for the paired data values (x,y), which may or may not have ties. It returns the double-sided p-value associated with the statistic. NOTES The implementation is based upon Knight's O(nlogn) algorithm described in "A computer method for calculating Kendall’s tau with ungrouped data", Journal of the American Statistical Association, 61, 436-439. In the case of no ties, the exact p-value is computed when length(x) is less than 30 using algorithm 71 of Applied Statistics (1974) by Best and Gipps. If ties are present, the the p-value is computed based upon the normal distribution and a continuity correction. QUALIFIERS The following qualifiers may be used to specify a 1-sided test: side="<" Perform a left-tailed test side=">" Perform a right-tailed test SEE ALSO spearman_r, pearson_r, mann_kendall -------------------------------------------------------------- mann_kendall SYNOPSIS Mann-Kendall trend test USAGE pval = mann_kendall (y [,&tau]) DESCRIPTION The Mann-Kendall test is a non-parametric test that may be used to identify a trend in a set of serial data values. It is closely related to the Kendall's tau correlation test. The `mann_kendall' function returns the double-sided p-value that may be used as a basis for rejecting the the null-hypothesis that there is no trend in the data. QUALIFIERS The following qualifiers may be used to specify a 1-sided test: side="<" Perform a left-tailed test side=">" Perform a right-tailed test SEE ALSO spearman_r, pearson_r, mann_kendall -------------------------------------------------------------- pearson_r SYNOPSIS Compute Pearson's Correlation Coefficient USAGE pval = pearson_r (X, Y [,&r]) DESCRIPTION This function computes Pearson's r correlation coefficient of the two datasets `X' and `Y'. It returns the the p-value that `x' and `y' are mutually independent. If the optional parameter is passed to the function, then it must be a reference to a variable that, upon return, will be set to the value of the correlation coefficient. QUALIFIERS The following qualifiers may be used to specify a 1-sided test: side="<" Perform a left-tailed test side=">" Perform a right-tailed test SEE ALSO kendall_tau, spearman_r -------------------------------------------------------------- spearman_r SYNOPSIS Spearman's Rank Correlation test USAGE pval = spearman_r(x, y [,&r]) DESCRIPTION This function computes the Spearman rank correlation coefficient (r) and returns the p-value that `x' and `y' are mutually independent. If the optional parameter is passed to the function, then it must be a reference to a variable that, upon return, will be set to the value of the correlation coefficient. QUALIFIERS The following qualifiers may be used to specify a 1-sided test: side="<" Perform a left-tailed test side=">" Perform a right-tailed test SEE ALSO kendall_tau, pearson_r -------------------------------------------------------------- correlation SYNOPSIS Compute the sample correlation between two datasets USAGE c = correlation (x, y) DESCRIPTION This function computes Pearson's sample correlation coefficient between 2 arrays. It is assumed that the standard deviation of each array is finite and non-zero. The returned value falls in the range -1 to 1, with -1 indicating that the data are anti-correlated, and +1 indicating that the data are completely correlated. SEE ALSO covariance, stddev --------------------------------------------------------------