make_events: Make data in compact form

View source: R/make_events.R

make_eventsR Documentation

Make data in compact form

Description

Draw n events given event probabilities. Draws full data only. For incomplete data see make_data.

Usage

make_events(
  model,
  n = 1,
  w = NULL,
  P = NULL,
  A = NULL,
  parameters = NULL,
  param_type = NULL,
  include_strategy = FALSE,
  ...
)

Arguments

model

A causal_model. A model object generated by make_model.

n

An integer. Number of observations.

w

A numeric matrix. A 'n_parameters x 1' matrix of event probabilities with named rows.

P

A data.frame. Parameter matrix. Not required but may be provided to avoid repeated computation for simulations.

A

A data.frame. Ambiguity matrix. Not required but may be provided to avoid repeated computation for simulations.

parameters

A vector of real numbers in [0,1]. Values of parameters to specify (optional). By default, parameters is drawn from model$parameters_df.

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.

include_strategy

Logical. Whether to include a 'strategy' vector. Defaults to FALSE. Strategy vector does not vary with full data but expected by some functions.

...

Arguments to be passed to make_priors if param_type == define

Value

A data.frame of events

Examples


model <- make_model('X -> Y')
make_events(model = model)
make_events(model = model, param_type = 'prior_draw')
make_events(model = model, include_strategy = TRUE)



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