View source: R/FindSplineParsCOR.R
FindSplineParFNCOR | R Documentation |
Find spline parameters for deformation based on correlation methods. Either use the Frobenuis norm via type=="F-norm"
or the original Smith (1996) method via type=="Smith"
. Output to be minimised to estimate spline parameters.
FindSplineParFNCOR( par, Gcoords, m.ind, n = 0, emp.cor, type = c("F-norm", "Smith"), sphere.dis = FALSE )
par |
Parameter values φ=(b_{1},b_{2},ρ,κ,δ^{(1)}_{4}...δ^{(1)}_{m},δ^{(2)}_{4}...δ^{(2)}_{m}). If m < 4, δ parameters are not needed. |
Gcoords |
A |
m.ind |
A vector of length |
n |
Number of data points used to estimate |
emp.cor |
A |
type |
|
sphere.dis |
Is Spherical distance or Euclidean distance used? |
Frobenius norm of difference between theoretical ρ(h^{*}_{ij}) matrix and emp.cor
, or negative log-likelihood for a stationary Gaussian process fit using D-plane coordinates.
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 # Set number of anchor points m<-10 # Sample anchor points m.ind<-sample(1:dim(Gcoords)[1],m,replace=FALSE) #Transform to D-plane using Frobenius norm method sdf<-optim(fn=FindSplineParFNCOR,par=c(0.05,0.05,0,1,rep(0,2*m-6)), type="F-norm",sphere.dis=TRUE,Gcoords=Gcoords,m.ind=m.ind, control=list(maxit=2000), emp.cor=emp.cor,method = "Nelder-Mead") sdf<-try(optim(fn=FindSplineParFNCOR,par=sdf$par,sphere.dis=TRUE,type="F-norm", Gcoords=Gcoords,m.ind=m.ind, control=list(maxit=2000), emp.cor=emp.cor, method = "BFGS")) sdf$m.ind<-m.ind #Plot Dcoords Dcoords<-returnDcoord(sdf$par,Gcoords,sdf$m.ind,sphere.dis=TRUE) plot(Dcoords)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.