# varcount

##### Predicted Variance of the Number of Points

Given a fitted point process model, calculate the predicted variance
of the number of points in a nominated set `B`

.

##### Usage

`varcount(model, B, …, dimyx = NULL)`

##### Arguments

- model
A fitted point process model (object of class

`"ppm"`

,`"kppm"`

or`"dppm"`

).- B
A window (object of class

`"owin"`

specifying the region in which the points are counted. Alternatively a pixel image (object of class`"im"`

) or a function of spatial coordinates specifying a numerical weight for each random point.- …
Additional arguments passed to

`B`

when it is a function.- dimyx
Spatial resolution for the calculations. Argument passed to

`as.mask`

.

##### Details

This command calculates the variance of the number of points
falling in a specified window `B`

according to the `model`

.
It can also calculate the variance of a sum of weights attached
to each random point.

The `model`

should be a fitted point process model
(object of class `"ppm"`

, `"kppm"`

or `"dppm"`

).

If

`B`

is a window, this command calculates the variance of the number of points falling in`B`

, according to the fitted`model`

.If the

`model`

depends on spatial covariates other than the Cartesian coordinates, then`B`

should be a subset of the domain in which these covariates are defined.If

`B`

is a pixel image, this command calculates the variance of \(T = \sum_i B(x_i)\), the sum of the values of`B`

over all random points falling in the domain of the image.If the

`model`

depends on spatial covariates other than the Cartesian coordinates, then the domain of the pixel image,`as.owin(B)`

, should be a subset of the domain in which these covariates are defined.If

`B`

is a`function(x,y)`

or`function(x,y,...)`

this command calculates the variance of \(T = \sum_i B(x_i)\), the sum of the values of`B`

over all random points falling inside the window`W=as.owin(model)`

, the window in which the original data were observed.

The variance calculation involves the intensity and the
pair correlation function of the model.
The calculation is exact (up to discretisation error)
for models of class `"kppm"`

and `"dppm"`

,
and for Poisson point process models of class `"ppm"`

.
For Gibbs point process models of class `"ppm"`

the
calculation depends on the Poisson-saddlepoint approximations
to the intensity and pair correlation function, which are rough
approximations. The approximation is not yet implemented
for some Gibbs models.

##### Value

A single number.

##### See Also

##### Examples

```
# NOT RUN {
fitT <- kppm(redwood ~ 1, "Thomas")
B <- owin(c(0, 0.5), c(-0.5, 0))
varcount(fitT, B)
fitS <- ppm(swedishpines ~ 1, Strauss(9))
BS <- square(50)
varcount(fitS, BS)
# }
```

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