Fits linear mixed models by maximising the profile pairwise composite likelihood. Allows for correlated random effects, eg, for genetic relatedness (QTL) models
svy2relmer(formula, design, sterr=TRUE, return.devfun=FALSE, relmat=NULL,
all.pairs=FALSE, subtract.margins=FALSE )
svy2relmer
returns an object with print
, coef
, and
vcov
methods.
Model formula as in the lme4
package, or with terms like
(1|id)
for correlated random effects together with the
relmat
argument.
A survey design object produced by survey::svydesign
. The
pairwise weights will be computed from this design, which must have
separate probabilities or weights for each stage of sampling.
Estimate standard errors for fixed effects? Set to FALSE
for
greater speed when using resampling to get standard errors.
If TRUE
, return the deviance function as a
component of the object. This will increase the memory use
substantially, but allows for bootstrapping.
Specifies a list of relatedness matrices that corresponds to one or
more random-effect groupings (eg (1|id)
in the formula
together with relmat=list(id=Phi)
implies a covariance matrix
of Phi
for the random effects before scaling). See Details and
the vignettes.
Use all pairs rather than just correlated pairs?
If TRUE
and all.pairs=TRUE
,
compute with all pairs by the faster algorithm involving subtraction
from the marginal likelihood
Thomas Lumley
This function is very similar to svy2lme
and only the
differences are described here.
Formula parsing and starting values use code based on the
lme4qtl
package.
In svy2lme
and lme4::lmer
, the model is based on
independent standard Normal random effects that are transformed to
give random coefficients that might be correlated within observation
but are either identical or independent between observations. In
this function, the basic random effects in a term are multiplied by a square
root of the relmat
matrix for that term, giving basic random
effects whose covariance between observations proportional to the
relmat
matrix. For example, in a quantitative trait locus
model in genetics, the matrix would be a genetic relatedness matrix.
The relmat
matrices must have dimnames for matching to the
id variable. It is permissible for the relmat
matrices to
be larger than necessary -- eg, containing related units that are
not in the sample -- since the dimnames will be used to select the
relevant submatrix.
There can be only one random-effect term for each relmat
term. If
you need more, make a copy of the term with a different
name.
The return.devfun=TRUE
option is useful if you want to
examine objects that aren't returned as part of the output. For
example, get("ij", environment(object$devfun))
is the set of
pairs used in computation.
Ziyatdinov, A., Vázquez-Santiago, M., Brunel, H. et al. lme4qtl: linear mixed models with flexible covariance structure for genetic studies of related individuals. BMC Bioinformatics 19, 68 (2018). https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-018-2057-x
data(milk_subset)
herd_des<- svydesign(id = ~herd + id, prob = ~one + one2, data = milk_subset)
svy2lme(sdMilk ~ lact + log(dim) + (1|herd), design=herd_des, method="general")
svy2relmer(sdMilk ~ lact + log(dim) + (1|id) + (1|herd), design=herd_des,
relmat = list(id = A_gen))
Run the code above in your browser using DataLab