Skip to content
Snippets Groups Projects
Commit 7933d6c8 authored by thierrychambert's avatar thierrychambert
Browse files

Shiny : added quantile impact result (text)

parent ff21b13f
No related branches found
No related tags found
No related merge requests found
......@@ -1844,6 +1844,13 @@ server <- function(input, output, session){
})
output$quantile_impact_result <- renderText({
dr_N <- get_metrics(N = out$run$N, cumulated_impacts = param$cumulated_impacts)$scenario$DR_N
QT <- quantiles_impact(dr_N, show_quantile = 1-(input$risk_A/100), show_CI = NULL, percent = TRUE)$QT[-1]
paste0("Scnario ", 1:length(QT), " : ", round(QT,1), "%\n", collapse = "")
})
#############################################
## Plot Impacts over time
##-------------------------------------------
......
......@@ -830,6 +830,12 @@ rm(list = ls(all.names = TRUE))
conditionalPanel("output.hide_risk_A",
wellPanel(style = "background:#F0F8FF",
sliderInput("risk_A", label = "Risque (%) de sous-estimation de l'impact", min = 0, max = 100, value = 5, step = 0.5),
br(),
h5(strong("Valeur (quantile) de l'impact")),
#, style = "font-weight: bold; font-size: 18px;")
span(verbatimTextOutput("quantile_impact_result"), align = "left", style = "font-weight: bold; font-size: 18px;"),
)
), # close conditional panel
......
......@@ -7,7 +7,7 @@ library(magrittr)
library(eolpop)
## Inputs
nsim = 500
nsim = 50
pop_size_mean = 300
pop_size_se = 0
......@@ -163,12 +163,20 @@ names(res)
# indiv
#dr_N <- get_metrics(N = out$run$N, cumulated_impacts = cumulated_impacts)$indiv_farm$DR_N
dr_N <- res$indiv_farm$DR_N
# scenario
dr_N <- get_metrics(N = out$run$N, cumulated_impacts = cumulated_impacts)$scenario$DR_N
quantiles_impact(dr_N, show_quantile = 0.975, show_CI = NULL, percent = TRUE)$QT[-1]
QT <- quantiles_impact(dr_N, show_quantile = 0.975, show_CI = NULL, percent = TRUE)$QT[-1]
paste("Scnario", 1:length(QT), ":", round(QT,1), "\n")
###
dim(N)
ECDF_impact(N, show_quantile = 0.95, sel_sc = 1,
ECDF_impact(N, show_quantile = 0.975, sel_sc = 3,
percent = TRUE, xlab = "Relative impact (%)", ylab = "Cumulative density",
Legend = NULL, legend_position = "right", text_size = "large")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment