ps.geneJAM: Generate polygenic scores

View source: R/ps.geneJAM.R

ps.geneJAMR Documentation

Generate polygenic scores

Description

This function generates polygenic scores (PSs) by fitting a univariate simple linear regression model for each feature x on each outcome component y.

Usage

ps.geneJAM(x, y)

Arguments

x

Input matrix, of dimension nobs x nvars; each row is an observation vector. Can be in sparse matrix format.

y

Quantitative response matrix, of dimension nobs x nouts.

Details

For each outcome component Y_l we fit a univariate simple linear regression on the form

Y_l = X_j B_{jl} + E_l,

where the scalar B_{jl} is a regression coefficient E_l is is a vector of length nobs of independent Gaussian random errors. For a multivariate outcome Y we define the PS for each outcome component l = 1,...,q and each individual i = 1,...,N by

PS_{il} = ∑_{j=1}^p X_{ij}\hat{B}_{jl},

where \hat{B}_{jl} is the maximum likelihood estimate of B_{jl}.

Value

An object of class "ps.geneJAM" is returned.

PS

A matrix of dimension nobs x nouts of polygenic scores.

Examples

N <- 500 #
q <- 10 #
p <- 20 #
set.seed(1)
x <- matrix(rbinom(n = N*p, size = 2, prob = 0.3), nrow=N, ncol=p)
B <- matrix(0, nrow = p, ncol = q)
B[1, 1:2] <- 2
y <- x %*% B + matrix(rnorm(N*q), nrow = N, ncol = q)
###
ps <- ps.geneJAM(x, y)


abuchardt/EdGwas documentation built on Nov. 28, 2022, 11:49 a.m.