getRho: Extract estimates of the intra-class correlation from a...

Description Usage Arguments Details Value Examples

View source: R/getRho.R

Description

The intra-class correlation is calculated as (1+exp(θ))^{-1}, where θ is the estimate given by the formula specified in the argument dispformula.

Usage

1
getRho(obj, varMult = FALSE)

Arguments

obj

glmmTMB model object with betabinomial error, and with a 'dispformula' argument supplied.

varMult

If TRUE return, in addition to rho, the factor mult by which the variance is inflated relative to the binomial.

Details

The variance for the betabinomial model is then obtained by multiplying the binomial variance by 1+(n-1)ρ, where $n$ is the binomial 'size'.

Value

if varMult==FALSE return (as a vector) the estimates ρ, else (varMult==TRUE) return list(rho, mult).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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")

qra documentation built on Oct. 29, 2021, 9:06 a.m.