Type: | Package |
Title: | Bayesian Variable Selection for SNP Data using Normal-Gamma |
Version: | 0.3.0 |
Date: | 2022-09-12 |
Author: | Abdulaziz Alenazi [aut, cre] |
Maintainer: | Abdulaziz Alenazi <a.alenazi@nbu.edu.sa> |
Depends: | R (≥ 3.6.0) |
Imports: | stats, Rfast |
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>. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
NeedsCompilation: | no |
Packaged: | 2022-09-12 16:42:23 UTC; Michail |
Repository: | CRAN |
Date/Publication: | 2022-09-16 16:36:05 UTC |
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 a.alenazi@nbu.edu.sa
Author(s)
Abdulaziz Alenazi a.alenazi@nbu.edu.sa
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 a.alenazi@nbu.edu.sa.
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)
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 |
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 |
lambda |
A vector of the posterior distribution of |
gammasq |
A vector of the posterior distribution of |
W |
A vector of the posterior distribution of |
H |
A vector of the posterior distribution of |
Author(s)
Abulaziz Alenazi.
R implementation and documentation: Abulaziz Alenazi a.alenazi@nbu.edu.sa.
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 |
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 |
lambda |
A vector of the posterior distribution of |
gammasq |
A vector of the posterior distribution of |
Author(s)
Abulaziz Alenazi.
R implementation and documentation: Abulaziz Alenazi a.alenazi@nbu.edu.sa.
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 |
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 |
psi |
A matrix of the posterior distribution of |
lambda |
A vector of the posterior distribution of |
gammasq |
A vector of the posterior distribution of |
W |
A vector of the posterior distribution of |
H |
A vector of the posterior distribution of |
Author(s)
Abulaziz Alenazi.
R implementation and documentation: Abulaziz Alenazi a.alenazi@nbu.edu.sa.
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)
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 |
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 |
psi |
A matrix of the posterior distribution of |
lambda |
A vector of the posterior distribution of |
gammasq |
A vector of the posterior distribution of |
Author(s)
Abulaziz Alenazi.
R implementation and documentation: Abulaziz Alenazi a.alenazi@nbu.edu.sa.
Examples
set.seed(1)
data <- matrix( rnorm(500 * 30), ncol = 30)
s_ng(y = rnorm(500), data = data)