Skip to content

Instantly share code, notes, and snippets.

@zph
Created October 5, 2014 22:50
Show Gist options
  • Select an option

  • Save zph/c49eee7d86e2c718e8f5 to your computer and use it in GitHub Desktop.

Select an option

Save zph/c49eee7d86e2c718e8f5 to your computer and use it in GitHub Desktop.
(ns employee-vs-contractor.core)
(def pct 100)
(defn health-insurance [health-insurance percent]
"Calculates the value of health insurance coverage. Provide percent as [100]"
(let [months 12.0]
(/ (* months health-insurance percent) pct)))
(defn vacation [salary paid-days work-days]
"Calculate value of vacation time."
(/ (* salary paid-days) work-days))
(defn sick-day [salary sick-days work-days]
"Calculate the sick day value."
(/ (* salary sick-days) work-days))
(defn retirement [salary max-contribution matching vesting]
"Calculate value of retirement contributions. max-contribution [Int ie 3] matching and vesting as 100 for immediate"
(/ (* salary max-contribution matching vesting) (* pct pct pct)))
(defn reduced-taxes [extra-cost tax-bracket]
"Calculate tax reduction based on deductible costs and tax bracket."
(/ (* extra-cost tax-bracket) pct))
(def social-services-rate 0.0625)
(defn social-services-taxation [salary cutoff]
(let [rate social-services-rate]
(if (> salary cutoff)
(* cutoff rate)
(* salary rate))))
(def social-security-cutoff 97500.00)
(defn social-security [salary]
(social-services-taxation salary social-security-cutoff))
(def unemployment-income-cutoff 7000.00)
(defn unemployment [salary]
(social-services-taxation salary unemployment-income-cutoff))
(def medicare-tax-rate 0.0145)
(defn medicare [salary]
(* salary medicare-tax-rate))
(defn contractor-equivalent-from-salary [s]
(let [salary s
health-insurance-cost 800
health-insurance-percent 80
pto-days 14
work-days 230 ;; 240 days/yr minus 10 federal holidays
sick-days 5
max-contribution 3 ;; max pct contribution for match
matching 100 ;; pct that they match per dollar
vesting 100 ;; 100 if vested immediately, 33 if 1/3 kept after 1 year
deductible-costs 2000.0 ;; costs written off as contractor
training-budget 5000.0
training-days-paid 6
tax-bracket 28]
(-
(+ salary
(* training-budget (+ 1.0 (/ tax-bracket 100))) ;; convert training budget to post tax equiv
(vacation salary training-days-paid work-days)
;; benefits of employee
(health-insurance health-insurance-cost health-insurance-percent)
(vacation salary pto-days work-days)
(sick-day salary sick-days work-days)
(retirement salary max-contribution matching vesting)
(social-security salary)
(unemployment salary)
(medicare salary))
;; losses
(reduced-taxes deductible-costs tax-bracket))))
(def employee-salary 90000)
(defn equiv-salary
[]
(contractor-equivalent-from-salary employee-salary))
(equiv-salary)
; (defn backtrack-to-hourly [yearly]
; (let [work-days 230
; days-off 20
; hours-per-day 8
; ]
; (/ yearly
; (- work-days
; days-off
; paid-days)
; hours-per-day)))
; (backtrack-to-hourly (equiv-salary))
; (defn hourly-to-yearly [hourly]
; (let [paid-days 210
; hours-per-day 8]
; (* hourly
; hours-per-day
; paid-days)))
; (hourly-to-yearly 80.0)
;;(/ (equiv-salary) employee-salary)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment