View source: R/branch_joint_probs.R
branch_joint_probs | R Documentation |
Provides a measure of the chances of following particular paths through the decision tree.
branch_joint_probs(model, ...) ## S3 method for class 'transmat' branch_joint_probs(model, nodes = NA, ...) ## S3 method for class 'dat_long' branch_joint_probs(model, nodes, ...) ## Default S3 method: branch_joint_probs(model, nodes, ...)
model |
Branch conditional probabilities (matrix) |
... |
Additional parameters |
nodes |
Which nodes to return; default to all |
These probabilities could be used to weight branch costs or QALYs to indicate the relative contribution to the total expected value.
Transition matrix with joint probabilities
model <- define_model( transmat = list(prob = matrix(data = c(NA, 0.5, 0.5, NA, NA, NA, NA, NA, NA, NA, 0.1, 0.9, NA, NA, NA, NA, NA, NA, NA, 0.9, 0.1), nrow = 3, byrow = TRUE), vals = matrix(data = c(NA, 1, 5, NA, NA, NA, NA, NA, NA, NA, 1, 9, NA, NA, NA, NA, NA, NA, NA, 9, 1), nrow = 3, byrow = TRUE))) model branch_joint_probs(model) # weighted vals branch_joint_probs(model)*model$vals # long data format df <- data.frame( from = c(1,2,1), to = c(2,3,4), prob = c(0.1,0.5,0.9), vals = c(1,2,3)) mod <- define_model(dat_long = df) branch_joint_probs(mod, nodes = 4) #0.9 branch_joint_probs(mod, nodes = 3) #0.1*0.5 branch_joint_probs(mod, nodes = 3)[[1]] |> cumprod()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.