Calculate the log-likelihood ratios from given log-likelihoods.

Share:

Description

From a data.table containing the log-likelihoods for all event types, and for the null hypothesis of no event, calculates the log-likelihood ratios by subtracting null log-likelihoods from the event log-likelihoods, for each location, stream, and event duration.

Usage

1
add_llr(loglikelihoods, null_name)

Arguments

loglikelihoods

A data.table containing at least the columns event, location, stream, duration and loglikelihood. The first four columns must be key columns, in that order. The column event contains all event types (given e.g. as integers or strings) and also the null hypothesis, as specified by the argument null_name.

null_name

The identifier for the null hypothesis in the column event of the input argument loglikelihoods. E.g. 0L if event types are specified as integers, or "null" if event types are specified as strings.

Value

A data.table with key columns location, event, stream, duration, and a column llr containing the log-likelihood ratios for each event type.

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.