You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This shows a good fit to the data and implies, as you might expect, that the failing fraction of shock absorbers increases with age as they wear out. But how do we quantify the prediction given an estimated model?
We'll use the posterior predictive distribution of the uniformative model. We show here how to derive the uncertainty in the estimates of the 95% prediction interval for the number of failures in a time interval. As we saw above the MLE alternative to this procedure is to generate a predictive distribution from bootstrap sampling. The bootstrap procedure tends to agree with the plug-in procedure using the MLE estimates and lacks the flexibility of specifying prior information.
1086
1068
1087
1069
```{code-cell} ipython3
1070
+
import xarray as xr
1071
+
1072
+
from xarray_einstats.stats import XrContinuousRV, XrDiscreteRV
ax1.axvline(output_df["lb"].mean(), label="Expected 95% PI Lower Bound on Failure Count")
1146
-
ax1.axvline(output_df["ub"].mean(), label="Expected 95% PI Upper Bound on Failure Count")
1127
+
ax1.axvline(output_ds["lb"].mean(), label="Expected 95% PI Lower Bound on Failure Count")
1128
+
ax1.axvline(output_ds["ub"].mean(), label="Expected 95% PI Upper Bound on Failure Count")
1147
1129
ax1.hist(
1148
-
output_df["ub"],
1130
+
output_ds["ub"],
1149
1131
ec="black",
1150
1132
color="cyan",
1151
1133
label="95% PI Upper Bound on Failure Count",
1152
1134
bins=20,
1153
1135
alpha=0.3,
1154
1136
)
1155
1137
ax1.hist(
1156
-
output_df["expected"], ec="black", color="pink", label="Expected Count of Failures", bins=20
1138
+
output_ds["expected"], ec="black", color="pink", label="Expected Count of Failures", bins=20
1157
1139
)
1158
1140
ax1.set_title("Uncertainty in the Posterior Prediction Interval of Failure Counts", fontsize=20)
1159
1141
ax1.legend()
1160
1142
1161
1143
ax2.set_title("Expected Costs Distribution(s) \nbased on implied Failure counts", fontsize=20)
1162
1144
ax2.hist(
1163
-
cost_func(output_df["expected"], 2.3),
1145
+
cost_func(output_ds["expected"], 2.3),
1164
1146
label="Cost(failures,2)",
1165
1147
color="royalblue",
1166
1148
alpha=0.3,
1167
1149
ec="black",
1168
1150
bins=20,
1169
1151
)
1170
1152
ax2.hist(
1171
-
cost_func(output_df["expected"], 2),
1153
+
cost_func(output_ds["expected"], 2),
1172
1154
label="Cost(failures,2.3)",
1173
1155
color="red",
1174
1156
alpha=0.5,
@@ -1177,7 +1159,7 @@ ax2.hist(
1177
1159
)
1178
1160
ax2.set_xlabel("$ cost")
1179
1161
# ax2.set_xlim(-60, 0)
1180
-
ax2.legend()
1162
+
ax2.legend();
1181
1163
```
1182
1164
1183
1165
The choice of model in such cases is crucial. The decision about which failure profile is apt has to be informed by a subject matter expert because extrapolation from such sparse data is always risky. An understanding of the uncertainty is crucial if real costs attach to the failures and the subject matter expert is usually better placed to tell if you 2 or 7 failures can be plausibly expected within 600 hours of service.
@@ -1193,7 +1175,7 @@ In particular we've seen how the MLE fits to our bearings data provide a decent
1193
1175
1194
1176
## Authors
1195
1177
1196
-
* Authored by Nathaniel Forde on 9th of January 2022 ([pymc-examples491](https://github.com/pymc-devs/pymc-examples/pull/491))
1178
+
* Authored by Nathaniel Forde on 9th of January 2022 ([pymc-examples#491](https://github.com/pymc-devs/pymc-examples/pull/491))
1197
1179
1198
1180
+++
1199
1181
@@ -1209,7 +1191,7 @@ In particular we've seen how the MLE fits to our bearings data provide a decent
0 commit comments