loglinb3: Loglinear Model for Three Binary Responses

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/family.loglin.R

Description

Fits a loglinear model to three binary responses.

Usage

1
loglinb3(exchangeable = FALSE, zero = c("u12", "u13", "u23"))

Arguments

exchangeable

Logical. If TRUE, the three marginal probabilities are constrained to be equal.

zero

Which linear/additive predictors are modelled as intercept-only? A NULL means none. See CommonVGAMffArguments for further information.

Details

The model is P(Y1=y1,Y2=y2,Y3=y3) =

exp(u0 + u1*y1 + u2*y2 + u3*y3 + u12*y1*y2 + u13*y1*y3+ u23*y2*y3)

where y1, y2 and y3 are 0 or 1, and the parameters are u1, u2, u3, u12, u13, u23. The normalizing parameter u0 can be expressed as a function of the other parameters. Note that a third-order association parameter, u123 for the product y1*y2*y3, is assumed to be zero for this family function.

The linear/additive predictors are (eta1,eta2,...,eta6) = (u1,u2,u3,u12,u13,u23).

Value

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 (Y1,Y2,Y3) = (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.

Note

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.

Author(s)

Thomas W. Yee

References

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.

See Also

loglinb2, hunua.

Examples

1
2
3
4
5
lfit <- vglm(cbind(cyadea, beitaw, kniexc) ~ altitude, loglinb3,
             data = hunua, trace = TRUE)
coef(lfit, matrix = TRUE)
head(fitted(lfit))
summary(lfit)

Example output

Loading required package: stats4
Loading required package: splines
VGLM    linear loop  1 :  loglikelihood = -747.96409
VGLM    linear loop  2 :  loglikelihood = -746.63769
VGLM    linear loop  3 :  loglikelihood = -746.63197
VGLM    linear loop  4 :  loglikelihood = -746.63169
VGLM    linear loop  5 :  loglikelihood = -746.63166
VGLM    linear loop  6 :  loglikelihood = -746.63166
VGLM    linear loop  7 :  loglikelihood = -746.63166
                      u1          u2          u3       u12       u13     u23
(Intercept) -0.977443113 -1.89016208 -0.37718273 0.6079861 0.1550313 1.11723
altitude    -0.000570124  0.00385029  0.00161104 0.0000000 0.0000000 0.00000
        000       001        010       011        100        101        110
1 0.2667112 0.2114476 0.05697031 0.1380439 0.09533643 0.08825711 0.03740342
2 0.2720142 0.2122054 0.05590845 0.1333059 0.09778795 0.08907985 0.03691613
3 0.2877835 0.2139148 0.05269713 0.1197206 0.10524166 0.09134649 0.03539596
4 0.2929812 0.2142980 0.05162252 0.1154050 0.10775504 0.09203332 0.03487242
5 0.2929812 0.2142980 0.05162252 0.1154050 0.10775504 0.09203332 0.03487242
6 0.2877835 0.2139148 0.05269713 0.1197206 0.10524166 0.09134649 0.03539596
         111
1 0.10583008
2 0.10278206
3 0.09389985
4 0.09103252
5 0.09103252
6 0.09389985

Call:
vglm(formula = cbind(cyadea, beitaw, kniexc) ~ altitude, family = loglinb3, 
    data = hunua, trace = TRUE)

Pearson residuals:
       Min      1Q   Median     3Q   Max
u1  -1.325 -0.7944 -0.43091 0.5469 3.412
u2  -2.666 -0.7271 -0.57177 0.6106 3.204
u3  -2.804 -1.0495  0.30218 0.8206 1.348
u12 -2.357 -0.7818  0.07661 0.2658 2.752
u13 -2.147 -0.7126  0.13442 0.7395 2.301
u23 -1.968 -0.8318  0.03498 0.8945 1.920

Coefficients: 
                Estimate Std. Error z value Pr(>|z|)    
(Intercept):1 -0.9774431  0.2222395  -4.398 1.09e-05 ***
(Intercept):2 -1.8901621  0.2647499  -7.139 9.37e-13 ***
(Intercept):3 -0.3771827  0.1969334  -1.915  0.05546 .  
(Intercept):4  0.6079861  0.2326655   2.613  0.00897 ** 
(Intercept):5  0.1550313  0.2467644   0.628  0.52984    
(Intercept):6  1.1172304  0.2456804   4.547 5.43e-06 ***
altitude:1    -0.0005701  0.0009213  -0.619  0.53602    
altitude:2     0.0038503  0.0009624   4.001 6.31e-05 ***
altitude:3     0.0016110  0.0009695   1.662  0.09657 .  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Number of linear predictors:  6 

Names of linear predictors: u1, u2, u3, u12, u13, u23

Log-likelihood: -746.6317 on 2343 degrees of freedom

Number of Fisher scoring iterations: 7 

No Hauck-Donner effect found in any of the estimates

VGAM documentation built on Jan. 16, 2021, 5:21 p.m.