Learn R Programming

BayesBD (version 1.2)

par2obs: Simulate binary intensity images

Description

The generated data \(Y ~ Bernoulli(p)\) is the image intensity, where the success probability \(p\) is determined by whether the location \(X\), given by polar coords \((r,\theta)\), is inside the boundary or not.

Usage

par2obs(m, pi.in, pi.out, design, center, gamma.fun)

Arguments

m

\(m * m\) observations will be generated over the unit square centered at (0,0).

pi.in

The success probability, \(P(Y_i = 1)\), where \(Y_i\) is intensity of pixel \(i\) if the location is inside the boundary.

pi.out

The success probability, \(P(Y_i = 1)\), where \(Y_i\) is intensity of pixel \(i\) if the location is outside the boundary.

design

Taking values: 'D' for deterministic (equally-spaced grid) design, 'U' for completely uniformly random, or 'J' for jitteredly random design.

center

a two-dimensional vector of Euclidean coordinates (x,y) of the reference point.

gamma.fun

The function to generate boundaries, see ellipse or triangle2.

Examples

Run this code
# NOT RUN {
set.seed(2015)
# use ellipse boundary
gamma.fun = ellipse(a = 0.35, b = 0.25)
obs = par2obs(m = 100, pi.in = 0.5, pi.out = 0.2, design = 'J', center = c(0.5,0.5), gamma.fun)
plotBD(obs)
# }

Run the code above in your browser using DataLab