lfmm_lasso: LFMM least-squares estimates with lasso penalty (Sparse LFMM)

Description Usage Arguments Details Value Author(s) References Examples

View source: R/lfmm.R

Description

This function computes regularized least squares estimates for latent factor mixed models using a lasso penalty.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
lfmm_lasso(
  Y,
  X,
  K,
  nozero.prop = 0.01,
  mu.num = 100,
  mu.min.ratio = 0.01,
  mu = NULL,
  it.max = 100,
  relative.err.epsilon = 1e-06
)

Arguments

Y

a response variable matrix with n rows and p columns. Each column is a response variable (e.g., SNP genotype, gene expression level, beta-normalized methylation profile, etc). Response variables must be encoded as numeric.

X

an explanatory variable matrix with n rows and d columns. Each column corresponds to a distinct explanatory variable (eg. phenotype, exposure, outcome). Explanatory variables must be encoded as numeric.

K

an integer for the number of latent factors in the regression model.

nozero.prop

a numeric value for the expected proportion of non-zero effect sizes.

mu.num

a numeric value for the number of 'mu' values (advance parameter).

mu.min.ratio

(advance parameter) A fraction of mu.max, the data derived entry value (i.e. the smallest value for which all coefficients are zero).

mu

(advance parameter) Smallest value of mu. Null value by default.

it.max

an integer value for the number of iterations of the algorithm.

relative.err.epsilon

a numeric value for a relative convergence error. Determine whether the algorithm converges or not.

Details

The algorithm minimizes the following penalized least-squares criterion

The response variable matrix Y and the explanatory variable are centered.

Value

an object of class lfmm with the following attributes:

Author(s)

Kevin Caye, Basile Jumentier, Olivier Francois

References

B. Jumentier, Caye, K., J. Lepeule, and O. François, 2019 Sparse latent factor regression models for genome-wide and epigenome-wide association studies (in prep)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
library(lfmm)

## An EWAS example with Y = methylation data 
## and X = exposure

## Simulate the data 

dat <- lfmm_sampler(n = 100, 
                    p = 1000,
                    K = 3,
                    outlier.prop = 0.02,
                    cs = 0.1,
                    sigma = 0.2,
                    B.sd = 5,
                    B.mean = 0,
                    U.sd = 1.0,
                    V.sd = 1.0)

Y <- scale(dat$Y)
X <- scale(dat$X)

## Fit an LFMM with 2 latent factors
mod.lfmm <- lfmm_lasso(Y = Y,
                       X = X, 
                       K = 3,
                       nozero.prop = 0.02)
                       
## Manhattan plot of sparse effect sizes
effect <- mod.lfmm$B
causal <- dat$outlier

plot(effect, 
     pch = 19, 
     cex = .3,
     xlab = "Probe",
     col = "grey")
     
points(causal, 
       effect[causal], 
       col = "blue")

lfmm documentation built on June 30, 2021, 5:07 p.m.