The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Multilevel structure in bqmm

bqmm uses lme4’s formula grammar, so random effects are written inline and nested or crossed structures come for free.

Random intercepts

library(bqmm)
bqmm(y ~ x + (1 | group), data, tau = 0.5)

Each group gets its own intercept deviation u_j ~ N(0, σ_u²). ranef() returns the posterior-median deviations; VarCorr() returns σ_u.

Random slopes

bqmm(y ~ x + (1 + x | group), data, tau = 0.5)            # diagonal
bqmm(y ~ x + (1 + x | group), data, tau = 0.5,
     cov = "unstructured")                                # correlated

With cov = "diagonal" (the default) the intercept and slope deviations are independent. With cov = "unstructured" they share an LKJ-correlated covariance and VarCorr() carries the correlation matrix:

fit <- bqmm(y ~ x + (1 + x | group), data, tau = 0.5, cov = "unstructured")
VarCorr(fit)
attr(VarCorr(fit), "correlation")

cov = "unstructured" currently supports a single grouping factor. Use the default diagonal covariance for multiple or crossed terms.

Nested and crossed grouping

bqmm(y ~ x + (1 | school/classroom), data, tau = 0.5)    # nested
bqmm(y ~ x + (1 | school) + (1 | neighbourhood), data, tau = 0.5)  # crossed

Both are parsed by lme4 and handled by the diagonal model — no special syntax is needed. The variance-component mapping (which random-effect column belongs to which (term, coefficient)) is built directly from lme4::mkReTrms() and is verified against lme4’s own design matrices in the package tests.

Practical notes

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.