View source: R/FindSplinePars.R
FindSplineParFNEXTR | R Documentation |
Find spline parameters for deformation using extremal dependence methods. Provides Frobenuis norm of difference between pairwise empircal and theoretical χ measures. Output to be minimised to estimate spline parameters.
FindSplineParFNEXTR( par, Gcoords, m.ind, emp.dep, type = c("CHI_BR", "CHI_q_IBR"), q = 0, 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 |
emp.dep |
A |
type |
|
q |
Threhold for χ_q(h^{*}_{ij}). Only needed if |
sphere.dis |
Is Spherical distance or Euclidean distance used? |
Frobenius norm of difference between theoretical χ(h^{*}_{ij}) or χ_{q}(h^{*}_{ij}) matrix and emp.chi
.
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]) } chi.emp<-function(U,V,z) sum((U>=z)&(V>=z))/sum(U>=z) q<-0.98 #Calculate pairwise empirical chi emp.chi<-matrix(rep(0,dim(Z_U)[2]^2),nrow=dim(Z_U)[2],ncol=dim(Z_U)[2]) for(i in 1:dim(Z_U)[2]){ for(j in 1:i){ emp.chi[i,j]<-chi.emp(Z_U[,i],Z_U[,j],q) } } emp.chi<-emp.chi+t(emp.chi) diag(emp.chi)<-diag(emp.chi)/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 Brown-Resnick theoretical chi function sdf<-optim(fn=FindSplineParFNEXTR,par=c(0.05,0.05,0,1,rep(0,2*m-6)),type="CHI_BR",sphere.dis=TRUE, Gcoords=Gcoords,m.ind=m.ind,control=list(maxit=2000), emp.dep=emp.chi, method = "Nelder-Mead") sdf<-optim(fn=FindSplineParFNEXTR,par=sdf$par,sphere.dis=TRUE,type="CHI_BR", Gcoords=Gcoords,m.ind=m.ind, control=list(maxit=2000), emp.dep=emp.chi,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.