Description Usage Arguments Value Note Examples
Fits a neutral model to an observed series of hotspot values in terms of standard deviation of environmental variables, spatial autocorrelation parameters, and number of iterations of spatial autocorrelation.
1 2 | fit_hotspot_model(z, nbs, wts, ac_type = "moran", ntests = 100,
verbose = FALSE, plot = FALSE)
|
z |
Vector of observed values to be tested |
nbs |
An |
wts |
Weighting factors for each neighbour; must have same length as nbs. Uniform weights used if not given. |
ac_type |
type of autocorrelation statistic to use in tests
( |
ntests |
Number of repeats of neutral model used to calculate mean rank–scale distribution |
verbose |
If TRUE, dump progress details to screen |
plot |
If TRUE, produces a plot of rank–scale distributions |
A vector of three values as estimated by the neutral model:
sd0 = standard deviation of normal distribution
alpha = temporal autocorrelation coefficient
niters = number of iterations of spatial autocorrelation
Fitting these neutral models is **not** a standard optimisation problem
because the models are very noisy. Although optim
with
method="SANN"
may be used, it often generates extremely large values
for alpha
(for example, > 10). DEoptim
could also be applied,
yet in generally does not explore anything useful—if given starting
parameters, it will generally remain exactly in that place.
The approach employed here reflects the comment of https://stat.ethz.ch/pipermail/r-help/2015-May/428751.html through simply producing regular series, fitting loess models, and taking the corresponding minima.
1 2 3 4 5 6 7 8 | ## Not run:
xy <- cbind (rep (seq (size), each=size), rep (seq (size), size))
dhi <- 1 # for rook; dhi=1.5 for queen
nbs <- spdep::dnearneigh (xy, 0, dhi)
z <- runif (length (nbs))
test <- fit_hotspot_model (z=z, nbs=dat$nbs, alpha=0.1, sd=0.1, ntests=100)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.