# Example uses of the functions in "JointMLEFunctions.r" # NB most functions are not intended to be called directly. The two main functions for producing the diagnostic plots are # "NHPP.diag" and "Expl.diag" for the NHPP model, and bivariate exponential dependence model, respectively. source("~/.../JointMLEFunctions.r") # Required library ismev: library(ismev) ############################################################################################################# # NHPP examples ############### xnorm<-abs(rnorm(5000)) NHPP.diag(xnorm, k=30, q1=0) xexp<-rexp(10000) NHPP.diag(xexp, k=30, q1=0) xgamma<-rgamma(2000, 2, 5) NHPP.diag(xgamma, k=20, q1=0) # Use of other arguments: ######################### # View different plots: # White noise and Parameter Stability only NHPP.diag(xnorm, k=30, q1=0, plots=c("WN","PS")) # Likelihood ratio and White noise only NHPP.diag(xnorm, k=30, q1=0, plots=c("LRT","WN")) # Parameter Stability only NHPP.diag(xnorm, k=30, q1=0, plots=c("PS")) # Change size of markings etc by passing arguments through to "plot" NHPP.diag(xnorm, k=30, q1=0, cex.lab=2, cex.axis=2, cex.main=2) # Plot against raw threshold values rather than quantiles NHPP.diag(xnorm, k=30, q1=0, UseQuantiles=F) # Change the range of quantiles between which threshold selection is carried out: NHPP.diag(xnorm, k=30, q1=0.2, q2=0.95) ############################################################################################################# # Exponential examples ###################### library(mvtnorm) xbvn<-rmvnorm(6000, sigma=matrix(c(1,0.7,0.7,1),2,2)) # Transform margins to exponential xbvn.exp<- -log(1-pnorm(xbvn)) Expl.diag(apply(xbvn.exp,1,min), k=30, q1=0, param="Rate") Expl.diag(apply(xbvn.exp,1,min), k=30, q1=0, param="InvRate")