mrf_penalty.numeric: First-order random walk MRF penalty from a numeric vector

mrf_penalty.numericR Documentation

First-order random walk MRF penalty from a numeric vector

Description

First-order random walk MRF penalty from a numeric vector

Usage

## S3 method for class 'numeric'
mrf_penalty(
  object,
  type = c("linear", "cyclic"),
  node_labels = NULL,
  add_delta = FALSE,
  end_points = NULL,
  ...
)

Arguments

object

an R object to create the MRF penalty from.

type

character; one of "linear" or "cyclic" indicating if the observations form a cyclic series or not.

node_labels

character; a vector of alternative labels for the levels of the factor.

add_delta

numeric or logical; either the numeric value to add to the diagonal of the MRF penalty matrix, or a logical value indicating if such an adjustment should be made. The default is to not alter the diagonal of the penalty matrix.

end_points

numeric; an optional vector of length 2 providing the end points of the period of cycle.

...

arguments passed to other methods.

Examples

# linear
p <- mrf_penalty(1:10)
as.matrix(p)

# cyclic
p <- mrf_penalty(1:10, type = "cyclic")
as.matrix(p)

# cyclic with user end points
p <- mrf_penalty(1:10, type = "cyclic", end_points = c(0,11))
as.matrix(p)

eric-pedersen/MRFtools documentation built on Jan. 28, 2024, 2:13 a.m.