-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmodels_SolowGrowthModel.fsx
44 lines (32 loc) · 1.15 KB
/
models_SolowGrowthModel.fsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#load "Setup.fsx"
open FSharp.Charting
type Parameters =
{ labour : float
investmentRate : float
depreciationRate : float }
let gdp p machines =
p.labour * sqrt machines
let nextYearMachines p machines =
machines + (gdp p machines) * p.investmentRate - machines * p.depreciationRate
let nextYearGdp p machines =
gdp p (nextYearMachines p machines)
let equilibriumMachines p =
(p.investmentRate * p.labour / p.depreciationRate) ** 2.0
let growth p machines =
nextYearGdp p machines / gdp p machines - 1.0
let equilibriumGdp p =
gdp p (equilibriumMachines p)
let plotGdp p initialMachines years =
Seq.unfold (fun machines -> Some(gdp p machines, nextYearMachines p machines)) initialMachines
|> Seq.take years
|> Chart.Line
let plotGrowth p initialMachines years =
initialMachines
|> Seq.unfold (fun machines -> Some(growth p machines, nextYearMachines p machines))
|> Seq.map (fun growth -> growth * 100.0)
|> Seq.take years
|> Chart.Column
let p = { labour = 100.0; investmentRate = 0.2; depreciationRate = 0.1 }
let machines = 3600.0
plotGdp p machines 50
plotGrowth p machines 50