A minimal example

knitr::opts_chunk$set(collapse = TRUE,comment = "#",fig.width = 4.5,
                      fig.height = 3,fig.align = "center",
                      fig.cap = " ",dpi = 120)

In this short vignette, we fit a sparse linear regression model with up to $L > 0$ non-zero effects. Generally, there is no harm in over-stating $L$ (that is, the method is pretty robust to overfitting), except that computation will grow as $L$ grows.

Here is a minimal example:

library(susieR)
set.seed(1)
n    <- 1000
p    <- 1000
beta <- rep(0,p)
beta[c(1,2,300,400)] <- 1
X   <- matrix(rnorm(n*p),nrow=n,ncol=p)
y   <- X %*% beta + rnorm(n)
res <- susie(X,y,L=10)
plot(coef(res)[-1],pch = 20)

Plot the ground-truth outcomes vs. the predicted outcomes:

plot(y,predict(res),pch = 20)

Session information

Here are some details about the computing environment, including the versions of R, and the R packages, used to generate these results.

sessionInfo()


Try the susieR package in your browser

Any scripts or data that you put into this service are public.

susieR documentation built on March 7, 2023, 6:11 p.m.