log_likelihood: Calculate (essentially) the log likelihood of a graph with...

Description Usage Arguments Value See Also

View source: R/fitting.R

Description

Or the log likelihood of the observation, given graph with parameters, depending how things are modeled. Basically this is just cost_function that doesn't optimize the edge variables but has them as an argument instead.

Usage

1
2
log_likelihood(f, concentration, matrix, graph,
  parameters = extract_graph_parameters(graph))

Arguments

f

The observed f statistics (the column D from data).

concentration

The Cholesky decomposition of the inverted covariance matrix. So if S is the covariance matrix, this is C = chol(S^(-1)) satisfying S^(-1) = C^t*C.

matrix

A column reduced edge optimisation matrix (typically given by the function build_edge_optimisation_matrix).

graph

The admixture graph. Here to give default value for:

parameters

Just because we need to know variable names.

Value

The output is a function. Given admixture proportions x and edge lengths e, the graph topology T implies an estimate F for the statistics f. This output function calculates

l = (F-f)^t*S^(-1)*(F-f)

from x and e. Up to a constant error and multiplier that is a log likelihood function, as

det(2*π*S)^(-1/2)*exp(-l/2)

can be seen as a likelihood of a graph with parameters, given the observation, or the other way around (possibly up to a normalization constant).

See Also

cost_function

edge_optimisation_function

calculate_concentration


mailund/admixture_graph documentation built on April 3, 2018, 9:28 p.m.