-
Notifications
You must be signed in to change notification settings - Fork 25
/
model
147 lines (95 loc) · 4.85 KB
/
model
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
set terminal postscript color
set logscale y
# 1: year
# 2: median rent
# 3: housing units extant
# 4: net new housing units
# 5: employment in city
# 6: total wages of these employees
# 7: consumer price index
set xlabel "Year"
set ylabel "Median advertised asking rent"
set xrange [1946:2018]
plot "combined" using 1:2 title "Advertised monthly rent", 78 * 1.066 ** (x - 1956)
set ylabel "CPI-adjusted (1983-1984 dollars) median advertised rent"
plot "combined" using 1:($2 / $7) title "CPI-adjusted advertised rent", 316 * 1.025 ** (x - 1956)
unset logscale y
set xrange [1906:2017]
set yrange [0:]
set ylabel "Housing units"
plot "combined" using 1:4 with steps title "Net new housing units constructed"
set ylabel "Housing units"
plot "combined" using 1:3 with steps title "Total housing units existing"
unset yrange
set logscale y
set ylabel "CPI-adjusted median advertised asking rent and wages"
set xrange [1973:2017]
plot "combined" using 1:($2 / $7) title "Median asking monthly rent", "combined" using 1:($6 / $7 / 1000000 / 12) title "Total CPI-adjusted monthly wages paid, divided by 1 million"
set logscale y
set ylabel "CPI-adjusted median wages"
set xrange [1973:2017]
plot "combined" using 1:($11 / $7 / 12) title "Santa Clara County CPI-adjusted monthly wages paid", "combined" using 1:($6 / $7 / 12) title "San Francisco CPI-adjusted monthly wages paid"
#### ORIGINAL MODEL (employment only)
set dummy per_capita_wages, employment
f(per_capita_wages, employment) = m * per_capita_wages ** pcw_e * employment ** employment_e
m = 2.03118e-11
pcw_e = 1.35374
employment_e = 1.31782
unset xrange
FIT_LIMIT=1e-6
# fit log(f(per_capita_wages, employment)) "combined" using ($6 / $7 / $5):5:(log($2 / $7)) via m, pcw_e, employment_e
set logscale y
set ylabel "CPI-adjusted median advertised asking rent"
set xrange [1973:2017]
plot "combined" using 1:($2 / $7) title "Median asking monthly rent", "combined" using 1:(f($6 / $7 / $5, $5)) with lines title "2.03118e-11 * wages ** 1.35374 * employment ** 1.31782"
##### NEW MODEL (employment only)
set dummy per_capita_wages, employment
f(per_capita_wages, employment) = m * per_capita_wages ** pcw_e * employment ** employment_e
m = 2.15623e-09
pcw_e = 1.2966
employment_e = 1.00829
unset xrange
FIT_LIMIT=1e-6
fit log(f(per_capita_wages, employment)) "combined" using ($6 / $7 / $5):5:(log($2 / $7)) via m, pcw_e, employment_e
set logscale y
set ylabel "CPI-adjusted median advertised asking rent"
set xrange [1973:2017]
plot "combined" using 1:($2 / $7) title "Median asking monthly rent", "combined" using 1:(f($6 / $7 / $5, $5)) with lines title "2.15623e-09 * wages ** 1.29664 * employment ** 1.00829"
#### ORIGINAL MODEL (employment and construction)
set dummy units, per_capita_wages, employment
f(units, per_capita_wages, employment) = m * units ** units_e * per_capita_wages ** pcw_e * employment ** employment_e
m = 0.377216
units_e = -2.52214
pcw_e = 1.89709
employment_e = 1.54156
unset xrange
FIT_LIMIT=1e-6
# fit log(f(units, per_capita_wages, employment)) "combined" using 3:($6 / $7 / $5):5:(log($2 / $7)) via m, units_e, pcw_e, employment_e
set logscale y
set ylabel "CPI-adjusted median advertised asking rent"
set xrange [1973:2017]
plot "combined" using 1:($2 / $7) title "Median asking monthly rent", "combined" using 1:(f($3, $6 / $7 / $5, $5)) with lines title "0.377216 * units ** -2.52214 * wages ** 1.89709 * employment ** 1.54156"
#### NEW MODEL (employment and construction)
set dummy units, per_capita_wages, employment
f(units, per_capita_wages, employment) = m * units ** units_e * per_capita_wages ** pcw_e * employment ** employment_e
m = 1.52078
units_e = -2.14244
pcw_e = 1.76441
employment_e = 1.17175
unset xrange
FIT_LIMIT=1e-6
fit log(f(units, per_capita_wages, employment)) "combined" using 3:($6 / $7 / $5):5:(log($2 / $7)) via m, units_e, pcw_e, employment_e
set logscale y
set ylabel "CPI-adjusted median advertised asking rent"
set xrange [1973:2017]
plot "combined" using 1:($2 / $7) title "Median asking monthly rent", "combined" using 1:(f($3, $6 / $7 / $5, $5)) with lines title "1.520786 * units ** -2.14244 * wages ** 1.76441 * employment ** 1.17175"
exit
unset xrange
FIT_LIMIT=1e-6
set dummy units, per_capita_wages, employment, interest
f(units, per_capita_wages, employment, interest) = m * units ** units_e * per_capita_wages ** pcw_e * employment ** employment_e * interest ** interest_e
fit log(f(units, per_capita_wages, employment, interest)) "combined" using 3:($6 / $7 / $5):5:18:(log($2 / $7)) via m, units_e, pcw_e, employment_e, interest_e
set logscale y
set ylabel "CPI-adjusted median advertised asking rent"
set xrange [1973:2017]
plot "combined" using 1:($2 / $7) title "Median asking monthly rent", "combined" using 1:(f($3, $6 / $7 / $5, $5, $18)) with lines