Description Usage Arguments Value Author(s) References Examples

View source: R/all_functions.R

Fits a Bayesian spatial model that allows for two types of correlation typically seen in structural brain imaging data. First, the spatial correlation in the imaging phenotypes obtained from neighbouring regions of the brain. Second, the correlation between corresponding measures on opposite hemispheres.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 |

`X` |
A d-by-n matrix; d is the number of SNPs and n is the number of subjects. Each row of X should correspond to a particular SNP and each column should correspond to a particular subject. Each element of X should give the number of minor alleles for the corresponding SNP and subject. The function will center each row of X to have mean zero prior to running the Gibbs sampling algorithm. |

`Y` |
A c-by-n matrix; c is the number of phenotypes (brain imaging measures) and n is the number of subjects. Each row of Y should correspond to a particular phenotype and each column should correspond to a particular subject. Each element of Y should give the measured value for the corresponding phentoype and subject. The function will center and scale each row of Y to have mean zero and unit variance prior to running the Gibbs sampling algorithm. |

`method` |
A string, either 'MCMC' or 'MFVB'. If 'MCMC', the Gibbs sampling method will be used. If 'MFVB', mean field variational Bayes method will be used. |

`rho` |
Spatial cohesion paramter. If no value is assigned, it takes 0.95 by default. |

`lambdasq` |
A tuning paratmeter. If no value is assigned, the algorithm will estimate and assign a value for it based on a moment estimate. |

`alpha` |
Bayesian False Discovery Rate (FDR) level. Default level is 0.05. |

`A` |
A c/2 by c/2 neighborhood structure matrix for different brain regions. |

`c.star` |
The threshold for computing posterior tail probabilities p_ij for Bayesian FDR as defined in Section 3.2 of Song, Ge et al.(2019). If not specified the default is to set this threshold as the minimum posterior standard deviation, where the minimum is taken over all regression coefficients in the model. |

`FDR_opt` |
A logical operator for computing Bayesian FDR. By default, it's TRUE. |

`WAIC_opt` |
A logical operator for computing WAIC from MCMC method. By default, it's TRUE. |

`iter_num` |
Positive integer representing the total number of iterations to run the Gibbs sampler. Defaults to 10,000. |

`burn_in` |
Nonnegative integer representing the number of MCMC samples to discard as burn-in. Defaults to 5001. |

A list with following elements

`WAIC` |
WAIC is computed from the MCMC output if "MCMC" is chosen for method. |

`lower_boud` |
Lower bound from MFVB output if "MFVB is choosen for method. |

`Gibbs_setup` |
A list providing values for the input parameters of the function. |

`lambdasq_est` |
Estimated value for tunning parameter lambda-squared. |

`Gibbs_W_summaries` |
A list with five components, each component being a d-by-c matrix giving some posterior summary of the regression parameter matrix W, where the ij-th element of W represents the association between the i-th SNP and j-th phenotype. -Gibbs_W_summaries$W_post_mean is a d-by-c matrix giving the posterior mean of W. -Gibbs_W_summaries$W_post_mode is a d-by-c matrix giving the posterior mode of W. -Gibbs_W_summaries$W_post_sd is a d-by-c matrix giving the posterior standard deviation for each element of W. -Gibbs_W_summaries$W_2.5_quantile is a d-by-c matrix giving the posterior 2.5 percent quantile for each element of W. -Gibbs_W_summaries$W_97.5_quantile is a d-by-c matrix giving the posterior 97.5 percent quantile for each element of W.' |

`FDR_summaries` |
A list with three components providing the summaries for estimated Bayesian FDR results for both MCMC and MFVB methods. Details for Bayesian FDR computation could be found at Morris et al.(2008). -sensitivity_rate is the estimated sensitivity rate for each region. -specificity_rate is the estimated specificity rate for each region. -significant_snp_idx is the index of estimated significant/important SNPs for each region. |

`MFVB_summaries` |
A list with four components, each component is the mean field variational bayes approximation summary of model paramters. -Number of Iteration is how many iterations it takes for convergence. -W_post_mean is MFVB approximation of W. -Sigma_post_mean is MFVB approximation of Sigma. -omega_post_mean is MFVB approximation of Omega. |

Yin Song, yinsong@uvic.ca

Shufei Ge, shufeig@sfu.ca

Farouk S. Nathoo, nathoo@uvic.ca

Liangliang Wang, lwa68@sfu.ca

Jiguo Cao, jiguo_cao@sfu.ca

Song, Y., Ge, S., Cao, J., Wang, L., Nathoo, F.S., A Bayesian Spatial Model for Imaging Genetics. arXiv:1901.00068.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | ```
data(sp_bgsmtr_example_data)
names(sp_bgsmtr_example_data)
## Not run:
# Run the example data with Gibbs sampling and compute Bayesian FDR as follow:
fit_mcmc = sp_bgsmtr(X = sp_bgsmtr_example_data$SNP_data,
Y = sp_bgsmtr_example_data$BrainMeasures, method = "MCMC",
A = sp_bgsmtr_example_data$neighborhood_structure, rho = 0.8,
FDR_opt = TRUE, WAIC_opt = TRUE,lambdasq = 1000, iter_num = 10000)
# MCMC estimation results for regression parameter W and estimated Bayesian FDR summaries
fit_mcmc$Gibbs_W_summaries
fit_mcmc$FDR_summaries
# The WAIC could be also obtained as:
fit_mcmc$WAIC
# Run the example data with mean field variational Bayes and compute Bayesian FDR as follow:
fit_mfvb = sp_bgsmtr(X = sp_bgsmtr_example_data$SNP_data,
Y = sp_bgsmtr_example_data$BrainMeasures, method = "MFVB",
A = sp_bgsmtr_example_data$neighborhood_structure, rho = 0.8,FDR_opt = FALSE,
lambdasq = 1000, iter_num = 10000)
# MFVB estimated results for regression parameter W and estimated Bayesian FDR summaries
fit_mfvb$MFVB_summaries
fit_mfvb$FDR_summaries
# The corresponding lower bound of MFVB method after convergence is obtained as:
fit_mfvb$lower_boud
## End(Not run)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.