bn_node: Specify a variable node in the network

View source: R/bn_node.R

bn_nodeR Documentation

Specify a variable node in the network

Description

Specify a variable node in the network

Usage

bn_node(variable_formula, missing_rate = ~0, keep = TRUE, needs = character())

Arguments

variable_formula

A RHS-only formula specified how to simulate that variable. Use ..n for the number of observations, which is later replaced by pop_size in the bn_simulate function.

missing_rate

A RHS-only formula. This specifies how missing values should be distributed. Can use a simple proportion such as ~0.5 or missingness can depend on other values for example using ~plogis(-2 + age*0.05), which says missingness increases with age.

keep

logical. Should this variable be kept in the final simulated output or not

needs

A character vector of variables. If any variables given in needs are missing / NA, then this variable is missing too.

Value

Object of class node and list.

Examples

bn_node(variable_formula = ~floor(rnorm(n=..n, mean=60, sd=15)))

wjchulme/dd4d documentation built on Dec. 22, 2024, 3:37 a.m.