Learn R Programming

CausalQueries (version 0.0.3)

make_data_single: Generate full dataset

Description

Generate full dataset

Usage

make_data_single(
  model,
  n = 1,
  parameters = NULL,
  param_type = 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.

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

Run this code
# NOT RUN {
model <- make_model("X -> Y")

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

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

# Simulate multiple datasets is fastest if w is provided
w <- get_event_prob(model)
replicate(5, CausalQueries:::make_data_single(model, n = 5, w = w))

# }

Run the code above in your browser using DataLab