@@ -1122,27 +1122,26 @@ the true sampling distribution—which corresponds to taking many samples fr
1122
1122
``` {code-cell} ipython3
1123
1123
:tags: [remove-input]
1124
1124
1125
+ sampling_distribution.encoding.x['bin']['extent'] = (90, 250)
1125
1126
alt.vconcat(
1126
1127
alt.layer(
1127
1128
sampling_distribution,
1128
- sampling_distribution. mark_rule(color='#f58518', size=2).encode(x='mean(mean_price)', y=alt.Y() ),
1129
- sampling_distribution .mark_text(color='#f58518', size=12, align='left', dx=16, fontWeight='bold').encode(
1129
+ alt.Chart(sample_estimates). mark_rule(color='#f58518', size=2).encode(x='mean(mean_price)'),
1130
+ alt.Chart(sample_estimates) .mark_text(color='#f58518', size=12, align='left', dx=16, fontWeight='bold').encode(
1130
1131
x='mean(mean_price)',
1131
1132
y=alt.value(7),
1132
1133
text=alt.value(f"Mean = {sampling_distribution['data']['mean_price'].mean().round(1)}")
1133
1134
)
1134
1135
).properties(title='Sampling distribution', height=150),
1135
1136
alt.layer(
1136
1137
boot_est_dist,
1137
- boot_est_dist. mark_rule(color='#f58518', size=2).encode(x='mean(mean_price)', y=alt.Y() ),
1138
- boot_est_dist .mark_text(color='#f58518', size=12, align='left', dx=18, fontWeight='bold').encode(
1138
+ alt.Chart(boot20000_means). mark_rule(color='#f58518', size=2).encode(x='mean(mean_price)'),
1139
+ alt.Chart(boot20000_means) .mark_text(color='#f58518', size=12, align='left', dx=18, fontWeight='bold').encode(
1139
1140
x='mean(mean_price)',
1140
- y=alt.value(6 ),
1141
+ y=alt.value(7 ),
1141
1142
text=alt.value(f"Mean = {boot_est_dist['data']['mean_price'].mean().round(1)}")
1142
1143
)
1143
1144
).properties(title='Bootstrap distribution', height=150)
1144
- ).resolve_scale(
1145
- x='shared'
1146
1145
)
1147
1146
```
1148
1147
@@ -1252,18 +1251,19 @@ visualize the interval on our distribution in {numref}`fig:11-bootstrapping9`.
1252
1251
1253
1252
``` {code-cell} ipython3
1254
1253
# Create the annotation for for the 2.5th percentile
1255
- text_025 = alt.Chart().mark_text(
1254
+ rule_025 = alt.Chart().mark_rule(color='#f58518', size=3, strokeDash=[5]).encode(
1255
+ x=alt.datum(ci_bounds[0.025])
1256
+ ).properties(
1257
+ width=500
1258
+ )
1259
+ text_025 = rule_025.mark_text(
1256
1260
color='#f58518',
1257
1261
size=12,
1258
1262
fontWeight='bold',
1259
1263
dy=-160
1260
1264
).encode(
1261
- x=alt.datum(ci_bounds[0.025]),
1262
1265
text=alt.datum(f'2.5th percentile ({ci_bounds[0.025].round(1)})')
1263
- ).properties(
1264
- width=500
1265
1266
)
1266
- rule_025 = text_025.mark_rule(color='#f58518', size=3, strokeDash=[5])
1267
1267
1268
1268
# Create the annotation for for the 97.5th percentile
1269
1269
text_975 = text_025.encode(
0 commit comments