sdf.heur.Cor: Heuristic for creating bijective deformations (Correlation)

View source: R/sdfheurCOR.R

sdf.heur.CorR Documentation

Heuristic for creating bijective deformations (Correlation)

Description

This algorithm uses FindSplineParFNCOR to create a deformation with m.init inital anchor points. The initial anchor points are the last m.init entries of Full.m.ind. After creating this deformation, the spline values are used as initial parameters in creating a deformation with m.init+1 anchor points. This iterative procedure repeats until a deformation with all Full.m.ind anchor points is created.

Usage

sdf.heur.Cor(
  m.init,
  Full.m.ind,
  Gcoords,
  emp.cor,
  type = c("F-norm", "Smith"),
  n = 0,
  par = NULL,
  sphere.dis = F
)

Arguments

m.init

Number of inital anchor points. Must have m.init < length(Full.m.ind).

Full.m.ind

Full vector of indices for anchor points in Gcoords.

Gcoords

A d by 2 matrix of G-plane coordinates.

emp.cor

A d by d matrix of pairwise empirical correlation values.

type

"F-norm" for Frobenius norm method using theoretical ρ(h^{*}_{ij}) from a Matérn correlation model. "Smith" for original Smith (1996) method, also using Matérn correlation model.

n

Number of data points used to estimate emp.cor. Only neccesary for type=="Smith".

par

Initial parameters for first deformation. If not stated, initial parameters are given.

sphere.dis

Is Spherical distance or Euclidean distance used?

Value

List with three elements:

par

Spline parameter values.

value

Objective value from final optimisation.

m.ind

Vector of indices for full set of anchor points.

Examples

data("Aus_Heat")

Z<-Aus_Heat$Temp.
Gcoords<-Aus_Heat$coords

Z_U<-Z

unif<-function(x){rank(x)/(length(x)+1)}

#Transform to uniform margins
for(i in 1:dim(Z_U)[2]){

  Z_U[,i]<-unif(Z[,i])
}


#Transform to Gaussian margins

Z_N<-qnorm(Z_U)

#Calculate pairwise empirical correlation
emp.cor<-matrix(rep(0,dim(Z_N)[2]^2),nrow=dim(Z_N)[2],ncol=dim(Z_N)[2])
for(i in 1:dim(Z_N)[2]){
  for(j in 1:i){

    emp.cor[i,j]<-cor(Z_N[,i],Z_N[,j])
  }

}
emp.cor<-emp.cor+t(emp.cor)
diag(emp.cor)<-diag(emp.cor)/2


m.init<-6
Full.m.ind<-sample(1:dim(Gcoords)[1],m.init+2)

#Transform to D-plane using Smith (1996) method

##WARNING: This may take a while to run.
sdf<-sdf.heur.Cor(m.init,Full.m.ind,Gcoords,emp.cor,type="Smith",n=dim(Z)[1],sphere.dis=TRUE)

#Plot Dcoords

Dcoords<-returnDcoord(sdf$par,Gcoords,sdf$m.ind,sphere.dis=TRUE)
plot(Dcoords,main="D-plane",ylab="",xlab="")

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