fast_fit: A fast version of graph fitting. In mailund/admixture_graph: Admixture Graph Manipulation and Fitting

Description

Given a table of observed f statistics and a graph, uses Nelder-Mead algorithm to find the graph parameters (edge lengths and admixture proportions) that minimize the value of cost_function, i. e. maximizes the likelihood of a graph with parameters given the observed data. Like fit_graph but dropping most of the analysis on the result. Intended for use in big iteration loops.

Usage

 1 2 3 4 5 6 fast_fit(data, graph, point = list(rep(1e-05, length(extract_graph_parameters(graph)\$admix_prop)), rep(1 - 1e-05, length(extract_graph_parameters(graph)\$admix_prop))), Z.value = TRUE, concentration = calculate_concentration(data, Z.value), optimisation_options = NULL, parameters = extract_graph_parameters(graph), iteration_multiplier = 3)

Arguments

 data The data table, must contain columns W, X, Y, Z for sample names and D for the observed f_4(W, X; Y, Z). May contain an optional column Z.value for the Z scores (the f statistics divided by the standard deviations). graph The admixture graph (an agraph object). point If the user wants to restrict the admixture proportions somehow, like to fix some of them. A list of two vectors: the lower and the upper bounds. As a default the bounds are just it little bit more than zero and less than one; this is because sometimes the infimum of the values of cost function is at a point of non-continuity, and zero and one have reasons to be problematic values in this respect. Z.value Whether we calculate the default concentration from Z scores (the default option TRUE) or just use the identity matrix. concentration The Cholesky decomposition of the inverted covariance matrix. Default matrix determined by the parameter Z.value. optimisation_options Options to the Nelder-Mead algorithm. parameters In case one wants to tweak something in the graph. iteration_multiplier Given to mynonneg.

Value

A list containing only the essentials about the fit: graph is the graph input, best_error is the minimal value of cost_function, obtained when the admixture proportions are best_fit.