# calcPval: Calculates empirical P-values In BlockFeST: Bayesian Calculation of Region-Specific Fixation Index to Detect Local Adaptation

## Description

We propose a simple sampling scheme to verify significant outlier loci subject to local adaptation based on the distribution of the α_{I} values observed after the MCMC iterations (approximated through a region-specific normal distribution (N(α_{I})) without using a time consuming reversible jump model for testing the null hypotheses:

1. For each region I, sample a single value x_{I} \sim N(α_{I}) and y_{I} \sim N(α_{I}), resulting in a distribution of sampled values D_{x} and D_{y} across regions.

2. For each region I, increment its counter c_I if y_I is above the q-quantile for D_{x}.

3. repeat (1-2) 1000 times

The empirical P-value for each α_{I} is the number of times the sample x_{I} is greater than the user-defined significance level q (e.g., the 0.95 quantile) divided by the number of iterations (1000 times).

## Usage

 `1` ```calcPval(BlockFeST.result, q=0.95) ```

## Arguments

 `BlockFeST.result` an object returned from the function BlockFeST `q` quantile

## Value

empirical P-values

## Examples

 ```1 2 3 4``` ```snps <- system.file("extdata", "snps.txt", package="BlockFeST") groups <- system.file("extdata", "groups.txt", package="BlockFeST") BlockFeST.result <- BlockFeST(input=snps, GROUP=groups, nb=3, runtime=10) P <- calcPval(BlockFeST.result) ```

BlockFeST documentation built on May 7, 2018, 1:03 a.m.