Skip to contents

This function performs Bayesian linear regression using the `gbayes` function from the `qgg` package. It then returns the estimated slopes.

Usage

bayesAlphabetWeights(
  X,
  y,
  method,
  Z = NULL,
  h2 = NULL,
  nit = 5000,
  nburn = 1000,
  nthin = 5,
  ...
)

Arguments

X

A numeric matrix of genotypes.

y

A numeric vector of phenotypes.

method

A character string declaring the method/prior to be used. Options are bayesN, bayesL, bayesA, bayesC, or bayesR.

Z

An optional numeric matrix of covariates.

h2

Numeric or NULL. Prior heritability for the sampler; NULL lets qgg estimate it.

nit

Integer. Total number of MCMC iterations. Default 5000.

nburn

Integer. Number of burn-in iterations discarded. Default 1000.

nthin

Integer. Thinning interval for retained MCMC samples. Default 5.

...

Additional arguments forwarded to qgg::gbayes.

Value

A vector containing the weights to be applied to each genotype in predicting the phenotype.

Details

This function fits a Bayesian linear regression model with a range of priors.

Examples

X <- matrix(rnorm(100000), nrow = 1000)
Z <- matrix(round(runif(3000, 0, 0.8), 0), nrow = 1000)
set1 <- sample(seq_len(ncol(X)), 5)
set2 <- sample(seq_len(ncol(X)), 5)
sets <- list(set1, set2)
g <- rowSums(X[, c(set1, set2)])
e <- rnorm(nrow(X), mean = 0, sd = 1)
y <- g + e
bayesLWeights(y = y, X = X, Z = Z)
#> Type of analysis performed: st-blr-individual-level-dense-ld
#>   [1] -2.235454e-03 -6.776405e-03  6.223957e-03  5.587812e-03  7.374897e-04
#>   [6] -3.505265e-03  2.889122e-01  5.114582e-03  2.511409e-03  1.652923e-03
#>  [11] -9.784817e-03  4.510451e-03 -1.053537e-02  1.063420e-02 -6.626629e-03
#>  [16]  6.514009e-04 -8.388354e-03 -1.596250e-03 -1.297817e-02 -6.328627e-05
#>  [21]  5.902201e-03  2.579523e-03 -3.513561e-03  8.041818e-03 -3.154091e-03
#>  [26]  1.368788e-03  2.813386e-01  1.837845e-03  3.656265e-03  2.001306e-03
#>  [31]  7.130134e-04  2.955341e-01  3.102345e-03  3.086889e-01 -1.052043e-02
#>  [36] -6.064415e-03  2.827628e-04 -1.068672e-02  1.194875e-02 -5.698612e-03
#>  [41]  5.606699e-03 -4.129242e-03  1.227014e-02 -1.416087e-02 -4.204222e-03
#>  [46]  1.422651e-02  2.800520e-03  9.537173e-03  2.998055e-01  1.149230e-02
#>  [51] -3.618939e-03  3.130381e-01 -8.317655e-03  1.821221e-03 -1.218649e-02
#>  [56]  1.078280e-03  3.033694e-01  8.381282e-03  8.049302e-03  3.673527e-03
#>  [61]  1.386573e-02 -1.294134e-02 -9.441355e-05  2.762281e-01  1.379742e-03
#>  [66]  1.826489e-03 -9.263617e-03 -1.639340e-02  4.844211e-03  2.277491e-02
#>  [71] -1.185531e-02 -1.303368e-02  1.622902e-03 -4.277794e-03  2.950510e-01
#>  [76]  6.023366e-04  6.491856e-04 -4.542699e-03  6.213822e-04  2.563674e-03
#>  [81]  1.391038e-03  5.669380e-03 -2.362331e-02  1.230032e-03  1.608001e-03
#>  [86]  1.378735e-02  2.970549e-01 -5.526024e-03  5.512126e-03  5.024346e-03
#>  [91] -4.012515e-03 -4.238223e-03  7.100005e-03  2.214178e-02 -2.795161e-03
#>  [96] -2.957664e-03  1.850074e-03 -5.369506e-04  1.136005e-02 -7.850164e-03
bayesRWeights(y = y, X = X, Z = Z)
#> Type of analysis performed: st-blr-individual-level-dense-ld
#>   [1] -4.571282e-05 -2.863015e-06  6.357461e-05  2.712441e-05  1.534227e-05
#>   [6] -2.030657e-05  2.944105e-01  6.104224e-05  1.928266e-05 -3.626211e-06
#>  [11] -8.036983e-05  8.101800e-05 -1.557748e-04  3.267903e-04 -5.403174e-05
#>  [16] -1.423676e-05 -3.967989e-05  7.901876e-06 -8.550349e-04  2.255751e-05
#>  [21]  1.006491e-04  4.600218e-05 -1.388822e-05  1.381052e-04 -3.119353e-05
#>  [26] -3.546679e-06  2.843063e-01  6.910429e-06  1.894248e-05  5.921767e-06
#>  [31]  7.506010e-06  2.981311e-01 -1.293408e-05  3.114179e-01 -8.373635e-05
#>  [36] -6.943174e-05 -1.122224e-05 -1.863226e-04  1.195058e-04 -5.084725e-05
#>  [41]  2.732245e-05 -2.731318e-05  1.158259e-04 -2.987841e-04 -3.031033e-05
#>  [46]  2.177819e-04  1.053140e-05  4.510160e-05  3.016993e-01  1.102675e-04
#>  [51] -1.768066e-05  3.180219e-01 -3.952018e-05  3.564889e-05 -1.892756e-04
#>  [56]  2.976533e-05  3.025320e-01  9.113257e-05  7.043760e-05  3.219663e-05
#>  [61]  3.562517e-04 -1.012008e-04 -1.397877e-06  2.790325e-01 -1.369250e-05
#>  [66]  5.503325e-06 -1.983592e-04 -2.583962e-04  3.074078e-05  3.035416e-03
#>  [71] -1.675580e-04 -1.886643e-04  2.039110e-05 -3.660232e-05  2.992494e-01
#>  [76] -4.821674e-06  2.262057e-05 -2.792695e-05  1.443867e-05  4.548974e-05
#>  [81]  1.893567e-05  5.342981e-05 -4.556912e-03 -1.184532e-05 -7.867910e-06
#>  [86]  4.014369e-04  3.001378e-01 -5.974351e-05  1.039747e-05  3.375128e-05
#>  [91] -3.089464e-05 -5.321255e-05  4.688976e-05  2.447148e-03 -2.466401e-05
#>  [96] -2.453958e-05  1.656351e-05 -3.307375e-05  2.243679e-04 -1.800884e-04