Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

lmm.simu

Linear mixed model data simulation


Description

Simulate data under a linear mixed model, using the eigen decomposition of the variance matrix.

Usage

lmm.simu(tau, sigma2, K, eigenK = eigen(K), X, beta)

Arguments

tau

Model parameter

sigma2

Model parameter

K

(Optional) A positive symmetric matrix K

eigenK

Eigen decomposition of K

X

Covariable matrix

beta

Fixed effect vector of covariables

Details

The data are simulated under the following linear mixed model :

Y = X beta + omega + epsilon

with omega ~ N(0, tau K) and epsilon ~ N(0, sigma^2 I_n).

The simulation uses K only through its eigen decomposition; the parameter K is therefore optional.

Value

A named list with two members:

y

Simulated value of Y

omega

Simulated value of omega

Author(s)

Hervé Perdry and Claire Dandine-Roulland

See Also

Examples

# generate a random positive matrix 
set.seed(1)
R <- random.pm(503)

# simulate data with a "polygenic component" 
y <-  lmm.simu(0.3, 1, eigenK = R$eigen)
str(y)

gaston

Genetic Data Handling (QC, GRM, LD, PCA) & Linear Mixed Models

v1.5.7
GPL-3
Authors
Hervé Perdry [cre, aut, cph], Claire Dandine-Roulland [aut, cph], Deepak Bandyopadhyay [cph] (C++ gzstream class), Lutz Kettner [cph] (C++ gzstream class)
Initial release
2020-09-18

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.