Learn R Programming

SpatialVx (version 1.0-3)

MCdof: Monte Carlo Degrees of Freedom

Description

Estimate the distribution of the proportion of spatial locations that contain significant correlations with randomly generated data along the lines of Livezey and Chen (1983).

Usage

MCdof(x, ntrials = 5000, field.sig = 0.05, zfun = "rnorm", zfun.args = NULL,
      which.test = c("t", "Z", "cor.test"), verbose = FALSE, ...)

sig.cor.t(r, len = 40, ...)

sig.cor.Z(r, len = 40, H0 = 0)

fisherz(r)

Value

MCdof returns a list object with components:

MCprops

numeric vector of length ntrials giving the proportion of locations with significant bias found by chance for each repition of the experiment.

minsigcov

single numeric giving the 1 - field.sig quantile of the resulting proportions given by MCprops.

sig.cor.t and sig.cor.Z return umeric vectors of p-values, and fisherz returns a numeric vector of test statistics.

Arguments

x

n by m numeric matrix whose rows represent temporal points, and whose columns are spatial locations.

ntrials

numeric/integer giving the number of times to generate random samples of size n, and correlate them with the columns of x.

field.sig

numeric between 0 and 1 giving the desired fields significance level.

zfun

character naming a random number generator that takes n (the size of the sample to be drawn) as an argument, and any other arguments necessary.

zfun.args

list object giving the values for additional arguments to the function named by zfun.

which.test

character naming which type of test to do (default, “t”, is a t-test, calls sig.cor.t). “Z” does Fisher's Z transform (calls sig.cor.Z). “cor.test” calls cor.test giving more options, but is also considerably slower than “t” or “Z”.

r

numeric giving the correlation value(s).

len

numeric giving the size of the data for the test.

H0

numeric giving the null hypothesis value (not used by MCdof).

verbose

logical, should progress information (including total run time) be printed to the screen?

...

optional arguments to sig.cor.t (not used), sig.cor.Z, or cor.test depending on argument which.test.

Author

Kimberly L. Elmore, Kim.Elmore “at” noaa.gov, and Eric Gilleland

Details

This function does the Livezey and Chen (1983) Monte Carlo step 2 (a) from Elmore et al. (2006). It generates a random sample of size n, and finds the p-values of a correlation test with this random sample and each column of x. From this, it estimates the proportion of spatial locations that could contain significant bias purely by chance.

References

Elmore, K. L., Baldwin, M. E. and Schultz, D. M. (2006) Field significance revisited: Spatial bias errors in forecasts as applied to the Eta model. Mon. Wea. Rev., 134, 519--531.

Livezey, R. E. and Chen, W. Y. (1983) Statistical field significance and its determination by Monte Carlo techniques. Mon. Wea. Rev., 111, 46--59.

See Also

spatbiasFS, LocSig, cor.test, rnorm, runif, rexp, rgamma

Examples

Run this code
data( "GFSNAMfcstEx" )
data( "GFSNAMobsEx" )
data( "GFSNAMlocEx" )

id <- GFSNAMlocEx[,"Lon"] >=-90 & GFSNAMlocEx[,"Lon"] <= -75 & GFSNAMlocEx[,"Lat"] <= 40

look <- MCdof(GFSNAMfcstEx[,id] - GFSNAMobsEx[,id], ntrials=500)

stats(look$MCprops)
look$minsigcov

fisherz( abs(cor(rnorm(10),rexp(10), use="pairwise.complete.obs")))

Run the code above in your browser using DataLab