P-values or CI's for Ho/He

283 views
Skip to first unread message

Kristopher Wojtusik

unread,
Aug 11, 2023, 3:24:43 PM8/11/23
to dartR
Hello,

I've been analyzing a Rad-Seq pop gen dataset and I used gl.report.heterozygosity to get per population Ho/He/Fis values, but we'd also like to have either a p-value or confidence interval for those values. Is there a way to do this either with dartR or with another package? 

Thank you.

-Kris

Jose Luis Mijangos

unread,
Aug 11, 2023, 8:47:30 PM8/11/23
to dartR
Hi Kris,

I'm working on that. Hopefully, on Monday, the functions gl.report.heterozigosity and gl.report.fstats will have:
- 4 different ways to calculate confidence intervals, 
- plots with standard deviation or standard error or confidence intervals. 
- plots could be bar plots with error bars or violin plots  combined with boxplots. 
- Parallelized bootstrapping (in Windows and MacOS) will be used to calculate confidence intervals. 

Cheers,
Luis 

Kristopher Wojtusik

unread,
Aug 14, 2023, 3:58:45 PM8/14/23
to dartR
That's great news, thanks!

-Kris

Kristopher Wojtusik

unread,
Sep 1, 2023, 11:47:06 AM9/1/23
to dartR
Hello,

I was just wondering if the functions (confidence intervals, etc) had been added to the dartr package yet. 

Thank you!

-Kris

Jose Luis Mijangos

unread,
Sep 14, 2023, 3:44:39 AM9/14/23
to dartR
Hi Kris,

The functions gl.report.heterozygosity and gl.report.fstat are ready!

You can give them a try by installing the developing version of dartR as shown below:

library(devtools)
install_github("green-striped-gecko/dartR@dev")

You can try for example:
library(dartR)
res <- gl.report.heterozygosity(platypus.gl,
                                error.bar = "CI",
                                nboots = 100,
                                ncpus = 2,
                                CI.type = "basic",
                                plot.colors.pop = c("yellow","gray","deeppink")
                                )
library(viridis)
res <- gl.report.fstat(testset.gl, palette.divergent = viridis)

Cheers,
Luis 

Kristopher Wojtusik

unread,
Sep 18, 2023, 10:50:12 AM9/18/23
to dartR
Hi Luis,

Thanks so much for doing this! It's been surprisingly difficult to find an R package that calculates CI's for all the different stats (at least ones that aren't deprecated!)

I got both gl.report.heterozygosity and fstat to work with my data, with the exception that when I tried to run them with CI.type = "bca", I got the following error:

Error in bca.ci(boot.out, conf, index[1L], L = L, t = t.o, t0 = t0.o,  :
  estimated adjustment 'w' is infinite

But everything ran fine with no errors or warnings when i switched to CI.type = "norm". I don't know if this is an issue with my data or the function, but just wanted to pass it along. 

Thank you for your help!

-Kris

Jose Luis Mijangos

unread,
Sep 18, 2023, 5:34:39 PM9/18/23
to dartR
Hi Kris,

As explained in the function documentation:

    The error "estimated adjustment 'w' is infinite" means that the estimated
    adjustment ‘w’ for the "bca" interval is infinite, which can happen when
    the empirical influence values are zero or very close to zero. This can
    be caused by various reasons, such as:

    The number of bootstrap replicates is too small, the statistic of interest
     is constant or nearly constant across the bootstrap samples, the data
     contains outliers or extreme values.

     You can try some possible solutions, such as:

 Increasing the number of bootstrap replicates, using a different type of
 bootstrap confidence interval or removing or transforming the outliers or
  extreme values.

 You can access function documentation by typing in the R console: help(function_name) or ?function_name

Cheers,
Luis

Elie McCarthy

unread,
Mar 20, 2025, 11:51:13 PMMar 20
to dartR
Hi Luis,

Is this function about to calculate the CIs around expected and observed heterozygosities?

Many thanks,
Elie
Reply all
Reply to author
Forward
0 new messages