gof: gof

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

View source: R/gof.R

Description

Performs the nonparametric goodness of fit test on a single observation. It returns a test statistic for the observation, a vector of simulated test statistics, and a corresponding p value for a two tailed test.

Usage

1
gof(observed, simulated, weights = NULL)

Arguments

observed

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

simulated

A gof.preprocess object returned by gof.preprocess corresponding to the null distribution.

weights

If null, a default even weighting across the test statistics is used. Otherwise, a definite square matrix of length equal to the coordinates in the observation may be supplied. See gof.optimize for a function to optimize power the over the weighting matrix if a particular alternative is in mind.

Details

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

Value

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

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.

v.sim

The test statistics of the simulated draws from the null distribution.

Author(s)

Josh Lospinoso

References

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

See Also

snopgof

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# See ?snopgof for a full description.

# Standard MVN null distribution
m=1000; v=5;
null.obs = rnorm(v)

# Simulate 25 draws from the null distribution
null.sim = matrix(rnorm(m*v),m,v)

# Preprocess the simulations
(null.preproc = gof.preprocess(null.sim))

# Conduct the test
(x<-gof(null.obs, null.preproc))

# Plot the results
plot(x, standardize=TRUE)

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