R/moran.exp.test.R

Defines functions moran.exp.test

Documented in moran.exp.test

moran.exp.test<-function(x, simulate.p.value=FALSE, nrepl=2000)
{
DNAME <- deparse(substitute(x))
l<-0
n<-length(x)
y<-mean(x)
t<--digamma(1) + mean(log(x/y))
if (simulate.p.value)
{
	for(i in 1:nrepl)
	{
	z<-rexp(n)
	y<-mean(z)
	t<--digamma(1) + mean(log(z/y))
	if (abs(T)>abs(t)) l=l+1
	}
	p.value<-l/nrepl
}
else
{
	p.value<-2*(1-pnorm(abs(sqrt(n)*t/sqrt(((pi^2)/6)-1))))
}
RVAL<-list(statistic=c(T=t), p.value=p.value, method="Moran test for exponentiality",data.name = DNAME)
class(RVAL)<-"htest"
return(RVAL)
}

Try the exptest package in your browser

Any scripts or data that you put into this service are public.

exptest documentation built on May 1, 2019, 8:01 p.m.