View source: R/get.bf.matrix.R
get.bf.matrix | R Documentation |
Internal scampr function that calculates the basis function evaluations at point locations provided. From either a fitted model or data.frame of class 'bf.df'
get.bf.matrix(object, point.locations, bf.matrix.type = c("sparse", "dense"))
object |
either a fitted model or data.frame of class 'bf.df' created by 'simple_basis' |
point.locations |
either a matrix or data.frame describing the point locations in the same order as in 'object' |
bf.matrix.type |
a character string, one of 'sparse' or 'dense' indicating whether to create sparse or dense matrix. |
a data.frame (sparse or dense depending on parameter bf.matrix.type)
# Get the gorilla nesting data
dat <- gorillas
# Standardise the elevation covariate
dat$elev.std <- scale(dat$elevation)
# Set up a simple 2D grid of basis functions to fit a LGCP model to the data
bfs <- simple_basis(nodes.on.long.edge = 9, data = dat)
# Fit a LGCP model using variational approximation
m.lgcp_va <- scampr(pres ~ elev.std, data = dat, model.type = "PO", basis.functions = bfs)
# Get some new locations
new.sites <- dat[sample(1:nrow(dat), 10), c("x", "y")]
# Calculate the basis function matrix at the new sites
scampr:::get.bf.matrix(m.lgcp_va, new.sites)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.