Description Usage Arguments Value See Also Examples
Combines a list of (population) permutations and a list of graph topologies
to a big list of graphs, then fits those graphs to given data using parallel
computation. This function needs doParallel
, foreach
and
parallel
installed.
1 | fit_permutations_and_graphs(data, permutations, graphs, cores)
|
data |
The data table. |
permutations |
List of population permutations. |
graphs |
List of functions for producing graphs. |
cores |
Number of cores used. |
A list of fast_fit
results.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Let's experiment by fitting all the graphs with five leaves and at most one admixture
# event to a five population subset of the bear data. Note that with three data rows only
# we do wisely by not concluding too much about the actual bear family tree; this is to
# illustrate the function usage only!
data(bears)
data <- bears[16:18, ]
print(data)
permutations <- make_permutations(c("PB", "BLK", "Sweden", "Denali", "Kenai"))
graphs <- five_leaves_graphs
# We go with one core only as I don't know what kind of machine you are using.
fitted_graphs <- fit_permutations_and_graphs(data, permutations, graphs, 1)
# Now sort the fitted objects by best_error and see how the best graph looks like.
errors <- sapply(fitted_graphs, function(x) x$best_error)
best_graphs <- fitted_graphs[order(errors)]
plot(best_graphs[[1]]$graph, color = "goldenrod", title = best_graphs[[1]]$best_error)
# The same value for best_error actually occurs in the list 152 times because of our
# unsufficient data.
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.