View source: R/sim_Y_Binary_X.R
sim_Y_Binary_X | R Documentation |
N spatially dependent binary design vectors are simulated using
sim2D_binarymap
. These design vectors are used to then simulate
scalar outcomes that have one of Gaussian, Binomial, or Poisson
distributions.
sim_Y_Binary_X(
N,
B,
rand.err = 1,
dist,
incl.subjectID = TRUE,
binomial.method = "traditional",
count.method = "traditional",
Y.thresh = NULL,
print.out = FALSE,
xlim = c(0, 1),
ylim = c(0, 1),
im.res,
radius.bounds = c(0.02, 0.1),
lambda = 50,
random.lambda = FALSE,
lambda.sd = 10,
lambda.bound = NULL,
prior = "gamma",
sub.area = FALSE,
min.sa = c(0.1, 0.1),
max.sa = c(0.3, 0.3),
radius.bounds.min.sa = c(0.02, 0.05),
radius.bounds.max.sa = c(0.08, 0.15),
print.subj.sa = FALSE,
print.lambda = FALSE,
print.iter = FALSE
)
N |
A scalar value determining the number of images to create. |
B |
A vector parameter values; i.e. "betas". Note that
|
rand.err |
A scalar for the random error variance when
|
dist |
The distribution of the scalar outcome.
|
incl.subjectID |
When |
binomial.method |
One of |
count.method |
One of |
Y.thresh |
When |
print.out |
If
This is useful to see the effect of image parameter selection and beta parameter selection on distributional parameters for the outcome of interest. |
xlim, ylim |
These are the 2D image limits. Defaults for both are
|
im.res |
A vector specifying the dimension/resolution of the image. The first entry is the number of 'rows' in the lattice/image, and the second entry is the number of columns' in the lattice/image. |
radius.bounds |
A 2-element vector whose first and second entries
determine the minimum and maximum radius sizes, respectively; these will
be the bounds of the uniform distribution used to draw the radii. If
|
lambda |
A scalar value specifying the mean/intensity value of the
Poisson process. If |
random.lambda |
|
lambda.sd |
Only utilized when |
lambda.bound |
Only utilized when |
prior |
Only utilized when |
sub.area |
When |
min.sa, max.sa |
Only utilized when |
radius.bounds.min.sa, radius.bounds.max.sa |
Only utilized when
|
print.subj.sa, print.lambda, print.iter |
These arguments are either
|
A data frame where each row consists of a single subject's data. Col 1 is the outcome, Y, and each successive column contains the subject predictor values.
Careful parameter selection, i.e. B
, is necessary to ensure
that simulated outcomes are reasonable; in particular, counts arising from
the Poisson distribution can be unnaturally large.
Cressie+Wikle:2011sim2Dpredictr
\insertRefRipley:1987sim2Dpredictr
## Define non-zero beta values
Bex <- beta_builder(row.index = c(3, 3, 4),
col.index = c(3, 4, 3),
im.res = c(5, 5),
B0 = 0, B.values = rep(1/3, 3),
output.indices = FALSE)
## Simulate Datasets
## parameter values
Nex = 10
set.seed(28743)
Gauss.ex <- sim_Y_Binary_X(N = Nex,
B = Bex,
dist = "gaussian",
im.res = c(5, 5))
hist(Gauss.ex$Y)
## direct draws from binomial
Bin.ex <- sim_Y_Binary_X(N = Nex,
B = Bex,
im.res = c(5, 5),
dist = "binomial",
print.out = TRUE)
table(Bin.ex$Y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.