Heights problem
We estimate simple linear regression model with a half-T prior.
using DynamicHMCModels
ProjDir = rel_path_d("..", "scripts", "04")
cd(ProjDir)
Import the dataset.
howell1 = CSV.read(rel_path("..", "data", "Howell1.csv"), delim=';');
df = convert(DataFrame, howell1);
height | weight | age | male | |
---|---|---|---|---|
Float64 | Float64 | Float64 | Int64 | |
1 | 151.765 | 47.8256 | 63.0 | 1 |
2 | 139.7 | 36.4858 | 63.0 | 0 |
3 | 136.525 | 31.8648 | 65.0 | 0 |
4 | 156.845 | 53.0419 | 41.0 | 1 |
5 | 145.415 | 41.2769 | 51.0 | 0 |
6 | 163.83 | 62.9926 | 35.0 | 1 |
7 | 149.225 | 38.2435 | 32.0 | 0 |
8 | 168.91 | 55.48 | 27.0 | 1 |
9 | 147.955 | 34.8699 | 19.0 | 0 |
10 | 165.1 | 54.4877 | 54.0 | 1 |
11 | 154.305 | 49.8951 | 47.0 | 0 |
12 | 151.13 | 41.2202 | 66.0 | 1 |
13 | 144.78 | 36.0322 | 73.0 | 0 |
14 | 149.9 | 47.7 | 20.0 | 0 |
15 | 150.495 | 33.8493 | 65.3 | 0 |
16 | 163.195 | 48.5627 | 36.0 | 1 |
17 | 157.48 | 42.3258 | 44.0 | 1 |
18 | 143.942 | 38.3569 | 31.0 | 0 |
19 | 121.92 | 19.6179 | 12.0 | 1 |
20 | 105.41 | 13.948 | 8.0 | 0 |
21 | 86.36 | 10.4893 | 6.5 | 0 |
22 | 161.29 | 48.9879 | 39.0 | 1 |
23 | 156.21 | 42.7227 | 29.0 | 0 |
24 | 129.54 | 23.5868 | 13.0 | 1 |
25 | 109.22 | 15.9891 | 7.0 | 0 |
26 | 146.4 | 35.4936 | 56.0 | 1 |
27 | 148.59 | 37.9033 | 45.0 | 0 |
28 | 147.32 | 35.4652 | 19.0 | 0 |
29 | 137.16 | 27.3289 | 17.0 | 1 |
30 | 125.73 | 22.6796 | 16.0 | 0 |
31 | 114.3 | 17.8602 | 11.0 | 1 |
32 | 147.955 | 40.313 | 29.0 | 1 |
33 | 161.925 | 55.1114 | 30.0 | 1 |
34 | 146.05 | 37.5064 | 24.0 | 0 |
35 | 146.05 | 38.4986 | 35.0 | 0 |
36 | 152.705 | 46.6066 | 33.0 | 0 |
37 | 142.875 | 38.8388 | 27.0 | 0 |
38 | 142.875 | 35.5786 | 32.0 | 0 |
39 | 147.955 | 47.4004 | 36.0 | 0 |
40 | 160.655 | 47.8823 | 24.0 | 1 |
41 | 151.765 | 49.4132 | 30.0 | 1 |
42 | 162.865 | 49.3848 | 24.0 | 1 |
43 | 171.45 | 56.5573 | 52.0 | 1 |
44 | 147.32 | 39.1223 | 42.0 | 0 |
45 | 147.955 | 49.8951 | 19.0 | 0 |
46 | 144.78 | 28.8031 | 17.0 | 0 |
47 | 121.92 | 20.4116 | 8.0 | 1 |
48 | 128.905 | 23.36 | 12.0 | 0 |
49 | 97.79 | 13.2676 | 5.0 | 0 |
50 | 154.305 | 41.2485 | 55.0 | 1 |
51 | 143.51 | 38.5553 | 43.0 | 0 |
52 | 146.7 | 42.4 | 20.0 | 1 |
53 | 157.48 | 44.6505 | 18.0 | 1 |
54 | 127.0 | 22.0106 | 13.0 | 1 |
55 | 110.49 | 15.4221 | 9.0 | 0 |
56 | 97.79 | 12.7573 | 5.0 | 0 |
57 | 165.735 | 58.5984 | 42.0 | 1 |
58 | 152.4 | 46.72 | 44.0 | 0 |
59 | 141.605 | 44.2252 | 60.0 | 0 |
60 | 158.8 | 50.9 | 20.0 | 0 |
61 | 155.575 | 54.3176 | 37.0 | 0 |
62 | 164.465 | 45.8978 | 50.0 | 1 |
63 | 151.765 | 48.0241 | 50.0 | 0 |
64 | 161.29 | 52.2198 | 31.0 | 1 |
65 | 154.305 | 47.6272 | 25.0 | 0 |
66 | 145.415 | 45.6427 | 23.0 | 0 |
67 | 145.415 | 42.4109 | 52.0 | 0 |
68 | 152.4 | 36.4858 | 79.3 | 1 |
69 | 163.83 | 55.9336 | 35.0 | 1 |
70 | 144.145 | 37.1945 | 27.0 | 0 |
71 | 129.54 | 24.5507 | 13.0 | 1 |
72 | 129.54 | 25.6279 | 14.0 | 0 |
73 | 153.67 | 48.3075 | 38.0 | 1 |
74 | 142.875 | 37.3363 | 39.0 | 0 |
75 | 146.05 | 29.5969 | 12.0 | 0 |
76 | 167.005 | 47.1736 | 30.0 | 1 |
77 | 158.42 | 47.287 | 24.0 | 0 |
78 | 91.44 | 12.9274 | 0.6 | 1 |
79 | 165.735 | 57.5495 | 51.0 | 1 |
80 | 149.86 | 37.9316 | 46.0 | 0 |
81 | 147.955 | 41.9006 | 17.0 | 0 |
82 | 137.795 | 27.5841 | 12.0 | 0 |
83 | 154.94 | 47.2019 | 22.0 | 0 |
84 | 160.96 | 43.2046 | 29.0 | 1 |
85 | 161.925 | 50.2637 | 38.0 | 1 |
86 | 147.955 | 39.3775 | 30.0 | 0 |
87 | 113.665 | 17.4633 | 6.0 | 1 |
88 | 159.385 | 50.689 | 45.0 | 1 |
89 | 148.59 | 39.4342 | 47.0 | 0 |
90 | 136.525 | 36.2874 | 79.0 | 0 |
91 | 158.115 | 46.2664 | 45.0 | 1 |
92 | 144.78 | 42.2691 | 54.0 | 0 |
93 | 156.845 | 47.6272 | 31.0 | 1 |
94 | 179.07 | 55.7068 | 23.0 | 1 |
95 | 118.745 | 18.8241 | 9.0 | 0 |
96 | 170.18 | 48.5627 | 41.0 | 1 |
97 | 146.05 | 42.8077 | 23.0 | 0 |
98 | 147.32 | 35.0683 | 36.0 | 0 |
99 | 113.03 | 17.8885 | 5.0 | 1 |
100 | 162.56 | 56.7557 | 30.0 | 0 |
101 | 133.985 | 27.4423 | 12.0 | 1 |
102 | 152.4 | 51.2559 | 34.0 | 0 |
103 | 160.02 | 47.2303 | 44.0 | 1 |
104 | 149.86 | 40.9367 | 43.0 | 0 |
105 | 142.875 | 32.7153 | 73.3 | 0 |
106 | 167.005 | 57.0675 | 38.0 | 1 |
107 | 159.385 | 42.9778 | 43.0 | 1 |
108 | 154.94 | 39.9444 | 33.0 | 0 |
109 | 148.59 | 32.4602 | 16.0 | 0 |
110 | 111.125 | 17.1231 | 11.0 | 1 |
111 | 111.76 | 16.4994 | 6.0 | 1 |
112 | 162.56 | 45.9545 | 35.0 | 1 |
113 | 152.4 | 41.1068 | 29.0 | 0 |
114 | 124.46 | 18.2571 | 12.0 | 0 |
115 | 111.76 | 15.0819 | 9.0 | 1 |
116 | 86.36 | 11.4815 | 7.6 | 1 |
117 | 170.18 | 47.5988 | 58.0 | 1 |
118 | 146.05 | 37.5064 | 53.0 | 0 |
119 | 159.385 | 45.019 | 51.0 | 1 |
120 | 151.13 | 42.2691 | 48.0 | 0 |
121 | 160.655 | 54.8563 | 29.0 | 1 |
122 | 169.545 | 53.5239 | 41.0 | 1 |
123 | 158.75 | 52.1914 | 81.75 | 1 |
124 | 74.295 | 9.75223 | 1.0 | 1 |
125 | 149.86 | 42.4109 | 35.0 | 0 |
126 | 153.035 | 49.5833 | 46.0 | 0 |
127 | 96.52 | 13.0975 | 5.0 | 1 |
128 | 161.925 | 41.7305 | 29.0 | 1 |
129 | 162.56 | 56.0186 | 42.0 | 1 |
130 | 149.225 | 42.1557 | 27.0 | 0 |
131 | 116.84 | 19.3911 | 8.0 | 0 |
132 | 100.076 | 15.0819 | 6.0 | 1 |
133 | 163.195 | 53.0986 | 22.0 | 1 |
134 | 161.925 | 50.2353 | 43.0 | 1 |
135 | 145.415 | 42.5243 | 53.0 | 0 |
136 | 163.195 | 49.1013 | 43.0 | 1 |
137 | 151.13 | 38.4986 | 41.0 | 0 |
138 | 150.495 | 49.8101 | 50.0 | 0 |
139 | 141.605 | 29.3134 | 15.0 | 1 |
140 | 170.815 | 59.7607 | 33.0 | 1 |
141 | 91.44 | 11.7083 | 3.0 | 0 |
142 | 157.48 | 47.939 | 62.0 | 1 |
143 | 152.4 | 39.2924 | 49.0 | 0 |
144 | 149.225 | 38.1301 | 17.0 | 1 |
145 | 129.54 | 21.9992 | 12.0 | 0 |
146 | 147.32 | 36.8827 | 22.0 | 0 |
147 | 145.415 | 42.1274 | 29.0 | 0 |
148 | 121.92 | 19.788 | 8.0 | 0 |
149 | 113.665 | 16.7829 | 5.0 | 1 |
150 | 157.48 | 44.5654 | 33.0 | 1 |
151 | 154.305 | 47.854 | 34.0 | 0 |
152 | 120.65 | 21.1771 | 12.0 | 0 |
153 | 115.6 | 18.9 | 7.0 | 1 |
154 | 167.005 | 55.1965 | 42.0 | 1 |
155 | 142.875 | 32.9988 | 40.0 | 0 |
156 | 152.4 | 40.88 | 27.0 | 0 |
157 | 96.52 | 13.2676 | 3.0 | 0 |
158 | 160.0 | 51.2 | 25.0 | 1 |
159 | 159.385 | 49.0446 | 29.0 | 1 |
160 | 149.86 | 53.4388 | 45.0 | 0 |
161 | 160.655 | 54.0908 | 26.0 | 1 |
162 | 160.655 | 55.3666 | 45.0 | 1 |
163 | 149.225 | 42.2408 | 45.0 | 0 |
164 | 125.095 | 22.3678 | 11.0 | 0 |
165 | 140.97 | 40.9367 | 85.6 | 0 |
166 | 154.94 | 49.6967 | 26.0 | 1 |
167 | 141.605 | 44.3386 | 24.0 | 0 |
168 | 160.02 | 45.9545 | 57.0 | 1 |
169 | 150.165 | 41.9573 | 22.0 | 0 |
170 | 155.575 | 51.4827 | 24.0 | 0 |
171 | 103.505 | 12.7573 | 6.0 | 0 |
172 | 94.615 | 13.0124 | 4.0 | 0 |
173 | 156.21 | 44.1118 | 21.0 | 0 |
174 | 153.035 | 32.205 | 79.0 | 0 |
175 | 167.005 | 56.7557 | 50.0 | 1 |
176 | 149.86 | 52.6734 | 40.0 | 0 |
177 | 147.955 | 36.4858 | 64.0 | 0 |
178 | 159.385 | 48.8462 | 32.0 | 1 |
179 | 161.925 | 56.9541 | 38.7 | 1 |
180 | 155.575 | 42.099 | 26.0 | 0 |
181 | 159.385 | 50.1786 | 63.0 | 1 |
182 | 146.685 | 46.5499 | 62.0 | 0 |
183 | 172.72 | 61.8019 | 22.0 | 1 |
184 | 166.37 | 48.9879 | 41.0 | 1 |
185 | 141.605 | 31.5246 | 19.0 | 1 |
186 | 142.875 | 32.205 | 17.0 | 0 |
187 | 133.35 | 23.7569 | 14.0 | 0 |
188 | 127.635 | 24.4089 | 9.0 | 1 |
189 | 119.38 | 21.5173 | 7.0 | 1 |
190 | 151.765 | 35.2951 | 74.0 | 0 |
191 | 156.845 | 45.6427 | 41.0 | 1 |
192 | 148.59 | 43.885 | 33.0 | 0 |
193 | 157.48 | 45.5576 | 53.0 | 0 |
194 | 149.86 | 39.0089 | 18.0 | 0 |
195 | 147.955 | 41.1635 | 37.0 | 0 |
196 | 102.235 | 13.1258 | 6.0 | 0 |
197 | 153.035 | 45.2458 | 61.0 | 0 |
198 | 160.655 | 53.6373 | 44.0 | 1 |
199 | 149.225 | 52.3048 | 35.0 | 0 |
200 | 114.3 | 18.3421 | 7.0 | 1 |
201 | 100.965 | 13.7495 | 4.0 | 1 |
202 | 138.43 | 39.094 | 23.0 | 0 |
203 | 91.44 | 12.5305 | 4.0 | 1 |
204 | 162.56 | 45.6994 | 55.0 | 1 |
205 | 149.225 | 40.398 | 53.0 | 0 |
206 | 158.75 | 51.4827 | 59.0 | 1 |
207 | 149.86 | 38.6687 | 57.0 | 0 |
208 | 158.115 | 39.2357 | 35.0 | 1 |
209 | 156.21 | 44.3386 | 29.0 | 0 |
210 | 148.59 | 39.5192 | 62.0 | 1 |
211 | 143.51 | 31.0711 | 18.0 | 0 |
212 | 154.305 | 46.7767 | 51.0 | 0 |
213 | 131.445 | 22.5095 | 14.0 | 0 |
214 | 157.48 | 40.6248 | 19.0 | 1 |
215 | 157.48 | 50.1786 | 42.0 | 1 |
216 | 154.305 | 41.2769 | 25.0 | 0 |
217 | 107.95 | 17.5767 | 6.0 | 1 |
218 | 168.275 | 54.6 | 41.0 | 1 |
219 | 145.415 | 44.9907 | 37.0 | 0 |
220 | 147.955 | 44.7355 | 16.0 | 0 |
221 | 100.965 | 14.4015 | 5.0 | 1 |
222 | 113.03 | 19.0509 | 9.0 | 1 |
223 | 149.225 | 35.8054 | 82.0 | 1 |
224 | 154.94 | 45.2175 | 28.0 | 1 |
225 | 162.56 | 48.1091 | 50.0 | 1 |
226 | 156.845 | 45.671 | 43.0 | 0 |
227 | 123.19 | 20.8085 | 8.0 | 1 |
228 | 161.011 | 48.4209 | 31.0 | 1 |
229 | 144.78 | 41.1918 | 67.0 | 0 |
230 | 143.51 | 38.4136 | 39.0 | 0 |
231 | 149.225 | 42.1274 | 18.0 | 0 |
232 | 110.49 | 17.6617 | 11.0 | 0 |
233 | 149.86 | 38.2435 | 48.0 | 0 |
234 | 165.735 | 48.3359 | 30.0 | 1 |
235 | 144.145 | 38.9239 | 64.0 | 0 |
236 | 157.48 | 40.0295 | 72.0 | 1 |
237 | 154.305 | 50.207 | 68.0 | 0 |
238 | 163.83 | 54.2893 | 44.0 | 1 |
239 | 156.21 | 45.6 | 43.0 | 0 |
240 | 153.67 | 40.7666 | 16.0 | 0 |
241 | 134.62 | 27.1305 | 13.0 | 0 |
242 | 144.145 | 39.4342 | 34.0 | 0 |
243 | 114.3 | 20.4967 | 10.0 | 0 |
244 | 162.56 | 43.2046 | 62.0 | 1 |
245 | 146.05 | 31.8648 | 44.0 | 0 |
246 | 120.65 | 20.8936 | 11.0 | 1 |
247 | 154.94 | 45.4442 | 31.0 | 1 |
248 | 144.78 | 38.045 | 29.0 | 0 |
249 | 106.68 | 15.9891 | 8.0 | 0 |
250 | 146.685 | 36.0889 | 62.0 | 0 |
251 | 152.4 | 40.88 | 67.0 | 0 |
252 | 163.83 | 47.9107 | 57.0 | 1 |
253 | 165.735 | 47.7122 | 32.0 | 1 |
254 | 156.21 | 46.3798 | 24.0 | 0 |
255 | 152.4 | 41.1635 | 77.0 | 1 |
256 | 140.335 | 36.5992 | 62.0 | 0 |
257 | 158.115 | 43.0912 | 17.0 | 1 |
258 | 163.195 | 48.1375 | 67.0 | 1 |
259 | 151.13 | 36.7126 | 70.0 | 0 |
260 | 171.12 | 56.5573 | 37.0 | 1 |
261 | 149.86 | 38.6971 | 58.0 | 0 |
262 | 163.83 | 47.4854 | 35.0 | 1 |
263 | 141.605 | 36.2023 | 30.0 | 0 |
264 | 93.98 | 14.2881 | 5.0 | 0 |
265 | 149.225 | 41.2769 | 26.0 | 0 |
266 | 105.41 | 15.2237 | 5.0 | 0 |
267 | 146.05 | 44.7639 | 21.0 | 0 |
268 | 161.29 | 50.4338 | 41.0 | 1 |
269 | 162.56 | 55.2815 | 46.0 | 1 |
270 | 145.415 | 37.9316 | 49.0 | 0 |
271 | 145.415 | 35.4936 | 15.0 | 1 |
272 | 170.815 | 58.4567 | 28.0 | 1 |
273 | 127.0 | 21.4889 | 12.0 | 0 |
274 | 159.385 | 44.4237 | 83.0 | 0 |
275 | 159.4 | 44.4 | 54.0 | 1 |
276 | 153.67 | 44.5654 | 54.0 | 0 |
277 | 160.02 | 44.6221 | 68.0 | 1 |
278 | 150.495 | 40.4831 | 68.0 | 0 |
279 | 149.225 | 44.0835 | 56.0 | 0 |
280 | 127.0 | 24.4089 | 15.0 | 0 |
281 | 142.875 | 34.4163 | 57.0 | 0 |
282 | 142.113 | 32.772 | 22.0 | 0 |
283 | 147.32 | 35.9472 | 40.0 | 0 |
284 | 162.56 | 49.5549 | 19.0 | 1 |
285 | 164.465 | 53.1837 | 41.0 | 1 |
286 | 160.02 | 37.0811 | 75.9 | 1 |
287 | 153.67 | 40.5114 | 73.9 | 0 |
288 | 167.005 | 50.6039 | 49.0 | 1 |
289 | 151.13 | 43.9701 | 26.0 | 1 |
290 | 147.955 | 33.7926 | 17.0 | 0 |
291 | 125.4 | 21.3755 | 13.0 | 0 |
292 | 111.125 | 16.6695 | 8.0 | 0 |
293 | 153.035 | 49.89 | 88.0 | 1 |
294 | 139.065 | 33.5942 | 68.0 | 0 |
295 | 152.4 | 43.8567 | 33.0 | 1 |
296 | 154.94 | 48.1375 | 26.0 | 0 |
297 | 147.955 | 42.751 | 56.0 | 0 |
298 | 143.51 | 34.8415 | 16.0 | 1 |
299 | 117.983 | 24.0971 | 13.0 | 0 |
300 | 144.145 | 33.906 | 34.0 | 0 |
301 | 92.71 | 12.0769 | 5.0 | 0 |
302 | 147.955 | 41.2769 | 17.0 | 0 |
303 | 155.575 | 39.7176 | 74.0 | 1 |
304 | 150.495 | 35.9472 | 69.0 | 0 |
305 | 155.575 | 50.9157 | 50.0 | 1 |
306 | 154.305 | 45.7561 | 44.0 | 0 |
307 | 130.607 | 25.2594 | 15.0 | 0 |
308 | 101.6 | 15.3371 | 5.0 | 0 |
309 | 157.48 | 49.2147 | 18.0 | 0 |
310 | 168.91 | 58.8252 | 41.0 | 1 |
311 | 150.495 | 43.4598 | 27.0 | 0 |
312 | 111.76 | 17.8318 | 8.9 | 1 |
313 | 160.02 | 51.9646 | 38.0 | 1 |
314 | 167.64 | 50.6889 | 57.0 | 1 |
315 | 144.145 | 34.2462 | 64.5 | 0 |
316 | 145.415 | 39.3775 | 42.0 | 0 |
317 | 160.02 | 59.5623 | 24.0 | 1 |
318 | 147.32 | 40.313 | 16.0 | 1 |
319 | 164.465 | 52.1631 | 71.0 | 1 |
320 | 153.035 | 39.9728 | 49.5 | 0 |
321 | 149.225 | 43.9417 | 33.0 | 1 |
322 | 160.02 | 54.6011 | 28.0 | 0 |
323 | 149.225 | 45.0757 | 47.0 | 0 |
324 | 85.09 | 11.4532 | 3.0 | 1 |
325 | 84.455 | 11.765 | 1.0 | 1 |
326 | 59.6138 | 5.8967 | 1.0 | 0 |
327 | 92.71 | 12.1052 | 3.0 | 1 |
328 | 111.125 | 18.3138 | 6.0 | 0 |
329 | 90.805 | 11.3681 | 5.0 | 0 |
330 | 153.67 | 41.3336 | 27.0 | 0 |
331 | 99.695 | 16.2443 | 5.0 | 0 |
332 | 62.484 | 6.80388 | 1.0 | 0 |
333 | 81.915 | 11.8784 | 2.0 | 1 |
334 | 96.52 | 14.9685 | 2.0 | 0 |
335 | 80.01 | 9.86563 | 1.0 | 1 |
336 | 150.495 | 41.9006 | 55.0 | 0 |
337 | 151.765 | 42.524 | 83.4 | 1 |
338 | 140.64 | 28.8598 | 12.0 | 1 |
339 | 88.265 | 12.7856 | 2.0 | 0 |
340 | 158.115 | 43.1479 | 63.0 | 1 |
341 | 149.225 | 40.8233 | 52.0 | 0 |
342 | 151.765 | 42.8644 | 49.0 | 1 |
343 | 154.94 | 46.2097 | 31.0 | 0 |
344 | 123.825 | 20.5817 | 9.0 | 0 |
345 | 104.14 | 15.8757 | 6.0 | 0 |
346 | 161.29 | 47.854 | 35.0 | 1 |
347 | 148.59 | 42.5243 | 35.0 | 0 |
348 | 97.155 | 17.0664 | 7.0 | 0 |
349 | 93.345 | 13.1825 | 5.0 | 1 |
350 | 160.655 | 48.506 | 24.0 | 1 |
351 | 157.48 | 45.8695 | 41.0 | 1 |
352 | 167.005 | 52.9002 | 32.0 | 1 |
353 | 157.48 | 47.5705 | 43.0 | 1 |
354 | 91.44 | 12.9274 | 6.0 | 0 |
355 | 60.452 | 5.6699 | 1.0 | 1 |
356 | 137.16 | 28.9165 | 15.0 | 1 |
357 | 152.4 | 43.5448 | 63.0 | 0 |
358 | 152.4 | 43.4314 | 21.0 | 0 |
359 | 81.28 | 11.5099 | 1.0 | 1 |
360 | 109.22 | 11.7083 | 2.0 | 0 |
361 | 71.12 | 7.54097 | 1.0 | 1 |
362 | 89.2048 | 12.7006 | 3.0 | 0 |
363 | 67.31 | 7.20077 | 1.0 | 0 |
364 | 85.09 | 12.3604 | 1.0 | 1 |
365 | 69.85 | 7.79611 | 1.0 | 0 |
366 | 161.925 | 53.212 | 55.0 | 0 |
367 | 152.4 | 44.6788 | 38.0 | 0 |
368 | 88.9 | 12.5588 | 3.0 | 1 |
369 | 90.17 | 12.7006 | 3.0 | 1 |
370 | 71.755 | 7.37087 | 1.0 | 0 |
371 | 83.82 | 9.21359 | 1.0 | 0 |
372 | 159.385 | 47.2019 | 28.0 | 1 |
373 | 142.24 | 28.633 | 16.0 | 0 |
374 | 142.24 | 31.6664 | 36.0 | 0 |
375 | 168.91 | 56.4439 | 38.0 | 1 |
376 | 123.19 | 20.0147 | 12.0 | 1 |
377 | 74.93 | 8.50485 | 1.0 | 1 |
378 | 74.295 | 8.3064 | 1.0 | 0 |
379 | 90.805 | 11.6233 | 3.0 | 0 |
380 | 160.02 | 55.7918 | 48.0 | 1 |
381 | 67.945 | 7.96621 | 1.0 | 0 |
382 | 135.89 | 27.2155 | 15.0 | 0 |
383 | 158.115 | 47.4854 | 45.0 | 1 |
384 | 85.09 | 10.8012 | 3.0 | 1 |
385 | 93.345 | 14.0047 | 3.0 | 0 |
386 | 152.4 | 45.1608 | 38.0 | 0 |
387 | 155.575 | 45.5293 | 21.0 | 0 |
388 | 154.305 | 48.8745 | 50.0 | 0 |
389 | 156.845 | 46.5782 | 41.0 | 1 |
390 | 120.015 | 20.1281 | 13.0 | 0 |
391 | 114.3 | 18.1437 | 8.0 | 1 |
392 | 83.82 | 10.9146 | 3.0 | 1 |
393 | 156.21 | 43.885 | 30.0 | 0 |
394 | 137.16 | 27.1588 | 12.0 | 1 |
395 | 114.3 | 19.0509 | 7.0 | 1 |
396 | 93.98 | 13.8346 | 4.0 | 0 |
397 | 168.275 | 56.047 | 21.0 | 1 |
398 | 147.955 | 40.0862 | 38.0 | 0 |
399 | 139.7 | 26.5635 | 15.0 | 1 |
400 | 157.48 | 50.8023 | 19.0 | 0 |
401 | 76.2 | 9.21359 | 1.0 | 1 |
402 | 66.04 | 7.56932 | 1.0 | 1 |
403 | 160.7 | 46.3 | 31.0 | 1 |
404 | 114.3 | 19.4194 | 8.0 | 0 |
405 | 146.05 | 37.9033 | 16.0 | 1 |
406 | 161.29 | 49.3565 | 21.0 | 1 |
407 | 69.85 | 7.31417 | 0.0 | 0 |
408 | 133.985 | 28.1511 | 13.0 | 1 |
409 | 67.945 | 7.82446 | 0.0 | 1 |
410 | 150.495 | 44.1118 | 50.0 | 0 |
411 | 163.195 | 51.0291 | 39.0 | 1 |
412 | 148.59 | 40.7666 | 44.0 | 1 |
413 | 148.59 | 37.5631 | 36.0 | 0 |
414 | 161.925 | 51.5961 | 36.0 | 1 |
415 | 153.67 | 44.8206 | 18.0 | 0 |
416 | 68.58 | 8.02291 | 0.0 | 0 |
417 | 151.13 | 43.4031 | 58.0 | 0 |
418 | 163.83 | 46.72 | 58.0 | 1 |
419 | 153.035 | 39.5476 | 33.0 | 0 |
420 | 151.765 | 34.7848 | 21.5 | 0 |
421 | 132.08 | 22.793 | 11.0 | 1 |
422 | 156.21 | 39.2924 | 26.0 | 1 |
423 | 140.335 | 37.4497 | 22.0 | 0 |
424 | 158.75 | 48.6761 | 28.0 | 1 |
425 | 142.875 | 35.607 | 42.0 | 0 |
426 | 84.455 | 9.38368 | 2.0 | 1 |
427 | 151.943 | 43.7149 | 21.0 | 1 |
428 | 161.29 | 48.1942 | 19.0 | 1 |
429 | 127.991 | 29.852 | 13.0 | 1 |
430 | 160.985 | 50.9724 | 48.0 | 1 |
431 | 144.78 | 43.9984 | 46.0 | 0 |
432 | 132.08 | 28.2928 | 11.0 | 1 |
433 | 117.983 | 20.3549 | 8.0 | 1 |
434 | 160.02 | 48.1942 | 25.0 | 1 |
435 | 154.94 | 39.179 | 16.0 | 1 |
436 | 160.985 | 46.6916 | 51.0 | 1 |
437 | 165.989 | 56.4155 | 25.0 | 1 |
438 | 157.988 | 48.591 | 28.0 | 1 |
439 | 154.94 | 48.2225 | 26.0 | 0 |
440 | 97.9932 | 13.2959 | 5.0 | 1 |
441 | 64.135 | 6.66213 | 1.0 | 0 |
442 | 160.655 | 47.4854 | 54.0 | 1 |
443 | 147.32 | 35.5503 | 66.0 | 0 |
444 | 146.7 | 36.6 | 20.0 | 0 |
445 | 147.32 | 48.9596 | 25.0 | 0 |
446 | 172.999 | 51.2559 | 38.0 | 1 |
447 | 158.115 | 46.5215 | 51.0 | 1 |
448 | 147.32 | 36.9677 | 48.0 | 0 |
449 | 124.993 | 25.1177 | 13.0 | 1 |
450 | 106.045 | 16.2726 | 6.0 | 1 |
451 | 165.989 | 48.6477 | 27.0 | 1 |
452 | 149.86 | 38.045 | 22.0 | 0 |
453 | 76.2 | 8.50485 | 1.0 | 0 |
454 | 161.925 | 47.287 | 60.0 | 1 |
455 | 140.005 | 28.3495 | 15.0 | 0 |
456 | 66.675 | 8.13631 | 0.0 | 0 |
457 | 62.865 | 7.20077 | 0.0 | 1 |
458 | 163.83 | 55.3949 | 43.0 | 1 |
459 | 147.955 | 32.4885 | 12.0 | 1 |
460 | 160.02 | 54.2042 | 27.0 | 1 |
461 | 154.94 | 48.4776 | 30.0 | 1 |
462 | 152.4 | 43.0629 | 29.0 | 0 |
463 | 62.23 | 7.25747 | 0.0 | 0 |
464 | 146.05 | 34.1895 | 23.0 | 0 |
465 | 151.994 | 49.9518 | 30.0 | 0 |
466 | 157.48 | 41.3052 | 17.0 | 1 |
467 | 55.88 | 4.84776 | 0.0 | 0 |
468 | 60.96 | 6.23689 | 0.0 | 1 |
469 | 151.765 | 44.3386 | 41.0 | 0 |
470 | 144.78 | 33.4524 | 42.0 | 0 |
471 | 118.11 | 16.8963 | 7.0 | 0 |
472 | 78.105 | 8.22136 | 3.0 | 0 |
473 | 160.655 | 47.287 | 43.0 | 1 |
474 | 151.13 | 46.1246 | 35.0 | 0 |
475 | 121.92 | 20.1848 | 10.0 | 0 |
476 | 92.71 | 12.7573 | 3.0 | 1 |
477 | 153.67 | 47.4004 | 75.5 | 1 |
478 | 147.32 | 40.8516 | 64.0 | 0 |
479 | 139.7 | 50.3487 | 38.0 | 1 |
480 | 157.48 | 45.1324 | 24.2 | 0 |
481 | 91.44 | 11.6233 | 4.0 | 0 |
482 | 154.94 | 42.2408 | 26.0 | 1 |
483 | 143.51 | 41.6454 | 19.0 | 0 |
484 | 83.185 | 9.15689 | 2.0 | 1 |
485 | 158.115 | 45.2175 | 43.0 | 1 |
486 | 147.32 | 51.2559 | 38.0 | 0 |
487 | 123.825 | 21.2054 | 10.0 | 1 |
488 | 88.9 | 11.5949 | 3.0 | 1 |
489 | 160.02 | 49.2714 | 23.0 | 1 |
490 | 137.16 | 27.9526 | 16.0 | 0 |
491 | 165.1 | 51.1992 | 49.0 | 1 |
492 | 154.94 | 43.8567 | 41.0 | 0 |
493 | 111.125 | 17.6901 | 6.0 | 1 |
494 | 153.67 | 35.5219 | 23.0 | 0 |
495 | 145.415 | 34.2462 | 14.0 | 0 |
496 | 141.605 | 42.8854 | 43.0 | 0 |
497 | 144.78 | 32.5452 | 15.0 | 0 |
498 | 163.83 | 46.7767 | 21.0 | 1 |
499 | 161.29 | 41.8722 | 24.0 | 1 |
500 | 154.9 | 38.2 | 20.0 | 1 |
501 | 161.3 | 43.3 | 20.0 | 1 |
502 | 170.18 | 53.6373 | 34.0 | 1 |
503 | 149.86 | 42.9778 | 29.0 | 0 |
504 | 123.825 | 21.5456 | 11.0 | 1 |
505 | 85.09 | 11.4248 | 3.0 | 0 |
506 | 160.655 | 39.7743 | 65.0 | 1 |
507 | 154.94 | 43.3464 | 46.0 | 0 |
508 | 106.045 | 15.4788 | 8.0 | 0 |
509 | 126.365 | 21.9142 | 15.0 | 1 |
510 | 166.37 | 52.6734 | 43.0 | 1 |
511 | 148.285 | 38.4419 | 39.0 | 0 |
512 | 124.46 | 19.2777 | 12.0 | 0 |
513 | 89.535 | 11.113 | 3.0 | 1 |
514 | 101.6 | 13.4944 | 4.0 | 0 |
515 | 151.765 | 42.8077 | 43.0 | 0 |
516 | 148.59 | 35.8905 | 70.0 | 0 |
517 | 153.67 | 44.2252 | 26.0 | 0 |
518 | 53.975 | 4.25242 | 0.0 | 0 |
519 | 146.685 | 38.0734 | 48.0 | 0 |
520 | 56.515 | 5.15961 | 0.0 | 0 |
521 | 100.965 | 14.3165 | 5.0 | 1 |
522 | 121.92 | 23.2182 | 8.0 | 1 |
523 | 81.5848 | 10.6594 | 3.0 | 0 |
524 | 154.94 | 44.1118 | 44.0 | 1 |
525 | 156.21 | 44.0268 | 33.0 | 0 |
526 | 132.715 | 24.9759 | 15.0 | 1 |
527 | 125.095 | 22.5946 | 12.0 | 0 |
528 | 101.6 | 14.3448 | 5.0 | 0 |
529 | 160.655 | 47.8823 | 41.0 | 1 |
530 | 146.05 | 39.4058 | 37.4 | 0 |
531 | 132.715 | 24.7775 | 13.0 | 0 |
532 | 87.63 | 10.6594 | 6.0 | 0 |
533 | 156.21 | 41.0501 | 53.0 | 1 |
534 | 152.4 | 40.8233 | 49.0 | 0 |
535 | 162.56 | 47.0318 | 27.0 | 0 |
536 | 114.935 | 17.52 | 7.0 | 1 |
537 | 67.945 | 7.22912 | 1.0 | 0 |
538 | 142.875 | 34.2462 | 31.0 | 0 |
539 | 76.835 | 8.02291 | 1.0 | 1 |
540 | 145.415 | 31.1278 | 17.0 | 1 |
541 | 162.56 | 52.1631 | 31.0 | 1 |
542 | 156.21 | 54.0625 | 21.0 | 0 |
543 | 71.12 | 8.05126 | 0.0 | 1 |
544 | 158.75 | 52.5316 | 68.0 | 1 |
Use only adults and standardize
df2 = filter(row -> row[:age] >= 18, df);
height | weight | age | male | |
---|---|---|---|---|
Float64 | Float64 | Float64 | Int64 | |
1 | 151.765 | 47.8256 | 63.0 | 1 |
2 | 139.7 | 36.4858 | 63.0 | 0 |
3 | 136.525 | 31.8648 | 65.0 | 0 |
4 | 156.845 | 53.0419 | 41.0 | 1 |
5 | 145.415 | 41.2769 | 51.0 | 0 |
6 | 163.83 | 62.9926 | 35.0 | 1 |
7 | 149.225 | 38.2435 | 32.0 | 0 |
8 | 168.91 | 55.48 | 27.0 | 1 |
9 | 147.955 | 34.8699 | 19.0 | 0 |
10 | 165.1 | 54.4877 | 54.0 | 1 |
11 | 154.305 | 49.8951 | 47.0 | 0 |
12 | 151.13 | 41.2202 | 66.0 | 1 |
13 | 144.78 | 36.0322 | 73.0 | 0 |
14 | 149.9 | 47.7 | 20.0 | 0 |
15 | 150.495 | 33.8493 | 65.3 | 0 |
16 | 163.195 | 48.5627 | 36.0 | 1 |
17 | 157.48 | 42.3258 | 44.0 | 1 |
18 | 143.942 | 38.3569 | 31.0 | 0 |
19 | 161.29 | 48.9879 | 39.0 | 1 |
20 | 156.21 | 42.7227 | 29.0 | 0 |
21 | 146.4 | 35.4936 | 56.0 | 1 |
22 | 148.59 | 37.9033 | 45.0 | 0 |
23 | 147.32 | 35.4652 | 19.0 | 0 |
24 | 147.955 | 40.313 | 29.0 | 1 |
25 | 161.925 | 55.1114 | 30.0 | 1 |
26 | 146.05 | 37.5064 | 24.0 | 0 |
27 | 146.05 | 38.4986 | 35.0 | 0 |
28 | 152.705 | 46.6066 | 33.0 | 0 |
29 | 142.875 | 38.8388 | 27.0 | 0 |
30 | 142.875 | 35.5786 | 32.0 | 0 |
31 | 147.955 | 47.4004 | 36.0 | 0 |
32 | 160.655 | 47.8823 | 24.0 | 1 |
33 | 151.765 | 49.4132 | 30.0 | 1 |
34 | 162.865 | 49.3848 | 24.0 | 1 |
35 | 171.45 | 56.5573 | 52.0 | 1 |
36 | 147.32 | 39.1223 | 42.0 | 0 |
37 | 147.955 | 49.8951 | 19.0 | 0 |
38 | 154.305 | 41.2485 | 55.0 | 1 |
39 | 143.51 | 38.5553 | 43.0 | 0 |
40 | 146.7 | 42.4 | 20.0 | 1 |
41 | 157.48 | 44.6505 | 18.0 | 1 |
42 | 165.735 | 58.5984 | 42.0 | 1 |
43 | 152.4 | 46.72 | 44.0 | 0 |
44 | 141.605 | 44.2252 | 60.0 | 0 |
45 | 158.8 | 50.9 | 20.0 | 0 |
46 | 155.575 | 54.3176 | 37.0 | 0 |
47 | 164.465 | 45.8978 | 50.0 | 1 |
48 | 151.765 | 48.0241 | 50.0 | 0 |
49 | 161.29 | 52.2198 | 31.0 | 1 |
50 | 154.305 | 47.6272 | 25.0 | 0 |
51 | 145.415 | 45.6427 | 23.0 | 0 |
52 | 145.415 | 42.4109 | 52.0 | 0 |
53 | 152.4 | 36.4858 | 79.3 | 1 |
54 | 163.83 | 55.9336 | 35.0 | 1 |
55 | 144.145 | 37.1945 | 27.0 | 0 |
56 | 153.67 | 48.3075 | 38.0 | 1 |
57 | 142.875 | 37.3363 | 39.0 | 0 |
58 | 167.005 | 47.1736 | 30.0 | 1 |
59 | 158.42 | 47.287 | 24.0 | 0 |
60 | 165.735 | 57.5495 | 51.0 | 1 |
61 | 149.86 | 37.9316 | 46.0 | 0 |
62 | 154.94 | 47.2019 | 22.0 | 0 |
63 | 160.96 | 43.2046 | 29.0 | 1 |
64 | 161.925 | 50.2637 | 38.0 | 1 |
65 | 147.955 | 39.3775 | 30.0 | 0 |
66 | 159.385 | 50.689 | 45.0 | 1 |
67 | 148.59 | 39.4342 | 47.0 | 0 |
68 | 136.525 | 36.2874 | 79.0 | 0 |
69 | 158.115 | 46.2664 | 45.0 | 1 |
70 | 144.78 | 42.2691 | 54.0 | 0 |
71 | 156.845 | 47.6272 | 31.0 | 1 |
72 | 179.07 | 55.7068 | 23.0 | 1 |
73 | 170.18 | 48.5627 | 41.0 | 1 |
74 | 146.05 | 42.8077 | 23.0 | 0 |
75 | 147.32 | 35.0683 | 36.0 | 0 |
76 | 162.56 | 56.7557 | 30.0 | 0 |
77 | 152.4 | 51.2559 | 34.0 | 0 |
78 | 160.02 | 47.2303 | 44.0 | 1 |
79 | 149.86 | 40.9367 | 43.0 | 0 |
80 | 142.875 | 32.7153 | 73.3 | 0 |
81 | 167.005 | 57.0675 | 38.0 | 1 |
82 | 159.385 | 42.9778 | 43.0 | 1 |
83 | 154.94 | 39.9444 | 33.0 | 0 |
84 | 162.56 | 45.9545 | 35.0 | 1 |
85 | 152.4 | 41.1068 | 29.0 | 0 |
86 | 170.18 | 47.5988 | 58.0 | 1 |
87 | 146.05 | 37.5064 | 53.0 | 0 |
88 | 159.385 | 45.019 | 51.0 | 1 |
89 | 151.13 | 42.2691 | 48.0 | 0 |
90 | 160.655 | 54.8563 | 29.0 | 1 |
91 | 169.545 | 53.5239 | 41.0 | 1 |
92 | 158.75 | 52.1914 | 81.75 | 1 |
93 | 149.86 | 42.4109 | 35.0 | 0 |
94 | 153.035 | 49.5833 | 46.0 | 0 |
95 | 161.925 | 41.7305 | 29.0 | 1 |
96 | 162.56 | 56.0186 | 42.0 | 1 |
97 | 149.225 | 42.1557 | 27.0 | 0 |
98 | 163.195 | 53.0986 | 22.0 | 1 |
99 | 161.925 | 50.2353 | 43.0 | 1 |
100 | 145.415 | 42.5243 | 53.0 | 0 |
101 | 163.195 | 49.1013 | 43.0 | 1 |
102 | 151.13 | 38.4986 | 41.0 | 0 |
103 | 150.495 | 49.8101 | 50.0 | 0 |
104 | 170.815 | 59.7607 | 33.0 | 1 |
105 | 157.48 | 47.939 | 62.0 | 1 |
106 | 152.4 | 39.2924 | 49.0 | 0 |
107 | 147.32 | 36.8827 | 22.0 | 0 |
108 | 145.415 | 42.1274 | 29.0 | 0 |
109 | 157.48 | 44.5654 | 33.0 | 1 |
110 | 154.305 | 47.854 | 34.0 | 0 |
111 | 167.005 | 55.1965 | 42.0 | 1 |
112 | 142.875 | 32.9988 | 40.0 | 0 |
113 | 152.4 | 40.88 | 27.0 | 0 |
114 | 160.0 | 51.2 | 25.0 | 1 |
115 | 159.385 | 49.0446 | 29.0 | 1 |
116 | 149.86 | 53.4388 | 45.0 | 0 |
117 | 160.655 | 54.0908 | 26.0 | 1 |
118 | 160.655 | 55.3666 | 45.0 | 1 |
119 | 149.225 | 42.2408 | 45.0 | 0 |
120 | 140.97 | 40.9367 | 85.6 | 0 |
121 | 154.94 | 49.6967 | 26.0 | 1 |
122 | 141.605 | 44.3386 | 24.0 | 0 |
123 | 160.02 | 45.9545 | 57.0 | 1 |
124 | 150.165 | 41.9573 | 22.0 | 0 |
125 | 155.575 | 51.4827 | 24.0 | 0 |
126 | 156.21 | 44.1118 | 21.0 | 0 |
127 | 153.035 | 32.205 | 79.0 | 0 |
128 | 167.005 | 56.7557 | 50.0 | 1 |
129 | 149.86 | 52.6734 | 40.0 | 0 |
130 | 147.955 | 36.4858 | 64.0 | 0 |
131 | 159.385 | 48.8462 | 32.0 | 1 |
132 | 161.925 | 56.9541 | 38.7 | 1 |
133 | 155.575 | 42.099 | 26.0 | 0 |
134 | 159.385 | 50.1786 | 63.0 | 1 |
135 | 146.685 | 46.5499 | 62.0 | 0 |
136 | 172.72 | 61.8019 | 22.0 | 1 |
137 | 166.37 | 48.9879 | 41.0 | 1 |
138 | 141.605 | 31.5246 | 19.0 | 1 |
139 | 151.765 | 35.2951 | 74.0 | 0 |
140 | 156.845 | 45.6427 | 41.0 | 1 |
141 | 148.59 | 43.885 | 33.0 | 0 |
142 | 157.48 | 45.5576 | 53.0 | 0 |
143 | 149.86 | 39.0089 | 18.0 | 0 |
144 | 147.955 | 41.1635 | 37.0 | 0 |
145 | 153.035 | 45.2458 | 61.0 | 0 |
146 | 160.655 | 53.6373 | 44.0 | 1 |
147 | 149.225 | 52.3048 | 35.0 | 0 |
148 | 138.43 | 39.094 | 23.0 | 0 |
149 | 162.56 | 45.6994 | 55.0 | 1 |
150 | 149.225 | 40.398 | 53.0 | 0 |
151 | 158.75 | 51.4827 | 59.0 | 1 |
152 | 149.86 | 38.6687 | 57.0 | 0 |
153 | 158.115 | 39.2357 | 35.0 | 1 |
154 | 156.21 | 44.3386 | 29.0 | 0 |
155 | 148.59 | 39.5192 | 62.0 | 1 |
156 | 143.51 | 31.0711 | 18.0 | 0 |
157 | 154.305 | 46.7767 | 51.0 | 0 |
158 | 157.48 | 40.6248 | 19.0 | 1 |
159 | 157.48 | 50.1786 | 42.0 | 1 |
160 | 154.305 | 41.2769 | 25.0 | 0 |
161 | 168.275 | 54.6 | 41.0 | 1 |
162 | 145.415 | 44.9907 | 37.0 | 0 |
163 | 149.225 | 35.8054 | 82.0 | 1 |
164 | 154.94 | 45.2175 | 28.0 | 1 |
165 | 162.56 | 48.1091 | 50.0 | 1 |
166 | 156.845 | 45.671 | 43.0 | 0 |
167 | 161.011 | 48.4209 | 31.0 | 1 |
168 | 144.78 | 41.1918 | 67.0 | 0 |
169 | 143.51 | 38.4136 | 39.0 | 0 |
170 | 149.225 | 42.1274 | 18.0 | 0 |
171 | 149.86 | 38.2435 | 48.0 | 0 |
172 | 165.735 | 48.3359 | 30.0 | 1 |
173 | 144.145 | 38.9239 | 64.0 | 0 |
174 | 157.48 | 40.0295 | 72.0 | 1 |
175 | 154.305 | 50.207 | 68.0 | 0 |
176 | 163.83 | 54.2893 | 44.0 | 1 |
177 | 156.21 | 45.6 | 43.0 | 0 |
178 | 144.145 | 39.4342 | 34.0 | 0 |
179 | 162.56 | 43.2046 | 62.0 | 1 |
180 | 146.05 | 31.8648 | 44.0 | 0 |
181 | 154.94 | 45.4442 | 31.0 | 1 |
182 | 144.78 | 38.045 | 29.0 | 0 |
183 | 146.685 | 36.0889 | 62.0 | 0 |
184 | 152.4 | 40.88 | 67.0 | 0 |
185 | 163.83 | 47.9107 | 57.0 | 1 |
186 | 165.735 | 47.7122 | 32.0 | 1 |
187 | 156.21 | 46.3798 | 24.0 | 0 |
188 | 152.4 | 41.1635 | 77.0 | 1 |
189 | 140.335 | 36.5992 | 62.0 | 0 |
190 | 163.195 | 48.1375 | 67.0 | 1 |
191 | 151.13 | 36.7126 | 70.0 | 0 |
192 | 171.12 | 56.5573 | 37.0 | 1 |
193 | 149.86 | 38.6971 | 58.0 | 0 |
194 | 163.83 | 47.4854 | 35.0 | 1 |
195 | 141.605 | 36.2023 | 30.0 | 0 |
196 | 149.225 | 41.2769 | 26.0 | 0 |
197 | 146.05 | 44.7639 | 21.0 | 0 |
198 | 161.29 | 50.4338 | 41.0 | 1 |
199 | 162.56 | 55.2815 | 46.0 | 1 |
200 | 145.415 | 37.9316 | 49.0 | 0 |
201 | 170.815 | 58.4567 | 28.0 | 1 |
202 | 159.385 | 44.4237 | 83.0 | 0 |
203 | 159.4 | 44.4 | 54.0 | 1 |
204 | 153.67 | 44.5654 | 54.0 | 0 |
205 | 160.02 | 44.6221 | 68.0 | 1 |
206 | 150.495 | 40.4831 | 68.0 | 0 |
207 | 149.225 | 44.0835 | 56.0 | 0 |
208 | 142.875 | 34.4163 | 57.0 | 0 |
209 | 142.113 | 32.772 | 22.0 | 0 |
210 | 147.32 | 35.9472 | 40.0 | 0 |
211 | 162.56 | 49.5549 | 19.0 | 1 |
212 | 164.465 | 53.1837 | 41.0 | 1 |
213 | 160.02 | 37.0811 | 75.9 | 1 |
214 | 153.67 | 40.5114 | 73.9 | 0 |
215 | 167.005 | 50.6039 | 49.0 | 1 |
216 | 151.13 | 43.9701 | 26.0 | 1 |
217 | 153.035 | 49.89 | 88.0 | 1 |
218 | 139.065 | 33.5942 | 68.0 | 0 |
219 | 152.4 | 43.8567 | 33.0 | 1 |
220 | 154.94 | 48.1375 | 26.0 | 0 |
221 | 147.955 | 42.751 | 56.0 | 0 |
222 | 144.145 | 33.906 | 34.0 | 0 |
223 | 155.575 | 39.7176 | 74.0 | 1 |
224 | 150.495 | 35.9472 | 69.0 | 0 |
225 | 155.575 | 50.9157 | 50.0 | 1 |
226 | 154.305 | 45.7561 | 44.0 | 0 |
227 | 157.48 | 49.2147 | 18.0 | 0 |
228 | 168.91 | 58.8252 | 41.0 | 1 |
229 | 150.495 | 43.4598 | 27.0 | 0 |
230 | 160.02 | 51.9646 | 38.0 | 1 |
231 | 167.64 | 50.6889 | 57.0 | 1 |
232 | 144.145 | 34.2462 | 64.5 | 0 |
233 | 145.415 | 39.3775 | 42.0 | 0 |
234 | 160.02 | 59.5623 | 24.0 | 1 |
235 | 164.465 | 52.1631 | 71.0 | 1 |
236 | 153.035 | 39.9728 | 49.5 | 0 |
237 | 149.225 | 43.9417 | 33.0 | 1 |
238 | 160.02 | 54.6011 | 28.0 | 0 |
239 | 149.225 | 45.0757 | 47.0 | 0 |
240 | 153.67 | 41.3336 | 27.0 | 0 |
241 | 150.495 | 41.9006 | 55.0 | 0 |
242 | 151.765 | 42.524 | 83.4 | 1 |
243 | 158.115 | 43.1479 | 63.0 | 1 |
244 | 149.225 | 40.8233 | 52.0 | 0 |
245 | 151.765 | 42.8644 | 49.0 | 1 |
246 | 154.94 | 46.2097 | 31.0 | 0 |
247 | 161.29 | 47.854 | 35.0 | 1 |
248 | 148.59 | 42.5243 | 35.0 | 0 |
249 | 160.655 | 48.506 | 24.0 | 1 |
250 | 157.48 | 45.8695 | 41.0 | 1 |
251 | 167.005 | 52.9002 | 32.0 | 1 |
252 | 157.48 | 47.5705 | 43.0 | 1 |
253 | 152.4 | 43.5448 | 63.0 | 0 |
254 | 152.4 | 43.4314 | 21.0 | 0 |
255 | 161.925 | 53.212 | 55.0 | 0 |
256 | 152.4 | 44.6788 | 38.0 | 0 |
257 | 159.385 | 47.2019 | 28.0 | 1 |
258 | 142.24 | 31.6664 | 36.0 | 0 |
259 | 168.91 | 56.4439 | 38.0 | 1 |
260 | 160.02 | 55.7918 | 48.0 | 1 |
261 | 158.115 | 47.4854 | 45.0 | 1 |
262 | 152.4 | 45.1608 | 38.0 | 0 |
263 | 155.575 | 45.5293 | 21.0 | 0 |
264 | 154.305 | 48.8745 | 50.0 | 0 |
265 | 156.845 | 46.5782 | 41.0 | 1 |
266 | 156.21 | 43.885 | 30.0 | 0 |
267 | 168.275 | 56.047 | 21.0 | 1 |
268 | 147.955 | 40.0862 | 38.0 | 0 |
269 | 157.48 | 50.8023 | 19.0 | 0 |
270 | 160.7 | 46.3 | 31.0 | 1 |
271 | 161.29 | 49.3565 | 21.0 | 1 |
272 | 150.495 | 44.1118 | 50.0 | 0 |
273 | 163.195 | 51.0291 | 39.0 | 1 |
274 | 148.59 | 40.7666 | 44.0 | 1 |
275 | 148.59 | 37.5631 | 36.0 | 0 |
276 | 161.925 | 51.5961 | 36.0 | 1 |
277 | 153.67 | 44.8206 | 18.0 | 0 |
278 | 151.13 | 43.4031 | 58.0 | 0 |
279 | 163.83 | 46.72 | 58.0 | 1 |
280 | 153.035 | 39.5476 | 33.0 | 0 |
281 | 151.765 | 34.7848 | 21.5 | 0 |
282 | 156.21 | 39.2924 | 26.0 | 1 |
283 | 140.335 | 37.4497 | 22.0 | 0 |
284 | 158.75 | 48.6761 | 28.0 | 1 |
285 | 142.875 | 35.607 | 42.0 | 0 |
286 | 151.943 | 43.7149 | 21.0 | 1 |
287 | 161.29 | 48.1942 | 19.0 | 1 |
288 | 160.985 | 50.9724 | 48.0 | 1 |
289 | 144.78 | 43.9984 | 46.0 | 0 |
290 | 160.02 | 48.1942 | 25.0 | 1 |
291 | 160.985 | 46.6916 | 51.0 | 1 |
292 | 165.989 | 56.4155 | 25.0 | 1 |
293 | 157.988 | 48.591 | 28.0 | 1 |
294 | 154.94 | 48.2225 | 26.0 | 0 |
295 | 160.655 | 47.4854 | 54.0 | 1 |
296 | 147.32 | 35.5503 | 66.0 | 0 |
297 | 146.7 | 36.6 | 20.0 | 0 |
298 | 147.32 | 48.9596 | 25.0 | 0 |
299 | 172.999 | 51.2559 | 38.0 | 1 |
300 | 158.115 | 46.5215 | 51.0 | 1 |
301 | 147.32 | 36.9677 | 48.0 | 0 |
302 | 165.989 | 48.6477 | 27.0 | 1 |
303 | 149.86 | 38.045 | 22.0 | 0 |
304 | 161.925 | 47.287 | 60.0 | 1 |
305 | 163.83 | 55.3949 | 43.0 | 1 |
306 | 160.02 | 54.2042 | 27.0 | 1 |
307 | 154.94 | 48.4776 | 30.0 | 1 |
308 | 152.4 | 43.0629 | 29.0 | 0 |
309 | 146.05 | 34.1895 | 23.0 | 0 |
310 | 151.994 | 49.9518 | 30.0 | 0 |
311 | 151.765 | 44.3386 | 41.0 | 0 |
312 | 144.78 | 33.4524 | 42.0 | 0 |
313 | 160.655 | 47.287 | 43.0 | 1 |
314 | 151.13 | 46.1246 | 35.0 | 0 |
315 | 153.67 | 47.4004 | 75.5 | 1 |
316 | 147.32 | 40.8516 | 64.0 | 0 |
317 | 139.7 | 50.3487 | 38.0 | 1 |
318 | 157.48 | 45.1324 | 24.2 | 0 |
319 | 154.94 | 42.2408 | 26.0 | 1 |
320 | 143.51 | 41.6454 | 19.0 | 0 |
321 | 158.115 | 45.2175 | 43.0 | 1 |
322 | 147.32 | 51.2559 | 38.0 | 0 |
323 | 160.02 | 49.2714 | 23.0 | 1 |
324 | 165.1 | 51.1992 | 49.0 | 1 |
325 | 154.94 | 43.8567 | 41.0 | 0 |
326 | 153.67 | 35.5219 | 23.0 | 0 |
327 | 141.605 | 42.8854 | 43.0 | 0 |
328 | 163.83 | 46.7767 | 21.0 | 1 |
329 | 161.29 | 41.8722 | 24.0 | 1 |
330 | 154.9 | 38.2 | 20.0 | 1 |
331 | 161.3 | 43.3 | 20.0 | 1 |
332 | 170.18 | 53.6373 | 34.0 | 1 |
333 | 149.86 | 42.9778 | 29.0 | 0 |
334 | 160.655 | 39.7743 | 65.0 | 1 |
335 | 154.94 | 43.3464 | 46.0 | 0 |
336 | 166.37 | 52.6734 | 43.0 | 1 |
337 | 148.285 | 38.4419 | 39.0 | 0 |
338 | 151.765 | 42.8077 | 43.0 | 0 |
339 | 148.59 | 35.8905 | 70.0 | 0 |
340 | 153.67 | 44.2252 | 26.0 | 0 |
341 | 146.685 | 38.0734 | 48.0 | 0 |
342 | 154.94 | 44.1118 | 44.0 | 1 |
343 | 156.21 | 44.0268 | 33.0 | 0 |
344 | 160.655 | 47.8823 | 41.0 | 1 |
345 | 146.05 | 39.4058 | 37.4 | 0 |
346 | 156.21 | 41.0501 | 53.0 | 1 |
347 | 152.4 | 40.8233 | 49.0 | 0 |
348 | 162.56 | 47.0318 | 27.0 | 0 |
349 | 142.875 | 34.2462 | 31.0 | 0 |
350 | 162.56 | 52.1631 | 31.0 | 1 |
351 | 156.21 | 54.0625 | 21.0 | 0 |
352 | 158.75 | 52.5316 | 68.0 | 1 |
Show the first six rows of the dataset.
first(df2, 6)
height | weight | age | male | |
---|---|---|---|---|
Float64 | Float64 | Float64 | Int64 | |
1 | 151.765 | 47.8256 | 63.0 | 1 |
2 | 139.7 | 36.4858 | 63.0 | 0 |
3 | 136.525 | 31.8648 | 65.0 | 0 |
4 | 156.845 | 53.0419 | 41.0 | 1 |
5 | 145.415 | 41.2769 | 51.0 | 0 |
6 | 163.83 | 62.9926 | 35.0 | 1 |
Half-T for σ
, see below.
struct HeightsProblem{TY <: AbstractVector, Tν <: Real}
"Observations."
y::TY
"Degrees of freedom for prior on sigma."
ν::Tν
end;
Then make the type callable with the parameters as a single argument.
function (problem::HeightsProblem)(θ)
@unpack y, ν = problem # extract the data
@unpack μ, σ = θ
loglikelihood(Normal(μ, σ), y) + logpdf(TDist(ν), σ)
end;
Setup problem with data and inits.
obs = convert(Vector{Float64}, df2[:height]);
p = HeightsProblem(obs, 1.0);
p((μ = 178, σ = 5.0,))
-5170.976519811121
Write a function to return properly dimensioned transformation.
problem_transformation(p::HeightsProblem) =
as((σ = asℝ₊, μ = as(Real, 100, 250)), )
problem_transformation (generic function with 1 method)
Wrap the problem with a transformation, then use Flux for the gradient.
P = TransformedLogDensity(problem_transformation(p), p)
∇P = LogDensityRejectErrors(ADgradient(:ForwardDiff, P));
LogDensityRejectErrors{InvalidLogDensityException,LogDensityProblems.ForwardDiffLogDensity{TransformedLogDensity{TransformVariables.TransformTuple{NamedTuple{(:σ, :μ),Tuple{TransformVariables.ShiftedExp{true,Float64},TransformVariables.ScaledShiftedLogistic{Int64}}}},Main.ex-m4.1d.HeightsProblem{Array{Float64,1},Float64}},ForwardDiff.GradientConfig{ForwardDiff.Tag{getfield(LogDensityProblems, Symbol("##1#2")){TransformedLogDensity{TransformVariables.TransformTuple{NamedTuple{(:σ, :μ),Tuple{TransformVariables.ShiftedExp{true,Float64},TransformVariables.ScaledShiftedLogistic{Int64}}}},Main.ex-m4.1d.HeightsProblem{Array{Float64,1},Float64}}},Float64},Float64,2,Array{ForwardDiff.Dual{ForwardDiff.Tag{getfield(LogDensityProblems, Symbol("##1#2")){TransformedLogDensity{TransformVariables.TransformTuple{NamedTuple{(:σ, :μ),Tuple{TransformVariables.ShiftedExp{true,Float64},TransformVariables.ScaledShiftedLogistic{Int64}}}},Main.ex-m4.1d.HeightsProblem{Array{Float64,1},Float64}}},Float64},Float64,2},1}}}}(ForwardDiff AD wrapper for TransformedLogDensity of dimension 2, w/ chunk size 2)
Tune and sample.
chain, NUTS_tuned = NUTS_init_tune_mcmc(∇P, 1000);
(NUTS_Transition{Array{Float64,1},Float64}[NUTS_Transition{Array{Float64,1},Float64}([2.0286197159657395, -0.5598009580347787], -1219.3532902020388, 2, DynamicHMC.AdjacentTurn, 0.999355966571135, 7), NUTS_Transition{Array{Float64,1},Float64}([2.1035408803379507, -0.5449044291088926], -1220.8308867900455, 2, DynamicHMC.DoubledTurn, 0.8087931551449169, 3), NUTS_Transition{Array{Float64,1},Float64}([2.0047960713908113, -0.5834140026520368], -1224.7478851842423, 2, DynamicHMC.DoubledTurn, 0.6690022450147763, 3), NUTS_Transition{Array{Float64,1},Float64}([2.021966871204559, -0.5755147679551557], -1221.7039764132219, 1, DynamicHMC.DoubledTurn, 1.0, 1), NUTS_Transition{Array{Float64,1},Float64}([2.0681216020953186, -0.5411973943155898], -1220.3905216457963, 2, DynamicHMC.AdjacentTurn, 1.0, 7), NUTS_Transition{Array{Float64,1},Float64}([2.023825968604533, -0.5627733294098167], -1221.5327717007956, 1, DynamicHMC.AdjacentTurn, 0.8975386735329957, 3), NUTS_Transition{Array{Float64,1},Float64}([2.0791311884297796, -0.5535537435369932], -1222.500391146448, 2, DynamicHMC.DoubledTurn, 0.6580120040050063, 3), NUTS_Transition{Array{Float64,1},Float64}([2.0084870670329393, -0.5497362702975317], -1220.7896701433892, 2, DynamicHMC.DoubledTurn, 0.8947582098692664, 3), NUTS_Transition{Array{Float64,1},Float64}([2.0103869662508096, -0.5723458578756284], -1221.5534073332535, 2, DynamicHMC.DoubledTurn, 0.8495108377157523, 3), NUTS_Transition{Array{Float64,1},Float64}([2.0053232666801177, -0.5680308759022042], -1220.3760563574738, 2, DynamicHMC.DoubledTurn, 1.0, 3) … NUTS_Transition{Array{Float64,1},Float64}([2.085191497359603, -0.5652933004750212], -1223.3218878558084, 2, DynamicHMC.DoubledTurn, 0.5404595971858003, 3), NUTS_Transition{Array{Float64,1},Float64}([2.007096840858527, -0.549225247385076], -1220.0030560118958, 2, DynamicHMC.DoubledTurn, 0.9949901859986762, 3), NUTS_Transition{Array{Float64,1},Float64}([1.9746361949615314, -0.5604937238569611], -1221.360203163533, 2, DynamicHMC.DoubledTurn, 0.9234860301091139, 3), NUTS_Transition{Array{Float64,1},Float64}([2.048424483073958, -0.5476122787239495], -1221.3937069240772, 2, DynamicHMC.DoubledTurn, 0.954937282955858, 3), NUTS_Transition{Array{Float64,1},Float64}([2.0479100635805856, -0.5648214083080484], -1220.398579456042, 2, DynamicHMC.DoubledTurn, 0.8972472907730523, 3), NUTS_Transition{Array{Float64,1},Float64}([2.0387225892863428, -0.5560451762358397], -1219.7789856286995, 2, DynamicHMC.DoubledTurn, 0.936408840825818, 3), NUTS_Transition{Array{Float64,1},Float64}([1.9513439265413752, -0.5573030903257915], -1222.8752213941646, 1, DynamicHMC.AdjacentTurn, 0.4780338477943813, 3), NUTS_Transition{Array{Float64,1},Float64}([2.0726071337206804, -0.5477283134366904], -1224.3383152754377, 1, DynamicHMC.AdjacentTurn, 0.746636698100699, 3), NUTS_Transition{Array{Float64,1},Float64}([2.044106939886548, -0.5407054018673291], -1220.9618601719837, 2, DynamicHMC.DoubledTurn, 0.9022056832395459, 3), NUTS_Transition{Array{Float64,1},Float64}([2.060939497796793, -0.5795610748375615], -1222.5706438155003, 2, DynamicHMC.DoubledTurn, 0.7191095819843493, 3)], NUTS sampler in 2 dimensions
stepsize (ϵ) ≈ 0.967
maximum depth = 10
Gaussian kinetic energy, √diag(M⁻¹): [0.03805148661809207, 0.011042191267764418]
)
We use the transformation to obtain the posterior from the chain.
posterior = TransformVariables.transform.(Ref(problem_transformation(p)), get_position.(chain));
1000-element Array{NamedTuple{(:σ, :μ),Tuple{Float64,Float64}},1}:
(σ = 7.6035840067253115, μ = 154.539027315885)
(σ = 8.195136596563385, μ = 155.05711396182065)
(σ = 7.424579658161287, μ = 153.7221115915155)
(σ = 7.553166438784449, μ = 153.99479457711467)
(σ = 7.9099511188486655, μ = 155.18636227271)
(σ = 7.567221571754781, μ = 154.43590119412184)
(σ = 7.997517559236255, μ = 154.75604605444917)
(σ = 7.45203438579522, μ = 154.88883976902596)
(σ = 7.466205958113087, μ = 154.1043560171591)
(σ = 7.428494893538293, μ = 154.25369709983994)
⋮
(σ = 7.441681570584242, μ = 154.906626428534)
(σ = 7.203998326135102, μ = 154.5149843864077)
(σ = 7.75567228252298, μ = 154.9627833689666)
(σ = 7.751683639522457, μ = 154.3648921716421)
(σ = 7.680791404306823, μ = 154.66945337686164)
(σ = 7.038139970616106, μ = 154.62575528815503)
(σ = 7.9455111479426, μ = 154.95874270842498)
(σ = 7.722259016011593, μ = 155.2035254611476)
(σ = 7.853344545400182, μ = 153.8550394887367)
Extract the parameter posterior means: β
,
posterior_μ = mean(last, posterior)
154.59032105775808
then σ
:
posterior_σ = mean(first, posterior)
7.748504398651419
Effective sample sizes (of untransformed draws)
ess = mapslices(effective_sample_size,
get_position_matrix(chain); dims = 1)
1×2 Array{Float64,2}:
831.564 981.145
NUTS-specific statistics
NUTS_statistics(chain)
cmdstan_result = "
Iterations = 1:1000
Thinning interval = 1
Chains = 1,2,3,4
Samples per chain = 1000
Empirical Posterior Estimates:
Mean SD Naive SE MCSE ESS
sigma 7.7641872 0.29928194 0.004732063 0.0055677898 1000
mu 154.6055177 0.41989355 0.006639100 0.0085038356 1000
Quantiles:
2.5% 25.0% 50.0% 75.0% 97.5%
sigma 7.21853 7.5560625 7.751355 7.9566775 8.410391
mu 153.77992 154.3157500 154.602000 154.8820000 155.431000
";
"\nIterations = 1:1000\nThinning interval = 1\nChains = 1,2,3,4\nSamples per chain = 1000\n\nEmpirical Posterior Estimates:\n Mean SD Naive SE MCSE ESS\nsigma 7.7641872 0.29928194 0.004732063 0.0055677898 1000\n mu 154.6055177 0.41989355 0.006639100 0.0085038356 1000\n\nQuantiles:\n 2.5% 25.0% 50.0% 75.0% 97.5%\nsigma 7.21853 7.5560625 7.751355 7.9566775 8.410391\n mu 153.77992 154.3157500 154.602000 154.8820000 155.431000\n"
Extract the parameter posterior means: β
,
[posterior_μ, posterior_σ]
2-element Array{Float64,1}:
154.59032105775808
7.748504398651419
end of m4.5d.jl#- This page was generated using Literate.jl.