# effectfun

##### Compute Fitted Effect of a Spatial Covariate in a Point Process Model

Compute the trend or intensity of a fitted point process model as a function of one of its covariates.

##### Usage

`effectfun(model, covname, ..., se.fit=FALSE)`

##### Arguments

- model
- A fitted point process model (object of class
`"ppm"`

). - covname
- The name of the covariate. A character string.
- ...
- The fixed values of other covariates (in the form
`name=value`

) if required. - se.fit
- Logical. If
`TRUE`

, asymptotic standard errors of the estimates will be computed, together with a 95% confidence interval.

##### Details

The object `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
named `covname`

. This could be `"x"`

or `"y"`

representing one of the Cartesian coordinates.
More commonly the covariate
is another, external variable that was supplied when fitting the model.
The command `effectfun`

computes the fitted trend
of the point process `model`

as a function of the covariate
named `covname`

.
The return value can be plotted immediately, giving a
plot of the fitted trend against the value of the covariate.

If the model also involves covariates other than `covname`

,
then these covariates will be held fixed. Values for
these other covariates must be provided as arguments
to `effectfun`

in the form `name=value`

.

If `se.fit=TRUE`

, the algorithm also calculates
the asymptotic standard error of the fitted trend,
and a (pointwise) asymptotic 95% confidence interval for the
true trend.
This command is just a wrapper for the prediction method
`predict.ppm`

. For more complicated computations
about the fitted intensity, use `predict.ppm`

.

##### Value

- A data frame containing a column of values of the covariate and a column
of values of the fitted trend.
If
`se.fit=TRUE`

, there are 3 additional columns containing the standard error and the upper and lower limits of a confidence interval.If the covariate named

`covname`

is numeric (rather than a factor or logical variable), the return value is also of class`"fv"`

so that it can be plotted immediately.

##### Trend and intensity

For a Poisson point process model, the trend is the same as the
intensity of the point process. For a more general Gibbs model, the trend
is the first order potential in the model (the first order term in the
Gibbs representation). In Poisson or Gibbs models fitted by
`ppm`

, the trend is the only part of the model that
depends on the covariates.

##### See Also

##### Examples

```
data(copper)
X <- copper$SouthPoints
D <- distmap(copper$SouthLines)
fit <- ppm(X, ~polynom(Z, 5), covariates=list(Z=D))
plot(effectfun(fit, "Z"))
plot(effectfun(fit, "Z", se.fit=TRUE), shade=c("hi", "lo"))
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"))
```

*Documentation reproduced from package spatstat, version 1.34-1, License: GPL (>= 2)*