View source: R/basis.search.po.R
basis.search.po | R Documentation |
This function takes in a scampr model and fits increasingly dense regular grids of basis functions (of the type created by scampr::simple_basis
) to find an optimal basis function configuration according to either log-likelihood, AIC or BIC.
basis.search.po(
object,
metric = c("ll", "aic", "bic"),
return.model = TRUE,
max.basis.functions,
radius.type = c("diag", "limiting"),
bf.matrix.type = c("sparse", "dense"),
domain.data,
which.approx = c("variational", "laplace"),
start.nodes = 4,
search.rate = 1,
metric.tol = 0,
lag = 3
)
object |
a scampr model: object of class 'scampr' that provides the framework for the search algorithm. It is recommended that the model does not include spatial random effects to save the computational burden of fitting such a model first. |
metric |
a character string describing the metric upon which to choose the optimal basis function configuration. One of 'll' (log-Likelihood), 'aic' (Akaike Information Criterion), 'bic' (Bayesian Information Criterion). |
return.model |
a logical indicating whether to return the model with optimal basis function configuration according to |
max.basis.functions |
Optional. An integer describing a rough upper limit to the number of basis functions to search. Defaults to half the number of presences in the data sets. |
radius.type |
a character string describing the type of radius length to use. One of 'diag' = diagonal dist. between nodes or 'limiting' = sqrt(Domain Area)/log(k). |
bf.matrix.type |
a character string, one of 'sparse' or 'dense' indicating whether to use sparse or dense matrix computations for the basis functions created. |
domain.data |
Optional. A data frame of columns 'coord.names' that contains at least the extremities of the domain of interest. Useful to ensure the same basis function configurations are created by 'simple_basis' if comparing to various searches. |
which.approx |
a character string indicating the type of approximation to be used to marginalise over the spatial random effects. May be one of 'laplace' or 'variational' - the latter should result in faster search times. |
start.nodes |
an integer determining the effective number of basis functions to start the search from ( |
search.rate |
an integer determining the rate of increasingly dense basis function configurations trialled. Default is |
metric.tol |
a numeric describing the tolerance level for the search stopping rule. Specifically, the proportion of the metric (calculated from |
lag |
an integer determining the lag/window length for the moving average of the selection metric. Default is 3. |
Depends on return.model
: If TRUE
then the scampr
model fitted with the optimised basis function configuration. If FALSE
then a data.frame with columns including- 'nodes': number used in scampr::simple_basis to create basis configuration. 'k': the number of basis functions. 'radius': the radius of the basis function configuration. 'll': the fitting marginal log-likelihood. 'BIC': the corresponding Bayesian Info. Crit. 'cpu': the computation time for the model fits. 'convergence': indicator for whether the model converged properly (0 = convergence).
#' # Get the gorilla nesting data
dat <- gorillas
# Standardise the elevation covariate
dat$elev.std <- scale(dat$elevation)
# Fit an IPP model to the point pattern
m.ipp <- scampr(pres ~ elev.std, data = dat, model.type = "PO")
## Not run:
# Search through an increasingly dense regular grid of basis functions
res <- basis.search(m.ipp)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.