plotFit: Plot the predicted intensity of a fitted 'ppmlasso' model

View source: R/ppmlasso_functions.R

plotFitR Documentation

Plot the predicted intensity of a fitted ppmlasso model

Description

This function produces a levelplot of the predicted intensity from a fitted ppmlasso model.

Usage

plotFit(fit, pred.data = data.frame(X = fit$x[fit$pres == 0], 
Y = fit$y[fit$pres == 0], 1, scale(fit$data[fit$pres == 0, -1], 
center = -fit$s.means/fit$s.sds, scale = 1/fit$s.sds)), 
coord = c("X", "Y"), asp = "iso", ylab = "", xlab = "", 
col.regions = heat.colors(1024)[900:1], cuts = length(col.regions), 
cex = 1.4, main.text = paste(toupper(fit$criterion), "fit"), cex.color = 1.4)

Arguments

fit

A fitted ppmlasso object.

pred.data

A data frame which defines the coordinates and the environmental variables for which the predicted intensity will be calculated. By default, this uses the coordinates and environmental variables from the object supplied to the fit argument.

coord

A vector containing the names of the longitude and latitude coordinates, as in sampleQuad.

asp

Aspect of the plot, with "iso" as default. See the documentation for the levelplot function of the lattice pacakge for more details.

ylab

Label for the y-axis. Blank by default.

xlab

Label for the x-axis. Blank by default

col.regions

A vector of colours to define the intensity gradient. See the documentation for the levelplot function of the lattice pacakge for more details.

cuts

The number of levels the color gradient for the intensity surface is divided into. See the documentation for the levelplot function of the lattice pacakge for more details.

cex

Character size for axis labels.

main.text

Title of the plot.

cex.color

Character size for the colorkey labels.

Details

This function will compute the predicted intensity of a fitted ppmlasso object using the model within the regularisation path which optimises the criterion specified in the call to ppmlasso.

Author(s)

Ian W. Renner

Examples

data(BlueMountains)
sub.env = BlueMountains$env[BlueMountains$env$Y > 6270 & BlueMountains$env$X > 300,]
sub.euc = BlueMountains$eucalypt[BlueMountains$eucalypt$Y > 6270 & BlueMountains$eucalypt$X > 300,]
ppm.form = ~poly(FC, TMP_MIN, TMP_MAX, RAIN_ANN, degree = 2) + poly(D_MAIN_RDS, D_URBAN, degree = 2)
ppm.fit  = ppmlasso(ppm.form, sp.xy = sub.euc, env.grid = sub.env, sp.scale = 1, n.fits = 20,
writefile = FALSE)
plotFit(ppm.fit)

ppmlasso documentation built on Dec. 1, 2022, 5:09 p.m.