binnest  R Documentation 
binnest
is designed to handle binary and binomial data with two
levels of nesting. The first level is the individual and the second will
consist of clusters within individuals.
binnest(
response,
totals = NULL,
nest = NULL,
ccov = NULL,
tvcov = NULL,
mu = ~1,
re1 = ~1,
re2 = ~1,
preg = NULL,
pre1 = NULL,
pre2 = NULL,
binom.mix = c(10, 10),
binom.prob = c(0.5, 0.5),
fcalls = 900,
eps = 0.01,
print.level = 0
)
response 
A list of three column matrices with counts, corresponding
totals (not necessary if the response is binary), and (secondlevel)
nesting indicator for each individual, one matrix or dataframe of such
counts, or an object of class, response (created by

totals 
If 
nest 
If 
ccov 
If 
tvcov 
If 
mu 
If 
re1 
If 
re2 
If 
preg 
Initial parameter estimates for the fixed effect regression
model: either the model specified by 
pre1 
Initial parameter estimates for the first level of nesting
variance model: either the model specified by 
pre2 
Initial parameter estimates for the second level of nesting
variance model: either the model specified by 
binom.mix 
A vector of two values giving the totals for the binomial distributions used as the mixing distributions at the two levels of nesting. 
binom.prob 
A vector of two values giving the probabilities in the binomial distributions used as the mixing distributions at the two levels of nesting. If they are 0.5, the mixing distributions approximate normal mixing distributions; otherwise, they are skewed. 
fcalls 
Number of function calls allowed. 
eps 
Convergence criterion. 
print.level 
If 1, the iterations are printed out. 
The variance components at the two levels can only depend on the covariates
if response
has class, repeated
.
A list of classes binnest
is returned.
T.R. Ten Have and J.K. Lindsey
Ten Have, T.R., Kunselman, A.R., and Tran, L. (1999) Statistics in Medicine 18, 947960.
gar
, read.list
,
restovec
, rmna
,
tcctomat
, tvctomat
.
#y < rbind(matrix(rbinom(20,1,0.6), ncol=4),
# matrix(rbinom(20,1,0.4), ncol=4))
y < matrix(c(1,1,0,1,1,1,1,0,1,1,1,1,1,1,1,1,0,1,1,0,0,1,0,1,1,0,1,0,
1,1,1,1,1,1,1,1,0,1,1,0),nrow=10,ncol=4,byrow=TRUE)
resp < restovec(y, nest=1:4, times=FALSE)
ccov < tcctomat(c(rep(0,5),rep(1,5)), name="treatment")
reps < rmna(resp, ccov=ccov)
# two random effects
binnest(reps, mu=~treatment, preg=c(1,1), pre1=2, pre2=2)
# first level random effect only
binnest(reps, mu=~treatment, preg=c(1,1), pre1=1)
# second level random effect only
binnest(reps, mu=~treatment, preg=c(1,1), pre2=1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.