gof.mhd.asymptotic: gof.mhd.asymptotic

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/gof.mhd.asymptotic.R

Description

Performs a Mahalanobis distance type goodness of fit test on a single observation. It returns a test statistic for the observation and a corresponding p value.

Usage

1
gof.mhd.asymptotic(observed, null.mean, null.cov, twoTailed = FALSE)

Arguments

observed

A vector valued numeric corresponding to the single observation over which goodness of fit is to be tested

null.mean

A vector valued numeric corresponding to the mean of the MVN null distribution.

null.cov

A matrix value corresponding to the covariance of the MVN null distribution.

twoTailed

A boolean indicating whether to conduct a two-tailed test on the Chi-squared distribution.

Details

See the working paper by Lospinoso and Snijders (2011) for more information.

Value

list(p=p, v.obs=testStatistic.observed)

p

p-value corresponding to the probability that, in a hypothetical long run of draws from the null distribution, we would observe evidence stronger in favor of rejection than the evidence we have currently observed.

v.obs

The test statistic of the observation.

Author(s)

Josh Lospinoso

References

http://stats.ox.ac.uk/~lospinos

See Also

snopgof

Examples

1
2
3
4
5
6
# Standard MVN null distribution, Receiver Operating Characteristic curve
null.mean = rep(0, 5)
null.cov = matrix(0,5,5)
diag(null.cov) <- 1
x<-sapply(1:5000, function (i) {gof.mhd.asymptotic(rnorm(5), null.mean, null.cov)$p})
plot(sort(x),main="ROC Curve for null distributed data")

snopgof documentation built on May 2, 2019, 6:09 p.m.