# rmhmodel.ppm

##### Interpret Fitted Model for Metropolis-Hastings Simulation.

Converts a fitted point process model into a format that can be used to simulate the model by the Metropolis-Hastings algorithm.

##### Usage

```
# S3 method for ppm
rmhmodel(model, w, ..., verbose=TRUE, project=TRUE,
control=rmhcontrol(),
new.coef=NULL)
```

##### Arguments

- model
Fitted point process model (object of class

`"ppm"`

).- w
Optional. Window in which the simulations should be generated.

- …
Ignored.

- verbose
Logical flag indicating whether to print progress reports while the model is being converted.

- project
Logical flag indicating what to do if the fitted model does not correspond to a valid point process. See Details.

- control
Parameters determining the iterative behaviour of the simulation algorithm. Passed to

`rmhcontrol`

.- new.coef
New values for the canonical parameters of the model. A numeric vector of the same length as

`coef(model)`

.

##### Details

The generic function `rmhmodel`

takes a
description of a point process model in some format, and
converts it into an object of class `"rmhmodel"`

so that simulations of the model can be generated using
the Metropolis-Hastings algorithm `rmh`

.

This function `rmhmodel.ppm`

is the method for
the class `"ppm"`

of fitted point process models.

The argument `model`

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

) typically obtained from the
model-fitting function `ppm`

.
This will be converted into an object of class `"rmhmodel"`

.

The optional argument `w`

specifies the window
in which the pattern is to be generated. If specified, it must be in
a form which can be coerced to an object of class `owin`

by `as.owin`

.

Not all fitted point process models
obtained from `ppm`

can be simulated.
We have not yet implemented simulation code for
the `LennardJones`

and `OrdThresh`

models.

It is also possible that a fitted point process model
obtained from `ppm`

may not correspond to a valid
point process. For example a fitted model with the `Strauss`

interpoint interaction may have any value of the interaction parameter
\(\gamma\); however the Strauss
process is not well-defined for
\(\gamma > 1\) (Kelly and Ripley, 1976).

The argument `project`

determines what to do in such cases.
If `project=FALSE`

, a fatal error will occur.
If `project=TRUE`

, the fitted model parameters will be
adjusted to the nearest values which do correspond to a valid
point process. For example a Strauss process with \(\gamma >
1\) will be projected to a Strauss process with
\(\gamma = 1\), equivalent to a Poisson process.

##### Value

An object of class `"rmhmodel"`

, which is essentially
a list of parameter values for the model.

There is a `print`

method for this class, which prints
a sensible description of the model chosen.

##### References

Diggle, P. J. (2003) *Statistical Analysis of Spatial Point
Patterns* (2nd ed.) Arnold, London.

Diggle, P.J. and Gratton, R.J. (1984)
Monte Carlo methods of inference for implicit statistical models.
*Journal of the Royal Statistical Society, series B*
**46**, 193 -- 212.

Geyer, C.J. (1999)
Likelihood Inference for Spatial Point
Processes. Chapter 3 in O.E. Barndorff-Nielsen, W.S. Kendall and
M.N.M. Van Lieshout (eds) *Stochastic Geometry: Likelihood and
Computation*, Chapman and Hall / CRC, Monographs on Statistics and
Applied Probability, number 80. Pages 79--140.

Kelly, F.P. and Ripley, B.D. (1976)
On Strauss's model for clustering.
*Biometrika* **63**, 357--360.

##### See Also

`rmhmodel`

,
`rmhmodel.list`

,
`rmhmodel.default`

,
`rmh`

,
`rmhcontrol`

,
`rmhstart`

,
`ppm`

,
`AreaInter`

, `BadGey`

, `DiggleGatesStibbard`

, `DiggleGratton`

, `Fiksel`

, `Geyer`

, `Hardcore`

, `Hybrid`

, `LennardJones`

, `MultiStrauss`

, `MultiStraussHard`

, `PairPiece`

, `Penttinen`

, `Poisson`

, `Softcore`

, `Strauss`

, `StraussHard`

and `Triplets`

.

##### Examples

```
# NOT RUN {
fit1 <- ppm(cells ~1, Strauss(0.07))
mod1 <- rmhmodel(fit1)
fit2 <- ppm(cells ~x, Geyer(0.07, 2))
mod2 <- rmhmodel(fit2)
fit3 <- ppm(cells ~x, Hardcore(0.07))
mod3 <- rmhmodel(fit3)
# Then rmh(mod1), etc
# }
```

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