Parameter estimation for Markov random fields via Pseudo-Likelihood function optimization. See pl_mrf2d for information on the Pseudo-Likelihood function.

fit_pl(
  Z,
  mrfi,
  family = "onepar",
  init = 0,
  optim_args = list(method = "BFGS"),
  return_optim = FALSE
)

Arguments

Z

A matrix object containing the observed MRF. NA values can be used to create a subregion of the lattice for non-rectangular data.

mrfi

A mrfi object representing the interaction structure.

family

The family of parameter restrictions to potentials. Families are: 'onepar', 'oneeach', 'absdif', 'dif' or 'free'. See mrf2d-familiy.

init

The initial value to be used in the optimization. It can be:

  • A valid array of parameter values according to family.

  • 0. If set to 0 an array with `0`` in all entries is created.

optim_args

Additional parameters passed to optim().

return_optim

logical indicating whether information from the optim() call are returned.

Value

An object of class mrfout with elements:

  • theta: The estimated array of potential values.

  • mrfi: The interaction structure considered.

  • family: The parameter restriction family considered.

  • method: The estimation method ("Pseudolikelihood").

  • value: The optimal pseudo-likelihood value.

  • opt.xxx(if return_optim is TRUE): Information returned by the optim() function used for the optimization.

See also

A paper with detailed description of the package can be found at doi: 10.18637/jss.v101.i08 .

Author

Victor Freguglia

Examples

fit_pl(Z_potts, mrfi(1), family = "onepar")
#> Model fitted via Pseudolikelihood 
#> 2 interacting positions: (1,0) (0,1) 
#> family: onepar 
fit_pl(Z_potts, mrfi(1), family = "oneeach")
#> Model fitted via Pseudolikelihood 
#> 2 interacting positions: (1,0) (0,1) 
#> family: oneeach 
fit_pl(Z_potts, mrfi(2), family = "onepar")
#> Model fitted via Pseudolikelihood 
#> 6 interacting positions: (1,0) (2,0) (-1,1) (0,1) (1,1) (0,2) 
#> family: onepar