View source: R/SpecModel-generators.R
| LN2 | R Documentation |
A hierarchical model for datasets with systematic biases, where these biases are modelled as proportional differences.
LN2(
constraint,
structuralZeros = NULL,
concordances = list(),
sd = HalfT(),
add1 = TRUE
)
constraint |
An object of class |
structuralZeros |
Location of any structural zeros
in the data. An object of class |
concordances |
A named list of concordances used to
map between |
sd |
Standard deviation of data-level errors. Either a
fixed value or a prior distribution. The prior distribution
is specified via |
add1 |
Whether to add 1 to the response and exposure. |
When add1 is TRUE (the default), the
model assumes
y[i] + 1 \sim N(exposure[i] + 1 + alpha[j[i]], sd^2)
and when add1 is FALSE, the model
assumes
y[i] \sim N(exposure[i] + alpha[j[i]], sd^2)
.
The alpha term measures bias. It has
the same level of detail as the constraints,
which will almost always be less than the level of detail
of y.
The constraints are specified via a Values,
object composed of 0s, -1s, 1s, and NAs. A 0
implies that the bias term is set to 0; a
-1 implies that it must be negative; a 1
implies that it must be positive, and a NA
implies that there is no constraint.
Adding 1 to the response and exposure is a way of dealing with zeros in the response.
constraint <- ValuesOne(c(NA, NA, -1),
labels = c("0-19", "20-64", "65"),
name = "age")
spec <- LN2(constraint)
spec
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.