Learn R Programming

cope (version 0.2.3)

ComputeCope: Compute CoPE sets.

Description

Computes CoPE sets for the data Y using the algorithm from Sommerfeld, Sain and Schwartzman (2015).

Usage

ComputeCope(Z, level, X = NULL, w = NULL, correlation = NULL,
  corpar = NULL, groups = NULL, V = NULL, alpha = 0.1, N = 1000,
  mu = NULL, mask = NULL)

Arguments

Z
A list with components "x", "y" and "z". Here, x and y are the coordinates of the grid on which the data is observed and z is an array with dimensions c(length(x),length(y),n), containing the data. n is the number of observations.
level
The level of interest.
X
The design matrix of the linear model. If NULL, it is set to matrix(rep(1,dim(Y)[3]),ncol=1) corresponding to i.i.d. data.
w
A vector of length nrow(X) indicating the desired linear combination of coefficients to be used in inference, i.e., t(w) NULL, the default is c(1, rep(0, ncol(X) - 1)).
correlation
Type of correlation assumed for the spatially indexed indexed linear models. This is a string that is passed to the function gls from the nlme package. Defaults to NULL which corresponds to i.i.d. errors.
corpar
A list of parameters passed to the correlation function.
groups
A factor vector describing groups that are used in the correlation function. Should have the same length as X.
V
A 4-dimensional array containing the covariance matrix associated with each element of Z$z. See Details.
alpha
The significance level. Inclusion for CoPE sets holds with probability 1-alpha.
N
The number of bootstrap realizations to generate for determining the threshold.
mu
The true parameter function. Use the default NULL if unknown.
mask
Pixels outside the mask (i.e. where mask is == NA) are ignored.

Value

An object of class cope. A list containing the following
  • x, y: The grid coordinates from the input.
  • mu, level, tau, X, N, alpha, mask: The corresponding values from the input.
  • mu_hat, norm_est: The estimatot for mu and its normalized version.
  • a_MB, a_MB_true, a_Tay, a_Tay_true: Thresholds for the CoPE sets determined using the multiplier bootstrap or Taylor's method and the estimated or the true contour, respectively.
  • incl_MB, incl_MB_true, incl_Tay, incl_Tay_true: Booleans indicating whether inclusion of the excursion set in the upper CoPE set and inclusion of the lower CoPE set in the excursion set holds, when CoPE sets are determined by a_MB, a_MB_true, a_Tay or a_Tay_true, respectively. Only available if mu is given.

Details

The V argument is a 4-dimensional array containing the covariance matrices associated with Z$z. Specifically, V[i,j,,] is the covariance matrix of the data in Z$z[i,j,]. If V is specified, then the covariance matrix in each element of the array is used to transform X and the appropriate element of Z$z before fitting the linear model. This is used in place of estimating the covariance matrix withing the nlme::gls function.

References

M. Sommerfeld, S. Sain and A. Schwartzman. Confidence regions for excursion sets in asymptotically Gaussian random fields, with an application to climate. Preprint, 2015.

Examples

Run this code
# An example using the ToyNoise and ToySignal of this package.
## Not run: ------------------------------------
# n = 30
# Data = ToyNoise1(n = n)
# Data$z = Data$z + rep(ToySignal()$z, n)
# CopeSet = ComputeCope(Data,level=4/3, mu=ToySignal()$z)
# PlotCope(CopeSet)
## ---------------------------------------------

Run the code above in your browser using DataLab