sample_distribution: Sample a distribution of observable probabilities that...

View source: R/causal-model.R

sample_distributionR Documentation

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)
 }
)

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).

Value

A vector of observable probabilities that satisfy the causal model

Examples


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)


causaloptim documentation built on Oct. 17, 2024, 9:08 a.m.