show_lambda: Plot the estimated intensity from a fitted LGCP model

View source: R/plots.r

show_lambdaR Documentation

Plot the estimated intensity from a fitted LGCP model

Description

Plots the estimated spatial intensity from a fitted log-Gaussian Cox process model. If obj is a spatiotemporal model then timestamp provides control over which temporal index to plot the estimated spatial intensity.

Usage

show_lambda(
  obj,
  smesh,
  sf,
  tmesh,
  covariates,
  clip = FALSE,
  dims = c(500, 500),
  timestamp = 1
)

Arguments

obj

A fitted LGCP model object for, for example, fit_lgcp().

smesh

A Delaunay triangulation of the spatial domain returned by fmesher::fm_mesh_2d().

sf

An sf of type POLYGON specifying the spatial region of the domain.

tmesh

Optional, a temporal mesh returned by fmesher::fm_mesh_1d().

covariates

Optional, a matrix of covariates at each smesh and tmesh node combination.

clip

Logical, if TRUE then plotted values are 'clipped' to the domain supplied as sf.

dims

A numeric vector of length 2 specifying the spatial pixel resolution. Default c(500,500).

timestamp

The index of time stamp to plot. Default 1.

Value

A gg class object, values returned by geom_tile and geom_sf.

See Also

fit_lgcp, show_field, and get_fields

Examples


if(requireNamespace("fmesher")) {
data(xyt, package = "stelfi")
domain <- sf::st_as_sf(xyt$window)
locs <- data.frame(x = xyt$x, y = xyt$y)
bnd <- fmesher::fm_as_segm(as.matrix(sf::st_coordinates(domain)[, 1:2]))
smesh <- fmesher::fm_mesh_2d(boundary = bnd, max.edge = 0.75, cutoff = 0.3)
fit <- fit_lgcp(locs = locs, sf = domain, smesh = smesh,
parameters = c(beta = 0, log_tau = log(1), log_kappa = log(1)))
show_lambda(fit, smesh = smesh, sf = domain)
}


cmjt/stelfi documentation built on Oct. 25, 2023, 2:53 p.m.