This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Risk management simulations | |
using CSV, DataFrames, StatsBase, Random | |
############################## | |
## Trades to double | |
############################## | |
winPerc = .46 | |
AvgWin = .14 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##################################### | |
# Export PSVs with EXERNAL / DEFAULT schedules (own export) | |
# Find PSVs with NO OVERHAUL schedule (own export) | |
# Compare - filter by no overhaul | |
##################################### | |
# load data | |
externals = read.csv("C:/Users/Andrew.Bannerman/Desktop/MARS/PSV KPI project/externals.csv") | |
internals = read.csv("C:/Users/Andrew.Bannerman/Desktop/MARS/PSV KPI project/overhauls.csv") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################################# | |
# Calculating the Required Structural Thickness of Pipe Using Beam Stress Theory | |
############################################################################################# | |
# Input parameters | |
P = 850 # pressure | |
Do = 12.75 # outside diameter | |
S = 17900 # code allowable stress | |
E = .85 # weld joint efficieny | |
W = 1.0 | |
Y = 0.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Dates | |
using DataFrames | |
using Gadfly | |
using CSV | |
using Statistics | |
### methodology | |
# 1. amoritzation schedule per property | |
# 2. initial down payment + principal + any estimated equity due to renovations (conservative estimates) | |
# 3. account for any refinances - amooritization schedule for each and join |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Amortization | |
# https://www.wikihow.com/Calculate-Amortization | |
# Step 1 - Gather the information you need to calculate the loan's amortization | |
property_value = 240000 | |
loan_amount = .75 | |
down_payment = property_value-(loan_amount * property_value) | |
debt_borrowed = property_value - down_payment | |
interest_rate = 0.06 # annual interest rate | |
loan_term = 360 # months |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggmap) | |
google_map_api_key = ## | |
data = read.csv("C:/Users/Andrew.Bannerman/Desktop/Real Estate/County Tax Lists/harris_county_tax_list/Real_acct_owner/filtered_list.csv", stringsAsFactors = F,header=T, sep=",") | |
real_acct_names = c("account","tax_year","mailto","mail_addr_one","mail_addr_two","mail_city","mail_state","mail_zip","mail_country","undeliverable","str_pfx","str_num","str_num_sfx","str_name","str_sfx","str_sfx_dir","str_unit","site_addr_one","site_addr_two","site_addr_three","state_class","school_dist","map_facet","key_map", | |
"neighborhood_code","neighborhood_group","market_area_one","market_area_one_dscr","market_area_two","market_area_two_dscr","econ_area","econ_bld_class","center_code","yr_impr","yr_annexed","splt_dt","dsc_cd","nxt_building","total_building_area","total_land_area","acerage","cap_account","shared_cap_code","land_value","improvement_value","extra_feartures_value","ag_value","assessed_value","total_appraised_value", | |
"total_market_value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data = read.csv("C:/Users/Andrew.Bannerman/Desktop/MARS/risk studies/for_r_plot.csv",header=T) | |
data = data[order(data$COF.Rank),] | |
#data = data[sample(nrow(data)),] | |
head(data) | |
names = c("Corrosion Loop","CL","Service","POF","Nominal Wall Thickness Category","COF Rank","Risk") | |
colnames(data) = names |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data = read.csv("C:/Users/Andrew.Bannerman/Desktop/MARS/15. PoC/3.24/PS_out_FCA.csv", header=T, stringsAsFactors = F) | |
FCAml = as.numeric(as.vector(data[6,2:length(data)])) | |
Rt = as.numeric(as.vector(data[9,2:length(data)])) | |
MAWPr = round(as.numeric(as.vector(data[18,2:length(data)])),digits=0) | |
MAWPr_P_intersection = ifelse(MAWPr > P,1,0) | |
df = data.frame(FCAml,Rt,MAWPr,MAWPr_P_intersection) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Distributions | |
using CSV | |
using DataFrames | |
using Statistics | |
using Cairo | |
using Gadfly | |
# read data | |
colnames = ["P&ID","Size","Service","Line_No","Sch","Spec","Exp Code","Design Temp"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Plots for PArt 5 LTA sensitivity analysis | |
library(sm) | |
library(pheatmap) | |
library(ggplot2) | |
# original Grid | |
M1 = c(0.300, 0.300, 0.300, 0.300, 0.300, 0.300, 0.300, 0.300, 0.300, 0.300, 0.300, 0.300, 0.300, 0.300, 0.300, 0.300, 0.300, 0.300, 0.300, 0.300, 0.300, 0.300) | |
M2 = c(0.300, 0.300, 0.300, 0.300, 0.300, 0.300, 0.300, 0.100, 0.220, 0.280, 0.250, 0.240, 0.300, 0.300, 0.300, 0.300, 0.300, 0.300, 0.300, 0.300, 0.300, 0.300) | |
M3 = c(0.300, 0.300, 0.300, 0.300, 0.300, 0.215, 0.255, 0.215, 0.145, 0.275, 0.170, 0.240, 0.250, 0.250, 0.280, 0.290, 0.300, 0.300, 0.300, 0.300, 0.300, 0.300) | |
M4 = c(0.300, 0.300, 0.300, 0.300, 0.300, 0.170, 0.270, 0.190, 0.190, 0.285, 0.250, 0.225, 0.275, 0.300, 0.300, 0.300, 0.300, 0.300, 0.300, 0.300, 0.300, 0.300) |