Last chance! 50% off unlimited learning
Sale ends in
detpointprocfamilyfun(kernel = NULL, specden = NULL, basis = "fourierbasis", convkernel = NULL, Kfun = NULL, valid = NULL, intensity = NULL, dim = 2, name = "User-defined", isotropic = TRUE, range = NULL, parbounds = NULL, specdenrange = NULL, startpar = NULL, ...)
NULL
. See Details.
NULL
. See Details.
NULL
. See Details.
NULL
. See Details.
NULL
. See Examples.
NULL
if the model family has no intensity
parameter.
NULL
. See Examples.
NULL
. See Examples.
NULL
.
NULL
. See Examples.
NULL
if it is unknown, but not both.
When both are supplied they must have the same arguments.
The first argument gives
the values at which the function should be evaluated. In general
the function should accept an $n$ by $d$ matrix or
data.frame
specifying $n (>=0)$
points in dimension $d$. If the model is isotropic it only needs to
accept a non-negative valued numeric of length $n$. (In fact
there is currently almost no support for non-isotropic models, so
it is recommended not to specify such a model.) The name
of this argument could be chosen freely, but $x$ is
recommended. The remaining arguments are the parameters of the
model. If one of these is an intensity parameter the name should
be mentioned in the argument intensity
. If one of these
specifies the dimension of the model it should be mentioned in the
argument dim
. The kernel and spectral density is with respect to a
specific set of basis functions, which is typically the Fourier
basis. However this can be changed to any user-supplied basis in
the argument basis
. If such an alternative is supplied it
must be the name of a function expecting the same arguments as
fourierbasis
and returning the results in the same
form as fourierbasis
.
If supplied, the arguments of convkernel must obey the
following: first argument should be like the first argument of
kernel and/or specden (see above). The second argument (preferably
called k
) should be the positive integer specifying how many times
the auto-convolution is done (i.e. the $k$ in $k$-fold
auto-convolution). The remaining arguments must agree with the
arguments of kernel
and/or specden
(see above).
If supplied, the arguments of Kfun
should be like the
arguments of kernel
and specden
(see above).
## Example of how to define the Gauss family
exGauss <- detpointprocfamilyfun(
name="Gaussian",
kernel=function(x, lambda, alpha, d){
lambda*exp(-(x/alpha)^2)
},
specden=function(x, lambda, alpha, d){
lambda * (sqrt(pi)*alpha)^d * exp(-(x*alpha*pi)^2)
},
convkernel=function(x, k, lambda, alpha, d){
logres <- k*log(lambda*pi*alpha^2) - log(pi*k*alpha^2) - x^2/(k*alpha^2)
return(exp(logres))
},
Kfun = function(x, lambda, alpha, d){
pi*x^2 - pi*alpha^2/2*(1-exp(-2*x^2/alpha^2))
},
valid=function(lambda, alpha, d){
lambda>0 && alpha>0 && d>=1 && lambda <= (sqrt(pi)*alpha)^(-d)
},
isotropic=TRUE,
intensity="lambda",
dim="d",
range=function(alpha, bound = .99){
if(missing(alpha))
stop("The parameter alpha is missing.")
if(!(is.numeric(bound)&&bound>0&&bound<1))
stop("Argument bound must be a numeric between 0 and 1.")
return(alpha*sqrt(-log(sqrt(1-bound))))
},
parbounds=function(name, lambda, alpha, d){
switch(name,
lambda = c(0, (sqrt(pi)*alpha)^(-d)),
alpha = c(0, lambda^(-1/d)/sqrt(pi)),
stop("Parameter name misspecified")
)
},
startpar=function(model, X){
rslt <- NULL
if("lambda" %in% model$freepar){
lambda <- intensity(X)
rslt <- c(rslt, "lambda" = lambda)
model <- update(model, lambda=lambda)
}
if("alpha" %in% model$freepar){
alpha <- .8*dppparbounds(model, "alpha")[2]
rslt <- c(rslt, "alpha" = alpha)
}
return(rslt)
}
)
exGauss
m <- exGauss(lambda=100, alpha=.05, d=2)
m
Run the code above in your browser using DataLab