data_from_function {rcausim}R Documentation

Generate causally-simulated data

Description

Generate causally-simulated data

Usage

data_from_function(func, n)

Arguments

func

Functions, an object class generated by function_from_edge or function_from_user functions. All vertices must be defined for their functions. The causal structure needs to be a directed acyclic graph (DAG), which means no loops are allowed. Use edge_from_function to identify edges given a list of functions, then draw a causal diagram using the edges data frame (see vignettes). At least a function in the list must include 'n' as the only argument. All arguments within any function must be defined by their respective functions, except the argument 'n'. The output lengths of vertex functions must match the specified length 'n'.

n

Number of observations, a numeric of length 1, non-negative, and non-decimal.

Value

A data frame which include the simulated data for each vertex as a column.

Examples


data(functions)
data_from_function(functions, n = 100)

[Package rcausim version 0.1.1 Index]