## example
Bex1 <- beta_builder(row.index = c(5, 5, 6, 6),
col.index = c(5, 6, 5, 6),
im.res = c(10, 10),
B0 = 0, B.values = rep(1, 4))
## True non-zero parameters are locations 45, 46, 55, 56 in B
## i.e. locations (5, 5), (5, 6), (6, 5), (6, 6)
## Suppose that we index rows by i = 1, ... , I
## cols by j = 1, ... , J
## The index for a parameter is given by J * (i - 1) + j
## In this example, I = 10, J = 10; Thus:
## (5, 5) -> 10 * (5 - 1) + 5 = 45
## (5, 6) -> 10 * (5 - 1) + 6 = 46
## (6, 5) -> 10 * (6 - 1) + 5 = 55
## (6, 6) -> 10 * (6 - 1) + 6 = 45
Bex1
## length 101 (includes B0 w/ 100 variable parameter values)
length(Bex1$B)
## example: index.type = "rectangle"
Bex2 <- beta_builder(row.index = 12:15, col.index = 6:19,
im.res = c(20, 20), B0 = 16,
B.values = 1:(length(12:15) * length(6:19)),
index.type = "rectangle")
Bex2
matrix(Bex2$B[-1], nrow = 20, byrow = TRUE)
## example: index.type = "ellipse"
Bex3 <- beta_builder(row.index = 4, col.index = 5,
im.res = c(10, 10),
B0 = 16, B.values = 3,
index.type = "ellipse",
h = 5, w = 4)
Bex3
matrix(Bex3$B[-1], nrow = 10, byrow = TRUE)
## decaying parameter values
Bex4 <- beta_builder(row.index = 10, col.index = 20,
im.res = c(30, 30), B0 = 0, B.values = 10,
index.type = "decay", max.d = 7,
output.indices = FALSE)
inf_2D_image(B = Bex4, im.res = c(30, 30), binarize.B = FALSE)
Bex5 <- beta_builder(row.index = 4, col.index = 5,
im.res = c(10, 10),
B0 = 16, B.values = 5,
index.type = "ellipse",
h = 5, w = 4,
bayesian = TRUE,
bayesian.dist = "gaussian",
bayesian.scale = list("binary", c(0, 1, 0.25)))
inf_2D_image(B = Bex5$B, im.res = c(10, 10), binarize.B = FALSE)
Run the code above in your browser using DataLab