This object represents an estimate of the relevant factors of the likelihood estimated from data, or based on a priori knowledge where appropriate. That is, it represents some subset of $P_n$. This object inherits from Lrnr_base, and so shares some properties with sl3 learners. Specifically, to fit a likelihood object to data, one calls likelihood$train(tmle3_task). Each likelihood factor is represented by an object inheriting from LF_base.

Likelihood

make_Likelihood(...)

Arguments

...

Passes all arguments to the constructor. See documentation for the Constructor below.

Format

R6Class object.

Value

Likelihood object

Constructor

make_Likelihood(factor_list, ...)

factor_list

A list of objects inheriting from LF_base, representing the individual relevant factors.

...

Not currently used.

Methods

validate_task(tmle_task)

Ensure that this likelihood is compatible with a particular tmle3_Task, in that the factor names must match the tmle_task$npsem names.

get_initial_likelihoods(tmle_task, nodes=NULL)

Gets initial (i.e. before any TMLE updates) likelihood values for the specified nodes (or all nodes if none are specified) for the observations in tmle_task.

  • tmle_task: tmle3_Task to get likelihood values for

  • nodes: character vectors, the list of nodes to get likelihood values for. If missing, values will be provided for all nodes.

get_likelihoods(tmle_task, nodes=NULL)

Gets updated (i.e. after all TMLE updates) likelihood values for the specified nodes (or all nodes if none are specified) for the observations in tmle_task.

  • tmle_task: tmle3_Task to get likelihood values for

  • nodes: character vectors, the list of nodes to get likelihood values for. If missing, values will be provided for all nodes.

get_possible_counterfactuals(nodes)

Gets all possible combination of counterfactual values for a set of nodes. This is useful for marginalizing over a node. Returns a data.frame with one row per possibility.

  • nodes: character vectors, the list of nodes to get counterfactual values for. If missing, values will be provided for all nodes.

Fields

factor_list

The list of LF_base objects specifying the relevant likelihood factors

observed_values

The likelihood values for the observed data. These are cached, as they are used in many places in TMLE

update_list

A list of tmle_updates that have been calculated for this likelihood

See also