parres(model, covariate, ...,
smooth.effect=FALSE, subregion=NULL,
bw = "nrd0", adjust=1, from = NULL, to = NULL, n = 512,
bw.input = c("points", "quad"), bw.restrict=FALSE, covname)
"ppm"
)."x"
or "y"
referring to the Cartesian coordinates,
or one of the names of"owin"
)
specifying a subset of the spatial domain of the data.
The calculation will be confined to the data in this subregion.density.default
).density.default
).density.default
to
control the number and range of values at which the function
will be estimated.density.default
.subregion
."fv"
)
containing the values of the smoothed partial residual,
the estimated variance, and the fitted effect of the covariate.
Also belongs to the class "parres"
which has methods for print
and plot
.model
must be a fitted Poisson point process model.
The diagnostic works in two different ways:
[object Object],[object Object]
Alternatively covariate
can be one of the character strings
"x"
or "y"
signifying the Cartesian coordinates.
The behaviour here depends on whether the coordinate was one of the
canonical covariates in the model. If there is more than one canonical covariate in the model
that depends on the specified covariate
, then
the covariate effect is computed using all these canonical covariates.
For example in a log-quadratic model which includes the terms x
and
I(x^2)
, the quadratic effect involving both these terms
will be computed.
There are two choices for the algorithm.
If smooth.effect=TRUE
, the fitted covariate effect (according
to model
) is added to the point process residuals, then
smoothing is applied to these values. If smooth.effect=FALSE
,
the point process residuals are smoothed first, and then the fitted
covariate effect is added to the result.
The smoothing bandwidth is controlled by the arguments
bw
, adjust
, bw.input
and bw.restrict
.
If bw
is a numeric value, then
the bandwidth is taken to be adjust * bw
.
If bw
is a string representing a bandwidth selection rule
(recognised by density.default
)
then the bandwidth is selected by this rule.
The data used for automatic bandwidth selection are
specified by bw.input
and bw.restrict
.
If bw.input="points"
(the default) then bandwidth selection is
based on the covariate values at the points of the original point
pattern dataset to which the model was fitted.
If bw.input="quad"
then bandwidth selection is
based on the covariate values at every quadrature point used to
fit the model.
If bw.restrict=TRUE
then the bandwidth selection is performed
using only data from inside the subregion
.
addvar
,
rhohat
,
rho2hat
X <- rpoispp(function(x,y){exp(3+x+2*x^2)})
model <- ppm(X, ~x+y)
tra <- parres(model, "x")
plot(tra)
plot(parres(model, "x", subregion=square(0.5)))
model2 <- ppm(X, ~x+I(x^2)+y)
plot(parres(model2, "x"))
Z <- setcov(owin())
plot(parres(model2, Z))
Run the code above in your browser using DataLab