nllMSPexp | R Documentation |
Calculate the negative composite censored log-likelihood for the stationary Brown-Resnick process on standard exponential margins.
nllMSPexp(par, ZBE, ZXE, ZYE, ZNE, coord, n.a, sphere.dis = F)
par |
Stationary semivariogram parameters (κ,λ). |
ZBE |
A list of length |
ZXE |
A list of length |
ZYE |
A list of length |
ZNE |
A list of length |
coord |
A |
n.a |
A vector with length determined by the number of unique pairs in |
sphere.dis |
Is Spherical distance or Euclidean distance used? |
Negative composite censored log-likelihood for Brown-Resnick process.
# 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## library(fields) 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) #Identify number of non-exceedances per pair #Speeds up likelihood computation dist<-rdist(Gcoords+runif(dim(Gcoords)[1]*2,0,1)) dist2<-apply(Zpair[[4]][,3:4],1,function(x){dist[x[1],x[2]]}) unique.d<-as.matrix(unique(dist2)) n.a<-rep(0, dim(unique.d)[1]) for(i in 1:length(unique.d)){ n.a[i]<-sum(dist2==unique.d[i,1]) } #WARNING- pairwise likelihoods take some time to run # Brown-Resnick process fit to G-plane coordinate system likG.MSP<-optim(fn=nllMSPexp,par=c(1.4,500),ZBE=as.matrix(Zpair[[1]]), ZXE=as.matrix(Zpair[[2]]), ZYE=as.matrix(Zpair[[3]]),ZNE=as.matrix(Zpair[[4]]), n.a=n.a,sphere.dis=TRUE,coord=Gcoords, control=list(maxit=2000), method = "Nelder-Mead",hessian=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.