View source: R/family.loglin.R
| loglinb3 | R Documentation |
Fits a loglinear model to three binary responses.
loglinb3(exchangeable = FALSE, zero = c("u12", "u13", "u23",
if (u123.arg) "u123" else NULL),
u123.arg = FALSE)
exchangeable |
Logical.
If |
zero |
Which linear/additive predictors
are modelled as intercept-only?
A |
u123.arg |
Logical.
Include the 3rd-order interaction |
The full model is
P(Y_1=y_1,Y_2=y_2,Y_3=y_3) =
\exp(u_0+u_1 y_1+u_2 y_2+u_3 y_3+u_{12} y_1 y_2+
u_{13} y_1 y_3+u_{23} y_2 y_3 +
u_{123} y_1 y_2 y_3 )
where y_1, y_2 and
y_3 are 0
or 1, and the parameters are u_1,
u_2,
u_3, u_{12},
u_{13},
u_{23}, and if
u123.arg then u_{123} too.
The normalizing parameter u_0 can
be expressed as a
function of the other parameters.
The the parameters are estimated by
identitylink.
Note that a third-order association parameter,
u_{123} for the product
y_1 y_2 y_3,
is assumed to be zero for this family function
by default;
it is estimated if u123.arg is TRUE.
Note the default for this argument might change
in the future.
The linear/additive predictors are,
for the full model,
(\eta_1,\eta_2,\ldots,\eta_6,\eta_7)^T =
(u_1,u_2,u_3,u_{12},u_{13},u_{23},u_{123})^T.
By default, the last element is not there since
u123.arg = FALSE.
An object of class "vglmff"
(see vglmff-class).
The object is used by modelling functions
such as vglm,
rrvglm and vgam.
When fitted,
the fitted.values slot of the object
contains the eight joint probabilities,
labelled as
(Y_1,Y_2,Y_3) = (0,0,0),
(0,0,1), (0,1,0),
(0,1,1), (1,0,0), (1,0,1), (1,1,0),
(1,1,1), respectively.
The response must be a 3-column matrix of ones and zeros only. Note that each of the 8 combinations of the multivariate response need to appear in the data set, therefore data sets will need to be large in order for this family function to work. After estimation, the response attached to the object is also a 3-column matrix; possibly in the future it might change into a 8-column matrix.
Thomas W. Yee and
Yunhao (Harry) Han who added u123.
Yee, T. W. and Wild, C. J. (2001). Discussion to: “Smoothing spline ANOVA for multivariate Bernoulli observations, with application to ophthalmology data (with discussion)” by Gao, F., Wahba, G., Klein, R., Klein, B. Journal of the American Statistical Association, 96, 127–160.
McCullagh, P. and Nelder, J. A. (1989). Generalized Linear Models, 2nd ed. London: Chapman & Hall.
binom3.or,
loglinb2,
loglinb4,
binom2.or,
hunua.
lfit1 <- vglm(cbind(cyadea, beitaw, kniexc) ~ altitude,
loglinb3, data = hunua, trace = TRUE)
coef(lfit1, matrix = TRUE)
lfit2 <- vglm(cbind(cyadea, beitaw, kniexc) ~ altitude,
loglinb3(u123 = TRUE), hunua, trace = TRUE)
coef(lfit2, matrix = TRUE)
head(fitted(lfit2))
summary(lfit2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.