make_data_single: Generate full dataset

View source: R/make_data.R

make_data_singleR Documentation

Generate full dataset

Description

Generate full dataset

Usage

make_data_single(
  model,
  n = 1,
  parameters = NULL,
  param_type = NULL,
  given = NULL,
  w = NULL,
  P = NULL,
  A = NULL
)

Arguments

model

A causal_model. A model object generated by make_model.

n

An integer. Number of observations.

parameters

A numeric vector. Values of parameters may be specified. By default, parameters is drawn from priors.

param_type

A character. String specifying type of parameters to make ("flat", "prior_mean", "posterior_mean", "prior_draw", "posterior_draw", "define). With param_type set to define use arguments to be passed to make_priors; otherwise flat sets equal probabilities on each nodal type in each parameter set; prior_mean, prior_draw, posterior_mean, posterior_draw take parameters as the means or as draws from the prior or posterior.

given

A string specifying known values on nodes, e.g. "X==1 & Y==1"

w

Vector of event probabilities can be provided directly. This is useful for speed for repeated data draws.

P

A matrix. Parameter matrix that can be used to generate w if w is not provided

A

A matrix. Ambiguity matrix that can be used to generate w if w is not provided

Value

A data.frame of simulated data.

Examples


model <- make_model("X -> Y")

# Simplest behavior uses by default the parameter vector contained in model
CausalQueries:::make_data_single(model, n = 5)

CausalQueries:::make_data_single(model, n = 5, param_type = "prior_draw")

# Simulate multiple datasets. This is fastest if
# event probabilities (w) are  provided
w <- get_event_probabilities(model)
replicate(5, CausalQueries:::make_data_single(model, n = 5, w = w))


CausalQueries documentation built on June 22, 2024, 6:50 p.m.