Last chance! 50% off unlimited learning
Sale ends in
mbinomial(mvar = NULL, link = "logit", earg = list(),
parallel = TRUE, smallno = .Machine$double.eps^(3/4))
factor
.Links
and CommonVGAMffArguments
.TRUE
otherwise there will be
too many parameters to estimate.
See CommonVGAMffArguments
for more information."vglmff"
(see vglmff-class
).
The object is used by modelling functions such as vglm
and vgam
.
The example below has been run successfully with n = 700
(this corresponds to $C = 350$) but only on a big machine
and it took over 10 minutes. The large model matrix was 670Mb.
parallel = TRUE
).
Let $C$ be the number of matched sets.
This mvar
argument must be a
factor
.
Consequently, the model matrix contains an intercept plus one
column for each level of the factor (except the first (this is
the default in R)).
Altogether there are $C$ columns.
The algorithm here constructs a different constraint matrix for
each of the $C$ columns.
Pregibon, D. (1984) Data analytic methods for matched case-control studies. Biometrics, 40, 639--651.
Chapter 7 of Breslow, N. E. and Day, N. E. (1980) Statistical Methods in Cancer Research I: The Analysis of Case-Control Studies. Lyon: International Agency for Research on Cancer.
Holford, T. R. and White, C. and Kelsey, J. L. (1978) Multivariate analysis for matched case-control studies. American Journal of Epidemiology, 107, 245--256.
binomialff
.# Cf. Hastie and Tibshirani (1990) p.209. The variable n must be even.
# Here, the intercept for each matched set accounts for x3 which is
# the confounder or matching variable.
n = 700 # Requires a big machine with lots of memory. Expensive wrt time
n = 100 # This requires a reasonably big machine.
mydat = data.frame(x2 = rnorm(n), x3 = rep(rnorm(n/2), each = 2))
xmat = with(mydat, cbind(x2, x3))
mydat = transform(mydat, eta = -0.1 + 0.2 * x2 + 0.3 * x3)
etamat = with(mydat, matrix(eta, n/2, 2))
condmu = exp(etamat[, 1]) / (exp(etamat[, 1]) + exp(etamat[, 2]))
y1 = ifelse(runif(n/2) < condmu, 1, 0)
y = cbind(y1, 1 - y1)
mydat = transform(mydat, y = c(y1, 1-y1),
ID = factor(c(row(etamat))))
fit = vglm(y ~ 1 + ID + x2, trace = TRUE,
fam = mbinomial(mvar = ~ ID - 1), data = mydat)
dimnames(coef(fit, matrix = TRUE))
coef(fit, matrix = TRUE)
summary(fit)
head(fitted(fit))
objsizemb = function(object) round(object.size(object) / 2^20, dig = 2)
objsizemb(fit) # in Mb
VLMX = model.matrix(fit, type = "vlm") # The big model matrix
dim(VLMX)
objsizemb(VLMX) # in Mb
rm(VLMX)
Run the code above in your browser using DataLab