Binom3.or {VGAM} | R Documentation |
Trivariate Odds Ratio Model
Description
Density and random generation for a trivariate binary regression model using three odds ratios to measure dependencies.
Usage
dbinom3.or(mu1, mu2 = if (exchangeable) mu1 else
stop("'mu2' not specified"), mu3 = if (exchangeable)
mu3 else stop("'mu3' not specified"), oratio12 = 1,
oratio13 = 1, oratio23 = 1, exchangeable = FALSE,
jpmethod = c("min", "mean", "median", "max", "1", "2", "3"),
tol = 0.001, ErrorCheck = TRUE)
rbinom3.or(n, mu1, mu2 = if (exchangeable) mu1 else
stop("'mu2' not specified"), mu3 = if (exchangeable) mu1
else stop("'mu3' not specified"), oratio12 = 1,
oratio13 = 1, oratio23 = 1, exchangeable = FALSE,
jpmethod = c("min", "mean", "median", "max", "1", "2", "3"),
threeCols = TRUE, tol = 0.001, ErrorCheck = TRUE)
Arguments
n |
Same as in |
mu1 , mu2 , mu3 |
Same as in |
oratio12 , oratio13 , oratio23 |
Similar to |
exchangeable |
Similar to |
jpmethod |
Character, partial matching allowed,
the first choice is the default.
Joint probability method.
Using the notation of |
threeCols |
Logical.
If |
tol , ErrorCheck |
Same as |
Details
The function dbinom3.or
does not really
compute the density (because that does not
make sense here) but rather returns the eight
joint probabilities if the parameters are
in the parameter space.
Simulations have shown that if all the
marginal probabilities are uniformly
distributed and all the odds ratios
have a standard lognormal distribution
(with joint independence) then about
31 percent of the parameter space is valid.
With exchangeability, it is about 33 percent.
This means that binom3.or
has quite some severe limitations for
general use.
The function rbinom3.or
generates data
coming from a trivariate binary response model.
Valid data from this might be fitted with
the VGAM family function
binom3.or
.
Any invalid data (because the parameters
are outside the parameter space)
are NaN
s.
Value
The function dbinom3.or
returns a 8
column matrix of joint probabilities; each
row adds up to unity if the parameters are
in the parameter space.
If not, then NaN
s are returned.
The function rbinom3.or
returns
either a 3 or 8 column matrix of 1s and 0s,
depending on the argument threeCols
.
References
Yee, T. W. (2024). New regression methods for three or four binary responses. In preparation.
See Also
Examples
dbinom3.or(0.5, 0.5, 0.5, 1, 2, 2)
# Outside the parameter space:
dbinom3.or(0.9, 0.9, 0.9, 1, 2, 2)
## Not run: nn <- 100000
for (Exch in c(TRUE, FALSE)) {
zdata <- data.frame(orat12 = rlnorm(nn), p1 = runif(nn))
zdata <- transform(zdata,
orat13 = if (Exch) orat12 else rlnorm(nn),
orat23 = if (Exch) orat12 else rlnorm(nn),
p2 = if (Exch) p1 else runif(nn),
p3 = if (Exch) p1 else runif(nn))
mat1 <- with(zdata, dbinom3.or(p1, p2, p3,
orat12, orat13, orat23, exch = Exch))
# Important statistic: Pr(in the parameter space) =
print(1 - nrow(na.omit(mat1)) / nrow(mat1))
}
round(head(mat1), 4)
## End(Not run)