makepairs: Make pairs

View source: R/MakePairs.R

makepairsR Documentation

Make pairs

Description

Produce a list of all configurations of pairwise exceedances above some threshold u. Used in censored likelihood estimation.

Usage

makepairs(Z, u)

Arguments

Z

A N by d matrix.

u

Censoring threshold.

Value

List of four data frames. Each data frame has 4 columns and the rows sum to N*d*(d-1)/2. For each data frame the first two columns are the values and the last two are the indices for the location of these values in the columns of Z.

Component 1

Pairs of observations where both components exceed u.

Component 2

Pairs of observations where the first component exceeds u and the second equals u.

Component 3

Pairs of observations where the second component exceeds u and the first equals u.

Component 4

Pairs of observations where both components equal u.

Examples

#For a N by d matrix of data "Z" and d by 2 matrix of coordinates "Gcoords".
# We use a very small subset of data(Aus_Heat) as an example.
##THIS WILL TAKE A LONG TIME TO RUN WITH THE FULL DATASET##

data(Aus_Heat) 
Z<-Aus_Heat$Temp.[,1:3]
Gcoords<-Aus_Heat$coords[1:3,]

unif<-function(x) rank(x)/(length(x)+1)
Z_U<-Z
for(i in 1:dim(Z_U)[2]) Z_U[,i]<-unif(Z[,i]) # Transform to uniform margins
Z_Exp<-qexp(Z_U) #Transform to exponential margins

q<-0.98
u<-quantile(Z_Exp,prob=q) # Censoring threshold
# Create a list of length 4 of pairwise exceedances and index in coordinate matrix
Zpair<-makepairs(Z_Exp,u=u) 

Jbrich95/sdfExtreme documentation built on March 24, 2022, 11:15 a.m.