svy2relmer {svylme} | R Documentation |
Linear mixed models with correlated random effects
Description
Fits linear mixed models by maximising the profile pairwise composite likelihood. Allows for correlated random effects, eg, for genetic relatedness (QTL) models
Usage
svy2relmer(formula, design, sterr=TRUE, return.devfun=FALSE, relmat=NULL,
all.pairs=FALSE, subtract.margins=FALSE )
Arguments
formula |
Model formula as in the |
design |
A survey design object produced by |
sterr |
Estimate standard errors for fixed effects? Set to |
return.devfun |
If |
relmat |
Specifies a list of relatedness matrices that corresponds to one or
more random-effect groupings (eg |
all.pairs |
Use all pairs rather than just correlated pairs? |
subtract.margins |
If |
Details
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.
Value
svy2relmer
returns an object with print
, coef
, and
vcov
methods.
Author(s)
Thomas Lumley
References
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
Examples
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))