Skip to content

Instantly share code, notes, and snippets.

@kf0jvt
Created September 26, 2013 20:47
Show Gist options
  • Save kf0jvt/6720310 to your computer and use it in GitHub Desktop.
Save kf0jvt/6720310 to your computer and use it in GitHub Desktop.
simple script I use to estimate travel expense for a trip. Modify as needed.
library(mc2d)
flight_min = 323
flight_max = 660
flight_ml - 477
admission = 103.49
hotel_min = 177
hotel_max = 310
hotel_ml = 243
perdiem_min = 35
perdiem_max = 50
perdiem_ml = 42
taxi_min = 75
taxi_max = 150
taxi_ml = 100
days = 2
iterations = 3000
flight_cost = rpert(iterations,flight_min, flight_ml, flight_max)
hotel_cost = rpert(iterations,hotel_min*days, hotel_ml*days, hotel_max * days)
meal_cost = rpert(iterations, perdiem_min * days, perdiem_ml * days, perdiem_max * days)
taxi_cost = rpert(iterations, taxi_min, taxi_ml, taxi_max)
total = flight_cost + hotel_cost + meal_cost + taxi_cost + admission
summary(total)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment