Computes the pseudo-likelihood function of a Markov Random Field on a 2-dimensional lattice.
pl_mrf2d(Z, mrfi, theta, log_scale = TRUE)
A matrix
with integers in {0,...,C}
.
A mrfi
object representing the
interaction structure.
A 3-dimensional array describing potentials. Slices represent
interacting positions, rows represent pixel values and columns represent
neighbor values. As an example: theta[1,3,2]
has the potential for the
pair of values 0,2 observed in the second relative position of mrfi
.
A logical
value indicating whether the returned value
should be in logarithmic scale.
A numeric
with the pseudo-likelihood value.
The pseudo-likelihood function is defined as the product of conditional probabilities of each pixel given its neighbors:
$$\prod_i P(Z_i | Z_{{N}_i}, \theta).$$
A paper with detailed description of the package can be found at doi: 10.18637/jss.v101.i08 .
pl_mrf2d(Z_potts, mrfi(1), theta_potts)
#> [1] -10708.08