Description Usage Arguments Details Value Author(s) References See Also Examples
BBmm
function performs beta-binomial mixed-effects models, i.e., it allows the inclusion of gaussian random effects in the linear predictor of a logitic beta-binomial regression model.
The structure of the random part of the model can be expecified by two different ways: (i) determining the random.formula
argument, or (ii) especifying the model matrix of the random effects, Z
, and determining the number of random effects in each random component, nRandComp
.
The estimation of the parameters can also be done by means of two approaches: (i) BB-NR, special Newton-Raphson algorithm developed for beta-binomial mixed-effect models, and (ii) using the rootSolve
R-package.
1 2 |
fixed.formula |
an object of class |
random.formula |
an object of class |
Z |
the design matrix of the random effects. If the |
nRandComp |
the number of random effects in each random component of the model. It must be especified as a vector, where the 'i'th value must correspond with the number of random effects of the 'i'th random component. It must be only determined when we specify the random structure of the model by the model matrix of the random effects, |
m |
maximum score number in each beta-binomial observation. |
data |
an optional data frame, list or environment (or object coercible by |
method |
the methodology for performing the estimation of the parameters. Options "BB-NR" or "rootSolve". Default "BB-NR". |
maxiter |
the maximum number of iterations in the parameters estimation algorithm. Default 100. |
show |
the argument allows to show the partial results in each iteration. |
BBmm
function performs beta-binomial mixed effects models. It extends the beta-binomial logistic regression to the inclusion of random effects in the linear predictor of the model. The model is defined as, conditional on some gaussian random effects u the response variable y follows a beta-binomial distribution of parameters m, p and phi,
y|u \sim BB(m,p,phi), u \sim N(0,D)
where
log(p/(1-p))=X*beta+Z*u
and D is determined by some dispersion parameters icluded in the parameter vector theta.
The estimation of the regression paramters beta and the prediction of the random effects u is done via the extended likelihood, where the marginal likelihood is approximated to the h-likelihood by a first order Laplace approximation,
h=f(y|beta,u,theta)+f(u|theta)
The previous formula do not have a closed form and numerical methods are needed for the estimation precedure. Two approches are available in the function in order to perform the fixed and random effects estimation: (i) A special case of a Newton-Raphson algorithm developed for beta-binomial mixed-effects model estimations, and (ii) the general Newton-Raphson algorithm available in R-package rootSolve
.
On the other hand, the estimation of dispersion parameters by the h-likelihood can be bias due to the estimation of the regression parameters. Consequenlty, a penalization of the h-likelihood must be performed to get an unbiased profile h-likelihood of the dispersion parameters. Lee and Nelder (1996) proposed the adjusted profile h-likelihood, where the following penalization is applied,
h(theta)=h+(1/2)*log[det(2π H^{-1})]
where H is the Hessian matrix of the model, and the terms beta and u involved in the previous formula are replaced by their estimates.
The method iterates between both estimation processes until convergence is reached.
BBmm
returns an object of class "BBmm
".
The function summary
(i.e., summary.BBmm
) can be used to obtain or print a summary of the results..
fixed.coef |
estimated value of the fixed coefficients of the regression. |
fixed.vcov |
variance and covariance matrix of the estimated fixed coefficients of the regression. |
random.coef |
predicted random effects of the regression. |
sigma.coef |
estimated value of the random effects variance parameters. |
sigma.var |
variance of the estimated value of the random effects variance parameters. |
phi.coef |
estimated value of the dispersion parameter of the conditional beta-binomial distribution. |
psi.coef |
estimated value of the logrithm of the dispersion parameter of the conditional beta-binomial distribution. |
psi.var |
variance of the estimation of the logarithm of the conditional beta-binomial distribution. |
fitted.values |
the fitted mean values of the probability parameter of the conditional beta-binomial distribution. |
conv |
convergence of the methodology. If the method has converged it returns "yes", otherwise "no". |
deviance |
deviance of the model. |
df |
degrees of freedom of the model. |
null.deviance |
null-deviance, deviance of the null model. The null model will only include an intercept as the estimation of the probability parameter. |
null.df |
degrees of freedom of the null model. |
nRand |
number of random effects. |
nComp |
number of random components. |
nRandComp |
number of random effects in each random component of the model. |
namesRand |
names of the random components. |
iter |
number of iterations in the estimation method. |
nObs |
number of observations in the data. |
y |
dependent response variable in the model. |
X |
model matrix of the fixed effects. |
Z |
model matrix of the random effects. |
D |
variance and covariance matrix of the random effects. |
balanced |
if the response dependent variable is balanced it returns "yes", otherwise "no". |
m |
maximum score number in each beta-binomial observation. |
call |
the matched call. |
formula |
the formula supplied. |
conv |
the convergence of the algorithm. |
J. Najera-Zuloaga
D.-J. Lee
I. Arostegui
Breslow N. E. & Calyton D. G. (1993): Approximate Inference in Generalized Linear Mixed Models, Journal of the American Statistical Association, 88, 9-25
Lee Y. & Nelder J. A. (1996): Hierarchical generalized linear models, Journal of the Royal Statistical Society. Series B, 58, 619-678
Najera-Zuloaga J., Lee D.-J. & Arostegui I. (2018): A beta-binomial mixed-effects model approach for analysing longitudinal discrete and bounded outcomes, to appear in Biometrical Journal.
The multiroot
and uniroot
functions of the R-package rootSolve
for the general Newton-Raphson algorithm.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | set.seed(14)
# Defining the parameters
k <- 100
m <- 10
phi <- 0.5
beta <- c(1.5,-1.1)
sigma <- 0.5
# Simulating the covariate and random effects
x <- runif(k,0,10)
X <- model.matrix(~x)
z <- as.factor(rBI(k,4,0.5,2))
Z <- model.matrix(~z-1)
u <- rnorm(5,0,sigma)
# The linear predictor and simulated response variable
eta <- beta[1]+beta[2]*x+crossprod(t(Z),u)
p <- 1/(1+exp(-eta))
y <- rBB(k,m,p,phi)
dat <- data.frame(cbind(y,x,z))
dat$z <- as.factor(dat$z)
# Apply the model
model <- BBmm(fixed.formula = y~x,random.formula = ~z,m=m,data=dat)
model
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.