mrf_penalty.numeric | R Documentation |
First-order random walk MRF penalty from a numeric vector
## S3 method for class 'numeric'
mrf_penalty(
object,
type = c("linear", "cyclic"),
node_labels = NULL,
add_delta = FALSE,
end_points = NULL,
...
)
object |
an R object to create the MRF penalty from. |
type |
character; one of |
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. |
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.