Compute Fitted Effect of a Spatial Covariate in a Point Process Model
Compute the intensity of a fitted point process model as a function of one of its covariates.
effectfun(model, covname, ...)
- A fitted point process model (object of class
- The name of the covariate. A character string.
- The fixed values of other covariates (in the form
name=value) if required.
model should be an object of class
"ppm" representing a point process model fitted to
point pattern data.
The model's trend formula should involve a spatial covariate
covname. This could be
representing one of the Cartesian coordinates.
More commonly the covariate
is another, external variable that was supplied when fitting the model.
effectfun computes the fitted intensity
of the point process
model as a function of the covariate
The return value can be plotted immediately, giving a
plot of the fitted intensity against the value of the covariate.
If the model also involves covariates other than
then these covariates will be held fixed. Values for
these other covariates must be provided as arguments
effectfun in the form
- A data frame containing a column of values of the covariate and a column
of values of the fitted intensity.
If the covariate named
covnameis numeric (rather than a factor or logical variable), the return value is also of class
"fv"so that it can be plotted immediately.
data(copper) X <- copper$SouthPoints D <- distmap(copper$SouthLines) fit <- ppm(X, ~polynom(Z, 7), covariates=list(Z=D)) plot(effectfun(fit, "Z")) fit <- ppm(X, ~x + polynom(Z, 5), covariates=list(Z=D)) plot(effectfun(fit, "Z", x=20)) fit <- ppm(X, ~x) plot(effectfun(fit, "x"))