LogisticLogNormal
is the class for the usual logistic regression model
with a bivariate normal prior on the intercept and log slope.
Arguments
- mean
(
numeric
)
the prior mean vector.- cov
(
matrix
)
the prior covariance matrix. The precision matrixprec
is internally calculated as an inverse ofcov
.- ref_dose
(
number
)
the reference dose \(x*\) (strictly positive number).
Details
The covariate is the natural logarithm of the dose \(x\) divided by the reference dose \(x*\), i.e.: $$logit[p(x)] = alpha0 + alpha1 * log(x/x*),$$ where \(p(x)\) is the probability of observing a DLT for a given dose \(x\). The prior $$(alpha0, log(alpha1)) ~ Normal(mean, cov).$$
Examples
my_model <- LogisticLogNormal(
mean = c(-0.85, 1),
cov = matrix(c(1, -0.5, -0.5, 1), nrow = 2),
ref_dose = 50
)
my_model
#> An object of class "LogisticLogNormal"
#> Slot "params":
#> An object of class "ModelParamsNormal"
#> Slot "mean":
#> [1] -0.85 1.00
#>
#> Slot "cov":
#> [,1] [,2]
#> [1,] 1.0 -0.5
#> [2,] -0.5 1.0
#>
#> Slot "prec":
#> [,1] [,2]
#> [1,] 1.3333333 0.6666667
#> [2,] 0.6666667 1.3333333
#>
#>
#> Slot "ref_dose":
#> An object of class "positive_number"
#> [1] 50
#>
#> Slot "datamodel":
#> function() {
#> for (i in 1:nObs) {
#> logit(p[i]) <- alpha0 + alpha1 * log(x[i] / ref_dose)
#> y[i] ~ dbern(p[i])
#> }
#> }
#> <bytecode: 0x5576cfae1448>
#> <environment: 0x5576ce910390>
#>
#> Slot "priormodel":
#> function() {
#> theta ~ dmnorm(mean, prec)
#> alpha0 <- theta[1]
#> alpha1 <- exp(theta[2])
#> }
#> <bytecode: 0x5576cf652900>
#> <environment: 0x5576ce9105c0>
#>
#> Slot "modelspecs":
#> function(from_prior) {
#> ms <- list(mean = params@mean, prec = params@prec)
#> if (!from_prior) {
#> ms$ref_dose <- ref_dose
#> }
#> ms
#> }
#> <bytecode: 0x5576cf43e8d0>
#> <environment: 0x5576ce9105c0>
#>
#> Slot "init":
#> function() {
#> list(theta = c(0, 1))
#> }
#> <bytecode: 0x5576cf370ce8>
#> <environment: 0x5576ce9105c0>
#>
#> Slot "datanames":
#> [1] "nObs" "y" "x"
#>
#> Slot "datanames_prior":
#> character(0)
#>
#> Slot "sample":
#> [1] "alpha0" "alpha1"
#>