Description Usage Arguments Details Value Author(s) References Examples

`BImm`

function performs binomial logistic mixed-effects models, i.e., it allows the inclusion of gaussian random effects in the linear predictor of a logistic 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`

.

1 |

`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 components/levels in each random effect of the model. It must be especified as a vector, where the 'i'th value must correspond with the number of random components of the 'i'th random effect. It must be only determined when we specify the random structure of the model by the model matrix of the random effects, |

`m` |
number of trials in each binomial observation. |

`data` |
an optional data frame, list or environment (or object coercible by |

`maxiter` |
the maximum number of iterations in the parameters estimation algorithm. Default 100. |

The model that is performed by this function is a especial case of generalized linear mixed models (GLMMs), in which conditioned on some random components the response variable has a binomial distribution. As in the binomial (logistic) regression a logit link function is applied to the probability parameter of the conditioned binomial distribution, allowing the inclusion of random effects in the linear predictor,

*logit(p)=X*beta+Z*u,*

where *p* is the probability parameter, *X* a full rank matrix composed by the covariables, *beta* the fixed effects, *Z* the design matrix for the random effects ang *u* are the random effects. These random effects are independent and have a normal distribution with the same variance and mean 0.

The model estimates the fixed effects, predicts the random effects, and gets the estimation of the random effects variance parameters.

The estimation procedure is done by likelihood approximation, via iteartive weighted least squares method. The process is performed in two steps: (i) fixed and random parameters are estimated for some given values of the random effects variance parameters, and (ii) random effects variance parameters are estimated for some given regression and random coefficients using a penalized profile likelihood. The estimation approach iterates between (i) and (ii) until convergence is obtained.

`BImm`

returns an object of class "`BImm`

".

The function `summary`

(i.e., `summary.BImm`

) can be used to obtain or print a summary of the results.

`fixed.coef` |
estimated value of the fixed coefficients in the regression. |

`fixed.vcov` |
variance and covariance matrix of the estimated fixed coefficients in 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. |

`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. |

`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. |

`balanced` |
if the conditional beta-binomial response variable is balanced it returns "yes", otherwise "no". |

`m` |
maximum score number in each binomial observation. |

`call` |
the matched call. |

`formula` |
the formula supplied. |

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

McCulloch C. E. & Searle S. R. (2001): Generalized, Linear, and Mixed Models, *Jhon Wiley & Sons*

Pawitan Y. (2001): In All Likelihood: Statistical Modelling and Inference Using Likelihood, *Oxford University Press*

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 | ```
set.seed(5)
# Fixing parameters for the simulation:
nObs <- 1000
m <- 10
beta <- c(1.5,-1.1)
sigma <- 0.8
# Simulating the covariate:
x <- runif(nObs,-5,5)
# Simulating the random effects:
z <- as.factor(rBI(nObs,5,0.5,2))
u <- rnorm(6,0,sigma)
# Getting the linear predictor and probability parameter.
X <- model.matrix(~x)
Z <- model.matrix(~z-1)
eta <- beta[1]+beta[2]*x+crossprod(t(Z),u)
p <- 1/(1+exp(-eta))
# Simulating the response variable
y <- rBI(nObs,m,p)
# Apply the model
model <- BImm(fixed.formula = y~x,random.formula = ~z,m=m)
model
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.