| Change Log {PtProcess} | R Documentation |
This page contains a listing of recent changes made to functions, and known general problems.
*.cif functions. In Version 2, these were referred to as “conditional intensity functions”, which is really a slightly more general class. In keeping with Daley & Vere-Jones (2003) we now call them ground intensity functions, with a suffix of “gif”. Further, the dot has been replaced by an underscore, e.g. etas.cif to etas_gif. This is to lessen the possibility of future conflicts with object orientated naming conventions in the R language. (28 Apr 2008)
eval.pts and t.plus in the ground intensity functions have been renamed to evalpts and tplus, respectively. This is to lessen the possibility of future conflicts with object orientated naming conventions in the R language. (28 Apr 2008)
logLik: the log-likelihood calculated in package Versions before Version 3 did not have the sum over the mark density term (see topic logLik, under “Details”). This term can also be excluded in this Version of the package by placing NULL for the mark density in the mpp object, see example below. (28 Apr 2008)
neglogLik for further details. (28 Apr 2008)
neglogLik: the format of this function has been changed to be consistent with that in package HiddenMarkov. Argument updatep renamed as pmap. (07 Aug 2008)
simulate: manual page revised to include more information about controlling the length of the simulated series. (18 Nov 2008)
mpp: example modified due to warning messages caused by negative lambda_g(t|Ht). (18 Nov 2008)
marks: manual page revised to include more information. (18 Nov 2008)
mpp: fuller description to argument marks on manual page. (19 Nov 2008)
Phuket: new dataset added. (4 Dec 2008)
linksrm_gif, marks: remove some LaTeX specific formatting to be compatible with R 2.9.0. (26 Jan 2009)
Phuket: clarify magnitude scale used in the dataset. (11 Jul 2009)
type is no longer required on the gif functions, removed. (7 Oct 2009)
logLik, neglogLik: Parallel processing support, using package snow, has been added. (8 Oct 2009)
plot: Correct hyperlink to generic plot function. (10 Oct 2009)
name of the gif function.
linksrm_gif: Use of St1 and St2. Is there a tidier way? Also utilise this feature in srm_gif.
forecast, to produce probability forecasts. This would be based on simulating empirical probability distributions.
linksrm_convert to map between the two main parametrisations of the ETAS model.
gif function into the mark distributions, if required.
# SRM: magnitude is iid exponential with bvalue=1
# simulate and calculate the log-likelihood
TT <- c(0, 1000)
bvalue <- 1
params <- c(-1.5, 0.01, 0.8, bvalue*log(10))
# --- Old Method ---
# x <- pp.sim(NULL, params[1:3], srm.cif, TT, seed=5, magn.sim=1)
# print(pp.LL(x, srm.cif, params[1:3], TT))
# [1] -601.3941
# --- New Method, no mark density ---
x1 <- mpp(data=NULL,
gif=srm_gif,
mark=list(NULL, rexp_mark),
params=params,
gmap=expression(params[1:3]),
mmap=expression(params[4]),
TT=TT)
x1 <- simulate(x1, seed=5)
print(logLik(x1))
# An advantage of the object orientated format is that it
# simplifies further analysis, e.g. plot intensity function:
plot(x1)
# plot the residual process:
plot(residuals(x1))
#---------------------------------------------------
# SRM: magnitude is iid exponential with bvalue=1
# simulate then estimate parameters from data
# --- Old Method ---
# TT <- c(0, 1000)
# bvalue <- 1
# params <- c(-2.5, 0.01, 0.8)
#
# x <- pp.sim(NULL, params, srm.cif, TT, seed=5, magn.sim=1)
#
# posterior <- make.posterior(x, srm.cif, TT)
#
# neg.posterior <- function(params){
# x <- -posterior(params)
# if (is.infinite(x) | is.na(x)) return(1e15)
# else return(x)
# }
#
# z <- nlm(neg.posterior, params, typsize=abs(params),
# iterlim=1000, print.level=2)
#
# print(z$estimate)
# [1] -2.83900091 0.01242595 0.78880647
# --- New Method, no mark density ---
# maximise only SRM parameters (like old method)
TT <- c(0, 1000)
bvalue <- 1
params <- c(-2.5, 0.01, 0.8, bvalue*log(10))
x1 <- mpp(data=NULL,
gif=srm_gif,
mark=list(dexp_mark, rexp_mark),
params=params,
gmap=expression(params[1:3]),
mmap=expression(params[4]),
TT=TT)
# note that dexp_mark above is not used below
# and could alternatively be replaced by NULL
x1 <- simulate(x1, seed=5)
# maximise only SRM parameters
onlysrm <- function(y, p){
# maps srm parameters into model object
# the exp rate for magnitudes is unchanged
y$params[1:3] <- p
return(y)
}
params <- c(-2.5, 0.01, 0.8)
z1 <- nlm(neglogLik, params, object=x1, pmap=onlysrm,
print.level=2, iterlim=500, typsize=abs(params))
print(z1$estimate)