plot_search: Plot basis function search results - for objects of class...

View source: R/plot_search.R

plot_searchR Documentation

Description

Plots the results of a simple basis function search created by scampr::basis.search().

Usage

plot_search(x, ..., plot.metric = 1)

Arguments

x

a scampr model fitted via basis.search() or object of class 'basis.search'

...

additional plotting arguments

plot.metric

one or more numbers from 1 to 3 indicating the metric(s) to be plotted. 1: Fitted approximate log-likelihood. 2: Akaike's Information Criterion. 3: Bayesian Information Criterion

Examples

# Get the flora data for one of the species
dat_po <- flora$po$sp1
dat_pa <- flora$pa

# obtain a sample of 10,000 quadrature points for the point process model
set.seed(1)
quad.pts <- flora$quad[sample(1:nrow(flora$quad), 10000, replace = F), ]
set.seed(NULL)

# Attach the quadrature points to the presence-only data
dat_po <- rbind.data.frame(dat_po, quad.pts)

# Ensure the "response" variable in each data set shares the same name
dat_po$presence <- dat_po$pres
dat_pa$presence <- dat_pa$sp1

# Fit an integrated data model without a latent effects to initialise the basis search
base.idm <- scampr(presence ~ MNT, dat_po, bias.formula = ~ D.Main,
pa.data = dat_pa, include.sre = F, model.type = "IDM", latent.po.biasing = F)

# Perform the basis search and fit the optimised model
idm <- basis.search(base.idm, return.model = TRUE)

# Plot the search results
plot_search(idm)

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