generate_condprob {R6causal} | R Documentation |
Define structural function by a conditional probability table
Description
Define structural function by a conditional probability table
Usage
generate_condprob(ycondx, x, Umerge_expr = NULL)
Arguments
ycondx |
A data table or a data frame with the following structure
|
x |
A data table or a data frame that contains data on the variables in the
middle columns of |
Umerge_expr |
A character string specifying how the U-variables will be combined when the value "Y" is generated, e.g. "u" or "(u1+u2)/2". The result of the expression should be a random number in the interval [0,1]. |
Value
A data table containing the generated variable, "Y"
Examples
ycondx <- data.table::data.table(y =rep(c(0,1), each = 3), x=rep(1:3, 2),
prob = c(0.2,0.6,0.1,0.8,0.4,0.9))
x <- data.table::data.table(x = sample(1:3, 20, replace = TRUE),
uy = stats::runif(20), uy2 = stats::runif(20))
generate_condprob(ycondx, x, Umerge_expr = "(uy+uy2)/2")
[Package R6causal version 0.8.3 Index]