smr_array creates a vector containing only the free parameters from an array
given a restriction family. exapand_array is the reverse
operation, expanding a complete array from the vector of sufficient statistics.
smr_array(theta, family)
expand_array(theta_vec, family, mrfi, C)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.
The family of parameter restrictions to potentials. Families
are:
'onepar', 'oneeach', 'absdif', 'dif' or 'free'.
See mrf2d-familiy.
A numeric vector with the free parameters of a potential
array. It's dimension depends on the restriction family, C and the number
of interacting positions on mrfi.
A mrfi object representing the
interaction structure.
The maximum value of the field.
smr_array returns a numeric vector with the free parameters of theta.
expand_array returns a three-dimensional array of potentials.
The order the parameters appear in the summarized vector matches
the order in smr_stat().
vec_description() provides a data.frame object describing
which are the relative positions and interactions associated with each
element of the summarized vector in the same order.
A paper with detailed description of the package can be found at doi: 10.18637/jss.v101.i08
smr_array(theta_potts, "onepar")
#> [1] -1
smr_array(theta_potts, "oneeach")
#> [1] -1 -1
expand_array(0.99, family = "onepar", mrfi = mrfi(1), C = 2)
#> , , (1,0)
#>
#> 0 1 2
#> 0 0.00 0.99 0.99
#> 1 0.99 0.00 0.99
#> 2 0.99 0.99 0.00
#>
#> , , (0,1)
#>
#> 0 1 2
#> 0 0.00 0.99 0.99
#> 1 0.99 0.00 0.99
#> 2 0.99 0.99 0.00
#>
expand_array(c(0.1, 0.2), family = "oneeach", mrfi = mrfi(1), C = 3)
#> , , (1,0)
#>
#> 0 1 2 3
#> 0 0.0 0.1 0.1 0.1
#> 1 0.1 0.0 0.1 0.1
#> 2 0.1 0.1 0.0 0.1
#> 3 0.1 0.1 0.1 0.0
#>
#> , , (0,1)
#>
#> 0 1 2 3
#> 0 0.0 0.2 0.2 0.2
#> 1 0.2 0.0 0.2 0.2
#> 2 0.2 0.2 0.0 0.2
#> 3 0.2 0.2 0.2 0.0
#>