Learn R Programming

causaloptim (version 1.0.0)

sample_distribution: Sample a distribution of observable probabilities that satisfy the causal model

Description

Sample a distribution of observable probabilities that satisfy the causal model

Usage

sample_distribution(
  obj,
  simplex_sampler = function(k) {
     rdirichlet(k, alpha = 1)
 }
)

Value

A vector of observable probabilities that satisfy the causal model

Arguments

obj

An object of class "causalmodel"

simplex_sampler

A function to generate a random sample from the simplex in k dimensions, where k is the number of variables (q parameters, obj$data$variables). By default this is uniform (symmetric dirichlet with parameter 1).

Examples

Run this code

graph <- initialize_graph(graph_from_literal(Z -+ X, X -+ Y, Ur -+ X, Ur -+ Y))
prob.form <- list(out = c("X", "Y"), cond = "Z")

iv_model <- create_causalmodel(graph, prob.form = prob.form)
sample_distribution(iv_model)

Run the code above in your browser using DataLab