Skip to contents

Performs a sensitivity analysis on the tree to find which actions (answering a new question or increasing confidence in an old one) will have the greatest positive impact on the root node's final confidence score.

Usage

get_confidence_boosters(tree, top_n = 5, verbose = TRUE)

Arguments

tree

The current data.tree object, typically after a conclusion is reached.

top_n

The number of suggestions to return.

verbose

Logical value (default TRUE) determining the level of output.

Value

A data.frame of the top_n suggested actions, ranked by potential gain.

Examples

# Load a tree
ethical_tree <- load_tree_df(ethical)

# Answer some questions
set_answer(ethical_tree, "FIN2", TRUE, 4)
#> Answer for leaf 'FIN2' set to: TRUE with confidence 4/5
set_answer(ethical_tree, "FIN4", TRUE, 3)
#> Answer for leaf 'FIN4' set to: TRUE with confidence 3/5
set_answer(ethical_tree, "FIN5", TRUE, 2)
#> Answer for leaf 'FIN5' set to: TRUE with confidence 2/5
set_answer(ethical_tree, "ENV5", TRUE, 3)
#> Answer for leaf 'ENV5' set to: TRUE with confidence 3/5
set_answer(ethical_tree, "SOC2", TRUE, 4)
#> Answer for leaf 'SOC2' set to: TRUE with confidence 4/5
set_answer(ethical_tree, "GOV1", TRUE, 1)
#> Answer for leaf 'GOV1' set to: TRUE with confidence 1/5
set_answer(ethical_tree, "GOV2", TRUE, 2)
#> Answer for leaf 'GOV2' set to: TRUE with confidence 2/5
set_answer(ethical_tree, "GOV3", TRUE, 1)
#> Answer for leaf 'GOV3' set to: TRUE with confidence 1/5
set_answer(ethical_tree, "GOV4", TRUE, 1)
#> Answer for leaf 'GOV4' set to: TRUE with confidence 1/5
set_answer(ethical_tree, "GOV5", TRUE, 1)
#> Answer for leaf 'GOV5' set to: TRUE with confidence 1/5

# Updated tree
ethical_tree <- update_tree(ethical_tree)

# View the tree
print_tree(ethical_tree)
#> Tree                                             Rule      Answer      Confidence   
#> Invest in Company X                               AND       TRUE        3.3% 
#> |-- Financial Viability                           AND       TRUE        50.4% 
#> |   |-- Profitability and Growth Signals          OR        TRUE        90% 
#> |   |   |-- FIN1                                                         
#> |   |   |-- FIN2                                            TRUE        4 
#> |   |   `-- FIN3                                                         
#> |   `-- Solvency and Stability                    AND       TRUE        56% 
#> |       |-- FIN4                                            TRUE        3 
#> |       `-- FIN5                                            TRUE        2 
#> |-- Acceptable Environmental Stewardship          OR        TRUE        80% 
#> |   |-- Has a Clean Current Record                AND                    
#> |   |   |-- ENV1                                                         
#> |   |   |-- ENV2                                                         
#> |   |   `-- ENV3                                                         
#> |   `-- Has a Credible Transition Pathway         OR        TRUE        80% 
#> |       |-- ENV4                                                         
#> |       |-- ENV5                                            TRUE        3 
#> |       `-- ENV6                                                         
#> |-- Demonstrable Social Responsibility            OR        TRUE        90% 
#> |   |-- Shows Excellent Internal Culture          OR        TRUE        90% 
#> |   |   |-- SOC1                                                         
#> |   |   |-- SOC2                                            TRUE        4 
#> |   |   |-- SOC3                                                         
#> |   |   `-- SOC4                                                         
#> |   `-- Has a Positive External Impact            AND                    
#> |       |-- SOC5                                                         
#> |       |-- SOC6                                                         
#> |       `-- SOC7                                                         
#> `-- Strong Corporate Governance                   AND       TRUE        9.1% 
#>     |-- GOV1                                                TRUE        1 
#>     |-- GOV2                                                TRUE        2 
#>     |-- GOV3                                                TRUE        1 
#>     |-- GOV4                                                TRUE        1 
#>     `-- GOV5                                                TRUE        1 

# Get guidance on how to improve the confidence ---
guidance <- get_confidence_boosters(ethical_tree, verbose = FALSE)
print(guidance)
#>                   action name
#> GOV1 Increase Confidence GOV1
#> GOV3 Increase Confidence GOV3
#> GOV4 Increase Confidence GOV4
#> GOV5 Increase Confidence GOV5
#> FIN5 Increase Confidence FIN5
#>                                                                                    question
#> GOV1                            The board of directors is majority independent and diverse.
#> GOV3 Political lobbying and donations are transparent and align with stated company values.
#> GOV4                 Has strong shareholder protection rights (e.g., no dual-class shares).
#> GOV5               Tax practices are transparent and fair (no excessive use of tax havens).
#> FIN5                                  Company generates strong and positive free cash flow.
#>                details potential_gain
#> GOV1 Current conf: 1/5         +2.19%
#> GOV3 Current conf: 1/5         +2.19%
#> GOV4 Current conf: 1/5         +2.19%
#> GOV5 Current conf: 1/5         +2.19%
#> FIN5 Current conf: 2/5         +1.41%