Compute pointwise statistics from the simulated function values in an envelope object.
ptwise.envelope(object,
stats=c("mean", "median", "bias",
"var", "sd", "se", "mse", "rmse",
"confint", "predint"),
...,
level=0.95, transform=NULL, theo=NULL)bias.envelope(object, theo, CI=TRUE, level=0.95)
RMSE.envelope(object, theo)
A function value table (object of class "fv"
) containing
some or all of the
following columns
Distance argument \(r\)
Pointwise sample mean
Pointwise sample median
Pointwise estimated bias
Pointwise sample variance
Pointwise sample standard deviation
Pointwise standard error of pointwise mean
Pointwise estimated mean squared error
Pointwise estimated root-mean-squared error
Pointwise confidence interval for the true mean
Pointwise prediction interval for the function value
An object of class "envelope"
generated by the function envelope
Summary statistic(s) to be calculated. A character string
or character vector (partially matched) selected from the
options given, or a function(x)
provided by the user
to compute the summary statistic.
Arguments passed to stats
if it is a function.
Confidence level required for confint
or predint
.
A probability value between 0 and 1.
Optional expression (passed to
with.fv
)
which should be applied to the function values
before the summary statistics are calculated.
Function in the R language that evaluates the
true (theoretically expected) value of the
spatial summary function. This is required
if stats
includes "bias"
, "mse"
or "rmse"
.
Logical value specifying whether to calculate confidence interval as well as bias.
Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner rolfturner@posteo.net and Ege Rubak rubak@math.aau.dk, Tilman Davies Tilman.Davies@otago.ac.nz and Martin Hazelton Martin.Hazelton@otago.ac.nz.
These functions compute pointwise summary statistics from \(n\) spatial summary functions which were obtained from \(n\) simulated point patterns.
The object
should have been generated by the
function envelope
with the argument savefuns=TRUE
specified.
The function envelope
is normally used to
generate simulation envelopes for a particular spatial summary function,
such as the \(K\) function, by simulating \(n\) realisations
of Complete Spatial Randomness or another model.
However, when envelope
is called with
the argument savefuns=TRUE
, it returns all the individual
summary functions for the \(n\) simulated point patterns.
These individual functions are extracted by ptwise.envelope
which then computes the desired summary statistics.
The argument stats
specifies the desired summary statistics.
It can be a character string, or vector of character strings,
containing any of the following (partially matched):
the pointwise sample mean of the functions
the pointwise sample median of the functions
the pointwise bias of the functions
the pointwise sample variance of the functions
the pointwise sample standard deviation of the functions
the standard error of the pointwise sample mean
the pointwise mean squared error
the pointwise root-mean-squared error
a confidence interval for the true mean
a prediction interval for the function value
For confint
or predint
the argument level
specifies the confidence level.
Alternatively, the argument stats
can be a user-specified
function in the R language, which computes the summary statistic.
It should accept a vector argument and return a single numerical value.
The result is an object of class "fv"
that can be plotted
directly. See the Examples for different styles of plot.
The functions bias.envelope
and RMSE.envelope
are
wrappers for ptwise.envelope
which calculate the bias
and root-mean-square error respectively.
ISB.envelope
,
IV.envelope
,
ISE.envelope
,
MISE.envelope
.
E <- envelope(cells, Kest, nsim=20, savefuns=TRUE)
plot(ptwise.envelope(E, c("mean", "confint"), level=0.9))
plot(ptwise.envelope(E, max, na.rm=TRUE))
## statistics for L function
plot(ptwise.envelope(E, c("mean","confint"),
transform=quote(sqrt(./pi)), level=0.9))
## calculate pointwise bias and RMSE
## using the theoretical true value K(r) = pi * r^2
trueK <- function(r) { pi * r^2 }
plot(bias.envelope(E, theo=trueK))
plot(RMSE.envelope(E, theo=trueK))
Run the code above in your browser using DataLab