BBreg
function fits a beta-binomial logistic regression model, i.e., it links the probability parameter of a beta-binomial distribution with the given covariates by means of a logistic link function. The estimation of the parameters in the model is done via maximum likelihood estimation.BBreg(formula,m,data,maxiter=100)
"formula"
(or one that can be coerced to that class): a symbolic description of the model to be fitted.as.data.frame
to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula).BBreg
returns an object of class "BBreg
". The function summary
(i.e., summary.BBreg
) can be used to obtain or print a summary of the results. # We simulate a covariate, fix the paramters of the beta-binomial
# distribution and simulate a response variable.
# Then we apply the model, and try to get the same values.
set.seed(18)
k <- 1000
m <- 10
x <- rnorm(k,5,3)
beta <- c(-10,2)
p <- 1/(1+exp(-(beta[1]+beta[2]*x)))
phi <- 1.2
y <- rBB(k,m,p,phi)
model <- BBreg(y~x,m)
model
Run the code above in your browser using DataLab