Hadoop Online Training by Edureka

moranTest: Moran's Log Spacings Test

Description Usage Arguments Details Value Author(s) References Examples

Description

This function implements a goodness-of-fit test using Moran's log spacings statistic.

Usage

1
moranTest(x, densFn, param = NULL, ...)

Arguments

densFn

Character. The root name of the distribution to be tested.

x

Numeric. Vector of data to be tested.

param

Numeric. A vector giving the parameter values for the distribution specified by densFn. If no param values are specified, then the default parameter values of the distribution are used instead.

...

Additional arguments to allow specification of the parameters of the distribution other than specified by param.

Details

Moran(1951) gave a statistic for testing the goodness-of-fit of a random sample of x-values to a continuous univariate distribution with cumulative distribution function F(x, theta), where θ is a vector of known parameters. This function implements the Cheng and Stephens(1989) extended Moran test for unknown parameters.

The test statistic is

T(thetahat)=(M(thetahat)+1/2k-C1)/C2

Where M(\hat θ), the Moran statistic, is

M(θ)=-(log(y_1-y_0)+log(y_2-y_1)+...+log(y_m-y_{m-1}))

M(theta)=-(log(y_1-y_0)+log(y_2-y_1)+...+log(y_m-y_m-1))

This test has null hypothesis: H_0 : a random sample of n values of x comes from distribution F(x, theta), where theta is the vector of parameters. Here theta is expected to be the maximum likelihood estimate thetahat, an efficient estimate. The test rejects H_0 at significance level alpha if T(thetahat) > chisq(alpha, df = n).

Value

statistic

Numeric. The value of the Moran test statistic.

estimate

Numeric. A vector of parameter estimates for the tested distribution.

parameter

Numeric. The degrees of freedom for the Moran statistic.

p.value

Numeric. The p-value for the test

.

data.name

Character. A character string giving the name(s) of the data.

method

Character. Type of test performed.

Author(s)

David Scott d.scott@auckland.ac.nz, Xinxing Li xli053@aucklanduni.ac.nz

References

Cheng, R. C. & Stephens, M. A. (1989). A goodness-of-fit test using Moran's statistic with estimated parameters. Biometrika, 76, 385–92.

Moran, P. (1951). The random division of an interval—PartII. J. Roy. Statist. Soc. B, 13, 147–50.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
### Normal Distribution
x <- rnorm(100, mean = 0, sd = 1)
muhat <- mean(x)
sigmahat <- sqrt(var(x)*(100 - 1)/100)
result <- moranTest(x, "norm", mean = muhat, sd = sigmahat)
result

### Exponential Distribution
y <- rexp(200, rate = 3)
lambdahat <- 1/mean(y)
result <- moranTest(y, "exp", rate = lambdahat)
result


Search within the DistributionUtils package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.