Fits GLMs with random intercept by Maximum Likelihood and numerical integration via Gauss-Hermite quadrature.
glmmML(formula, family = binomial, data, cluster, weights,
cluster.weights, subset, na.action,
offset, contrasts = NULL, prior = c("gaussian", "logistic", "cauchy"),
start.coef = NULL, start.sigma = NULL, fix.sigma = FALSE, x = FALSE,
control = list(epsilon = 1e-08, maxit = 200, trace = FALSE),
method = c("Laplace", "ghq"), n.points = 8, boot = 0)
The return value is a list, an object of class 'glmmML'. The components are:
No. of boot replicates
Logical
Estimated regression coefficients
Their standard errors
The estimated random effects' standard deviation
Its standard error
The estimated variance-covariance matrix. The last
column/row corresponds to the standard
deviation of the random effects (sigma
)
AIC
Bootstrap p value from testing the null hypothesis of no random effect (sigma = 0)
Deviance
Logical
Degrees of freedom
Deviance from a glm with no
clustering. Subtracting deviance
gives a test statistic for
the null hypothesis of no clustering. Its asymptotic distribution is
a symmetric mixture a constant at zero and a chi-squared distribution
with one df. The printed p-value is based on this.
Its degrees of freedom
Estimated posterior modes of the random effects
The terms object
From hessian inversion. Should be 0. If not, no variances could be estimated. You could try fixing sigma at the estimated value and rerun.
Which prior was used?
The function call
The design matrix if asked for, otherwise not present
a symbolic description of the model to be fit. The details of model specification are given below.
Currently, the only valid values are binomial
and
poisson
. The binomial family allows for the logit
and
cloglog
links.
an optional data frame containing the variables in the model. By default the variables are taken from `environment(formula)', typically the environment from which `glmmML' is called.
Factor indicating which items are correlated.
Case weights. Defaults to one.
Cluster weights. Defaults to one.
an optional vector specifying a subset of observations to be used in the fitting process.
See glm.
starting values for the parameters in the linear predictor. Defaults to zero.
starting value for the mixing standard deviation. Defaults to 0.5.
Should sigma be fixed at start.sigma?
If TRUE, the design matrix is returned (as x).
this can be used to specify an a priori known component to be included in the linear predictor during fitting.
an optional list. See the 'contrasts.arg' of 'model.matrix.default'.
Which "prior" distribution (for the random effects)? Possible choices are "gaussian" (default), "logistic", and "cauchy".
Controls the convergence criteria. See
glm.control
for details.
There are two choices "Laplace" (default) and "ghq" (Gauss-Hermite).
Number of points in the Gauss-Hermite quadrature. If
n.points == 1, the Gauss-Hermite is the same as Laplace
approximation. If method
is set to "Laplace", this parameter
is ignored.
Do you want a bootstrap estimate of cluster effect? The default
is No (boot = 0
). If you want to say yes, enter a
positive integer here. It should be equal to the number of bootstrap
samples you want to draw. A recomended absolute minimum value is
boot = 2000
.
G\"oran Brostr\"om
The integrals in the log likelihood function are evaluated by the Laplace approximation (default) or Gauss-Hermite quadrature. The latter is now fully adaptive; however, only approximate estimates of variances are available for the Gauss-Hermite (n.points > 1) method.
For the binomial families, the response can be a two-column matrix, see the help page for glm for details.
Brostr\"om, G. and Holmberg, H. (2011). Generalized linear models with clustered data: Fixed and random effects models. Computational Statistics and Data Analysis 55:3123-3134.
id <- factor(rep(1:20, rep(5, 20)))
y <- rbinom(100, prob = rep(runif(20), rep(5, 20)), size = 1)
x <- rnorm(100)
dat <- data.frame(y = y, x = x, id = id)
glmmML(y ~ x, data = dat, cluster = id)
Run the code above in your browser using DataLab