Estimates the rate of false positives in a fixed difference analysis
This function takes two populations and generates allele frequency profiles for them. It then samples an allele frequency for each, at random, and estimates a sampling distribution for those two allele frequencies. Drawing two samples from those sampling distributions, it calculates whether or not they represent a fixed difference. This is applied to all loci, and the number of fixed differences so generated are counted, as an expectation. The script distinguished between true fixed differences (with a tolerance of delta), and false positives. The simulation is repeated a given number of times (default=1000) to provide an expectation of the number of false positives, given the observed allele frequency profiles and the sample sizes. The probability of the observed count of fixed differences is greater than the expected number of false positives is calculated.
gl.fdsim( x, poppair, obs = NULL, sympatric = FALSE, reps = 1000, delta = 0.02, verbose = NULL )
Name of the genlight containing the SNP genotypes [required].
Labels of two populations for comparison in the form c(popA,popB) [required].
Observed number of fixed differences between the two populations [default NULL].
If TRUE, the two populations are sympatric, if FALSE then allopatric [default FALSE].
Number of replications to undertake in the simulation [default 1000].
The threshold value for the minor allele frequency to regard the difference between two populations to be fixed [default 0.02].
Verbosity: 0, silent or fatal errors; 1, begin and end; 2, progress log; 3, progress and results summary; 5, full report [default 2].
A list containing the following square matrices [] observed fixed differences; [] mean expected number of false positives for each comparison; [] standard deviation of the no. of false positives for each comparison; [] probability the observed fixed differences arose by chance for each comparison.
Custodian: Arthur Georges (Post to https://groups.google.com/d/forum/dartr)
fd <- gl.fdsim(testset.gl[,1:100],poppair=c('EmsubRopeMata','EmmacBurnBara'), sympatric=TRUE,verbose=3) #> Starting gl.fdsim #> Processing genlight object with SNP data #> Populations EmsubRopeMata vs EmmacBurnBara [sympatric] #> Sample sizes: 11 5 #> No. of loci: 15 #> Calculating false positive rate with 1000 replications. Please be patient #> Threshold minor allele frequency for generating a false positive: 0.02 #> Estimated mean count of false positives: 0 #> Estimated SD of the count of false positives: 0 #> Prob that observed count of 3 are false positives: 0 #> Completed: gl.fdsim #>