get.bf.matrix: Internal scampr function that calculates the basis function...

View source: R/get.bf.matrix.R

get.bf.matrixR 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'

Description

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'

Usage

get.bf.matrix(object, point.locations, bf.matrix.type = c("sparse", "dense"))

Arguments

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.

Value

a data.frame (sparse or dense depending on parameter bf.matrix.type)

Examples

# 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)

ElliotDovers/scampr documentation built on March 17, 2024, 3:27 p.m.