Open Lars-B opened 2 months ago
Could you say more about why you want to call these functions directly, rather than the intended route of using treess
? Keeping them internal (and user inaccessible) was an intentional choice, not an accident.
It gives more freedom to users and allows to call only specific functions of your code. If I have a precomputed distance matrix I can't use your package. If I have a bigger matrix than R memory supports I can't use your package.
I respect the desire to be able to access all functions as a general feature. In the long run, more of the package will stabilize and more currently-internal functions may end up exported. However, for the time being, for the purposes of support and stability the priority is high-level functionality like treess
for workflows that start with reading in trees.
The functions that actually compute the effective sample sizes are currently rather limited. They can only handle complete distance matrices which can be held in memory. They are subject to change (in name, I/O, etc.) as functionality expands and as such I am not inclined to export them at this time.
The goods news is that you can use the package as-is to (albeit hackily) employ pre-computed distance matrices. You can pass in arbitrary chains and define a distance function that returns the relevant pre-computed matrix. For example,
> library(treess)
> set.seed(42)
> dist_mats <- lapply(1:4, function(x) {dist(rnorm(10))})
> fake_chains <- lapply(1:4, function(i) {rep(i, 10)})
> fake_fun <- function(x) {return(dist_mats[[x[1]]])}
> treess::treess(fake_chains, fake_fun)
$chain_1
frechetCorrelationESS medianPseudoESS minPseudoESS
11.40056 35.20287 10.00000
$chain_2
frechetCorrelationESS medianPseudoESS minPseudoESS
6.794942 10.000000 10.000000
$chain_3
frechetCorrelationESS medianPseudoESS minPseudoESS
6.989547 10.000000 10.000000
$chain_4
frechetCorrelationESS medianPseudoESS minPseudoESS
3.685698 10.000000 10.000000
I will contemplate more formal support for passing distance matrices.
Support for larger-than-memory distance matrices, while it would be nice, is not currently in any development plans.
It is currently not possible to access the
frechetCorrelationESS
function directly, addingexport(frechetCorrelationESS)
to the namespace file fixes this (Same forapproximateESS
etc.), would be nice if users can access all functions ;)