observe_data {CausalQueries}R Documentation

Observe data, given a strategy

Description

Observe data, given a strategy

Usage

observe_data(
  complete_data,
  observed = NULL,
  nodes_to_observe = NULL,
  prob = 1,
  m = NULL,
  subset = NULL
)

Arguments

complete_data

A data.frame. Data observed and unobserved.

observed

A data.frame. Data observed.

nodes_to_observe

A list. Nodes to observe.

prob

A scalar. Observation probability.

m

A integer. Number of units to observe; if specified, m overrides prob.

subset

A character. Logical statement that can be applied to rows of complete data. For instance observation for some nodes might depend on observed values of other nodes; or observation may only be sought if data not already observed!

Value

A data.frame with logical values indicating which nodes to observe in each row of 'complete_data'.

Examples

model <- make_model("X -> Y")
df <- simulate_data(model, n = 8)
# Observe X values only
observe_data(complete_data = df, nodes_to_observe = "X")
# Observe half the Y values for cases with observed X = 1
observe_data(complete_data = df,
     observed = observe_data(complete_data = df, nodes_to_observe = "X"),
     nodes_to_observe = "Y", prob = .5,
     subset = "X==1")

[Package CausalQueries version 0.0.3 Index]