Nothing
Start by defining the causal structure as a data frame of edges:
library(rcausim)
library(knitr) library(kableExtra)
# Load predefined edge data data(edges)
edges %>% kable() %>% kable_classic()
Assist in setting up functions based on these edges:
# Generate function setups from edge definitions functions <- function_from_edge(edges) print(functions)
Define specific functions:
# Define a function for vertex B function_B <- function(n){ rnorm(n, mean = 90, sd = 5) } functions <- define(functions, 'B', function_B) print(functions)
You can also start by defining functions directly:
# Define a function for vertex B function_B <- function(n){ rnorm(n, mean = 90, sd = 5) } # Define a function for vertex A function_A <- function(B){ ifelse(B>=95, 1, 0) } # Combine functions in a list functions <- list(A = function_A, B = function_B) functions <- function_from_user(functions)
Ensure the causal structure is a directed acyclic graph (DAG):
library(igraph)
# Set up edges based on functions edges <- edge_from_function(functions) # Check if the resulting edges form a DAG g <- graph_from_data_frame(edges, directed = TRUE) is_dag(g)
Generate simulated data based on the predefined functions:
# Assume completed functions setup data(functions) # Generate simulated data set.seed(1) simulated_data <- data_from_function(functions, n = 100)
simulated_data %>% kable() %>% kable_classic()
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.