Skip to content

Instantly share code, notes, and snippets.

my_packages <- c("tidyverse", "lubridate", "survival", "survminer",
"ProbBayes", "Bolstad", "ggplot2", "devtools",
"mc2d", "bayestestR", "scales", "knitr")
not_installed <-
my_packages[!(my_packages %in% installed.packages()[ , "Package"])]
if (length(not_installed)){
msgVal = paste("Install packages: ",toString(not_installed))
@ribsy
ribsy / ABTestingGenerativeModel.R
Last active July 15, 2022 14:34
This is a simple probabilistic programming example for AB testing security products. Its merely a simple starter example...with more to come. You can read more about this at https://www.soluble.ai/blog/security_budgets_at_risk
#' ---
#' title: 3 Metrics For Getting Better Security ROI
#' author: Richard Seiersen
#' date: June 4, 2020
#' output:
#' html_document:
#' toc: true
#' highlight: zenburn
source("manifesto_functions.R")
#############################
### Phish In 15 Lines of Code
## Simple ABCs of Phishing
# Make lot's of phish
sim_phish <- 1000000
source("manifesto_functions.R")
##################
### Get Small Data
#Engineer One and Two Remediation Rate Beliefs
eng_one <- c(4,7) #Median and 90% Stretch
eng_two <- c(2,4)
source("manifesto_functions.R")
##############################################
### Introduction: Random Bombs and Horse Kicks
# Bomb Narrative
bombs <- tibble(hits = c(0,1,2,3,4,5),
frequency = c(229, 211, 93, 35, 7, 1),
ratio = frequency/sum(frequency))
bombs
source("manifesto_functions.R")
###########################
### Non-Bayesian Wait Times
# Number of product teams
group_count = 10
# Empty Data Frame to hold results
dt <- tibble()
source("manifesto_functions.R")
######################
### Naive Escape Rates
MakeBetaGraph(10, 100, xlab = "Rate", ylab = "Strength",
tlab = "January Escape Rates",
slab = "Mean and Highest Density Interval", xadj = .001)
source("manifesto_functions.R")
#########################
### Beta-Binomial Example
# Make grid of 10K sequential possibilities between 0 to 1
plausible_rates <- data.frame(
possible_grid = seq(from = 0, to = 1, length = 10000))
source("manifesto_functions.R")
### OPTIONAL A/B Case Study
### Code Slide #1
# Declare list to hold configurations
base_configs <- list()
# Amount of simulation
base_configs["n_draws"] <- 100000
source("helper_functions.R")
#30MB File Upload
options(shiny.maxRequestSize = 30*1024^2)
ui <- dashboardPage(
title="Vuln Burndown",
dashboardHeader(title = "Vulnerability Burndown"),