getRho | R Documentation |
The intra-class correlation is calculated as
(1+exp(\theta))^{-1}
, where \theta
is the
estimate given by the formula specified in the argument
dispformula
.
getRho(obj, varMult = FALSE)
obj |
glmmTMB model object with betabinomial error, and with a 'dispformula' argument supplied. |
varMult |
If |
The variance for the betabinomial model is then
obtained by multiplying the binomial variance by
1+(n-1)\rho
, where $n$ is the binomial 'size'.
if varMult==FALSE
return (as a vector) the estimates
\rho
, else (varMult==TRUE
) return
list(rho, mult)
.
pcheck <- suppressWarnings(requireNamespace("glmmTMB", quietly = TRUE))
if(pcheck) pcheck & packageVersion("glmmTMB") >= "1.1.2"
if(pcheck){
form <- cbind(Dead,Live)~0+trtGp/TrtTime+(1|trtGpRep)
HawMed <- droplevels(subset(HawCon, CN=="MedFly"&LifestageTrt!="Egg"))
HawMed <- within(HawMed,
{trtGp <- factor(paste0(CN,LifestageTrt, sep=":"))
trtGpRep <- paste0(CN,LifestageTrt,":",RepNumber)
scTime <- scale(TrtTime) })
HawMedbb.TMB <- glmmTMB::glmmTMB(form, dispformula=~trtGp+splines::ns(scTime,2),
family=glmmTMB::betabinomial(link="cloglog"),
data=HawMed)
rho <- qra::getRho(HawMedbb.TMB)} else
message("Example requires `glmmTMB` version >= 1.1.2: not available")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.