Package 'NGBVS'

Title: Bayesian Variable Selection for SNP Data using Normal-Gamma
Description: Posterior distribution of case-control fine-mapping. Specifically, Bayesian variable selection for single-nucleotide polymorphism (SNP) data using the normal-gamma prior. Alenazi A.A., Cox A., Juarez M,. Lin W-Y. and Walters, K. (2019) Bayesian variable selection using partially observed categorical prior information in fine-mapping association studies, Genetic Epidemiology. <doi:10.1002/gepi.22213>.
Authors: Abdulaziz Alenazi [aut, cre]
Maintainer: Abdulaziz Alenazi <[email protected]>
License: GPL (>= 2)
Version: 0.3.0
Built: 2024-11-13 03:27:21 UTC
Source: https://github.com/cran/NGBVS

Help Index


Bayesian Variable Selection for SNP Data using Normal-Gamma

Description

The NGBVS package provides posterior distribution of case-control fine-mapping. Specifically Bayesian variable selection for Single-Nucleotide Polymorphism (SNP) data using the Normal-Gamma prior.

Details

Package: NG
Type: Package
Version: 0.3.0
Date: 2022-09-112
License: GPL-2

Maintainers

Abdulaziz Alenazi [email protected]

Author(s)

Abdulaziz Alenazi [email protected]


Modified NG prior via FS scores

Description

Modified Normal Gamma prior calculates the posterior distribution for the fine mapping cases-controls study. The number of case-controls must be greater than the number of SNPs.

Usage

asym_m_ng (y, data, FS, medstar = c(0.01, 0.0001), numb = 100, burnin = 1, every = 1)

Arguments

y

A vector of the pheontype, where takes 0s and 1s.

data

An N×pN \times p finemap data, where NN and pp denote the samples and number of SNPs respectively.

FS

FS scores for each SNP and it takes value from 0 and 1 or NA for missing FS.

medstar

The value of M where M takes two values.

numb

Number of samples for each SNP.

burnin

The amount of burn-in for the MCMC sample.

every

The amount of thining for the MCMC sample.

Value

A list including:

alpha

A vector of the posterior distribution of the intercept.

beta

A matrix of the posterior distribution of the effect sizes.

psi

A matrix of the posterior distribution of ψ\psi.

lambda

A vector of the posterior distribution of λ\lambda.

gammasq

A vector of the posterior distribution of γ2\gamma^2.

W

A vector of the posterior distribution of WW.

H

A vector of the posterior distribution of HH.

Author(s)

Abulaziz Alenazi.

R implementation and documentation: Abulaziz Alenazi [email protected].

Examples

set.seed(1)
data <- matrix(sample( c( 0, 1, 2 ), 500 * 30, replace = TRUE,
prob <- c( 0.35, 0.35, 0.3)), ncol = 30 )
FS <- sample( c( 0.1, 0.5, 0.7, NA ), ncol( data ), replace = TRUE)
asym_m_ng(y = rbinom(500, 1, 0.5), data = data, FS = FS)

Standard NG prior

Description

Standard Normal Gammp prior calculates the posterior distribution for the fine mapping cases-controls study. The number of case-controls must be greater than the number of SNPs.

Usage

asym_s_ng(y, data,  medstar = 1, numb = 100, burnin = 1, every = 1)

Arguments

y

A vector of the pheontype, where takes 0s and 1s.

data

An N×pN \times p finemap data, where NN and pp denote the samples and number of SNPs respectively.

medstar

The value of M.

numb

Number of samples for each SNP.

burnin

The amount of burn-in for the MCMC sample.

every

The amount of thining for the MCMC sample.

Value

A list including:

alpha

A vector of the posterior distribution of the intercept.

beta

A matrix of the posterior distribution of the effect sizes.

psi

A matrix of the posterior distribution of ψ\psi.

lambda

A vector of the posterior distribution of λ\lambda.

gammasq

A vector of the posterior distribution of γ2\gamma^2.

Author(s)

Abulaziz Alenazi.

R implementation and documentation: Abulaziz Alenazi [email protected].

Examples

set.seed( 1 )
data <- matrix(sample( c( 0, 1, 2 ), 500 * 30, replace = TRUE,
prob = c( 0.35, 0.35, 0.3)), ncol = 30)
asym_s_ng(y = rbinom(500, 1, 0.5), data = data)

Modified NG prior via FS scores

Description

Modified Normal Gammp prior calculates the posterior distribution for the fine mapping study. The number of individuals must be greater than the number of SNPs.

Usage

m_ng (y, data, FS, medstar = c(0.01, 0.0001),  numb = 100, burnin = 1, every = 1)

Arguments

y

A vector of the pheontype.

data

An N×pN \times p finemap data, where NN and pp denote the samples and number of SNPs respectively.

FS

FS scores for each SNP and it takes value from 0 and 1 or NA for missing FS.

medstar

The value of M where M takes two values.

numb

Number of samples for each SNP.

burnin

The amount of burn-in for the MCMC sample.

every

The amount of thining for the MCMC sample.

Value

A list including:

alpha

A vector of the posterior distribution of the intercept.

beta

A matrix of the posterior distribution of the effect sizes.

sigmasq

A vector of the posterior distribution of σ2\sigma^2.

psi

A matrix of the posterior distribution of ψ\psi.

lambda

A vector of the posterior distribution of λ\lambda.

gammasq

A vector of the posterior distribution of γ2\gamma^2.

W

A vector of the posterior distribution of WW.

H

A vector of the posterior distribution of HH.

Author(s)

Abulaziz Alenazi.

R implementation and documentation: Abulaziz Alenazi [email protected].

Examples

set.seed( 1 )
data <- matrix(rnorm(500 * 30), ncol = 30)
FS <- sample( c( 0.1, 0.5, 0.7, NA ), ncol( data ), replace = TRUE)
m_ng(y = rnorm( 500 ), data = data, FS = FS)

Random value generation from the Generalized Inverse Gaussian Distribution

Description

Random value generation from the Generalized Inverse Gaussian (GIG) Distribution.

Usage

rgig(n = 10, lambda = 1, chi = 1, psi = 1)

Arguments

n

Number of observations.

lambda

A shape and scale and parameter.

chi

Shape parameter. Must be positive.

psi

Scale parameter. Must be positive.

Details

rgig uses the code from the GIG-random number generator from the R package fBasics. I copied the code from the "ghyp" package because it had not longer a maintainer.

Value

A vector with random values from the GIG distrigution.

Author(s)

David Luethi. Minor changes made by Abdulaziz Alenazi [email protected].

References

The algorithm for simulating generalized inverse gaussian variates is copied from the R package fBasics from Diethelm Wuertz.

Dagpunar, J.S. (1989). An easily implemented generalised inverse Gaussian generator. Communications in Statistics-Computation and Simulation, 18, 703–710.

Raible S. (2000). Levy Processes in Finance: Theory, Numerics and Empirical Facts, PhD Thesis, University of Freiburg, Germany, 161 pages.

Examples

x <- rgig(n = 10, lambda = 1, chi = 1, psi = 1)

Standard NG prior

Description

Standard Normal Gammp prior calculates the posterior distribution for the fine mapping study. The number of individuals must be greater than the number of SNPs.

Usage

s_ng(y, data, medstar = 1, numb = 100, burnin = 1, every = 1)

Arguments

y

A vector of the pheontype.

data

An N×pN \times p finemap data, where NN and pp denote the samples and number of SNPs respectively.

medstar

The value of M.

numb

Number of samples for each SNP.

burnin

The amount of burn-in for the MCMC sample.

every

The amount of thining for the MCMC sample.

Value

A list including:

alpha

A vector of the posterior distribution of the intercept.

beta

A matrix of the posterior distribution of the effect sizes.

sigmasq

A vector of the posterior distribution of σ2\sigma^2.

psi

A matrix of the posterior distribution of ψ\psi.

lambda

A vector of the posterior distribution of λ\lambda.

gammasq

A vector of the posterior distribution of γ2\gamma^2.

Author(s)

Abulaziz Alenazi.

R implementation and documentation: Abulaziz Alenazi [email protected].

Examples

set.seed(1)
data <- matrix( rnorm(500 * 30), ncol = 30)
s_ng(y = rnorm(500), data = data)