@@ -822,6 +822,7 @@ def build_statespace_graph(
822
822
mode : str | None = None ,
823
823
missing_fill_value : float | None = None ,
824
824
cov_jitter : float | None = JITTER_DEFAULT ,
825
+ mvn_method : Literal ["cholesky" , "eigh" , "svd" ] = "svd" ,
825
826
save_kalman_filter_outputs_in_idata : bool = False ,
826
827
) -> None :
827
828
"""
@@ -865,6 +866,14 @@ def build_statespace_graph(
865
866
866
867
- The Univariate Filter is more robust than other filters, and can tolerate a lower jitter value
867
868
869
+ mvn_method: str, default "svd"
870
+ Method used to invert the covariance matrix when calculating the pdf of a multivariate normal
871
+ (or when generating samples). One of "cholesky", "eigh", or "svd". "cholesky" is fastest, but least robust
872
+ to ill-conditioned matrices, while "svd" is slow but extremely robust.
873
+
874
+ In general, if your model has measurement error, "cholesky" will be safe to use. Otherwise, "svd" is
875
+ recommended. "eigh" can also be tried if sampling with "svd" is very slow, but it is not as robust as "svd".
876
+
868
877
save_kalman_filter_outputs_in_idata: bool, optional, default=False
869
878
If True, Kalman Filter outputs will be saved in the model as deterministics. Useful for debugging, but
870
879
should not be necessary for the majority of users.
@@ -915,6 +924,7 @@ def build_statespace_graph(
915
924
logp = logp ,
916
925
observed = data ,
917
926
dims = obs_dims ,
927
+ method = mvn_method ,
918
928
)
919
929
920
930
self ._fit_coords = pm_mod .coords .copy ()
@@ -1131,10 +1141,13 @@ def _sample_conditional(
1131
1141
Observed data on which to condition the model. If not provided, the function will use the data that was
1132
1142
provided when the model was built.
1133
1143
1134
- mvn_method: str
1135
- Method used to compute draws from multivariate normal. One of "cholesky", "eigh", or "svd". "cholesky" is
1136
- fastest, but least robust to ill-conditioned matrices, while "svd" is slow but extremely robust. Default
1137
- is "svd".
1144
+ mvn_method: str, default "svd"
1145
+ Method used to invert the covariance matrix when calculating the pdf of a multivariate normal
1146
+ (or when generating samples). One of "cholesky", "eigh", or "svd". "cholesky" is fastest, but least robust
1147
+ to ill-conditioned matrices, while "svd" is slow but extremely robust.
1148
+
1149
+ In general, if your model has measurement error, "cholesky" will be safe to use. Otherwise, "svd" is
1150
+ recommended. "eigh" can also be tried if sampling with "svd" is very slow, but it is not as robust as "svd".
1138
1151
1139
1152
kwargs:
1140
1153
Additional keyword arguments are passed to pymc.sample_posterior_predictive
@@ -1260,10 +1273,13 @@ def _sample_unconditional(
1260
1273
random_seed : int, RandomState or Generator, optional
1261
1274
Seed for the random number generator.
1262
1275
1263
- mvn_method: str
1264
- Method used to compute draws from multivariate normal. One of "cholesky", "eigh", or "svd". "cholesky" is
1265
- fastest, but least robust to ill-conditioned matrices, while "svd" is slow but extremely robust. Default
1266
- is "svd".
1276
+ mvn_method: str, default "svd"
1277
+ Method used to invert the covariance matrix when calculating the pdf of a multivariate normal
1278
+ (or when generating samples). One of "cholesky", "eigh", or "svd". "cholesky" is fastest, but least robust
1279
+ to ill-conditioned matrices, while "svd" is slow but extremely robust.
1280
+
1281
+ In general, if your model has measurement error, "cholesky" will be safe to use. Otherwise, "svd" is
1282
+ recommended. "eigh" can also be tried if sampling with "svd" is very slow, but it is not as robust as "svd".
1267
1283
1268
1284
kwargs:
1269
1285
Additional keyword arguments are passed to pymc.sample_posterior_predictive
@@ -1366,10 +1382,13 @@ def sample_conditional_prior(
1366
1382
random_seed : int, RandomState or Generator, optional
1367
1383
Seed for the random number generator.
1368
1384
1369
- mvn_method: str
1370
- Method used to compute draws from multivariate normal. One of "cholesky", "eigh", or "svd". "cholesky" is
1371
- fastest, but least robust to ill-conditioned matrices, while "svd" is slow but extremely robust. Default
1372
- is "svd".
1385
+ mvn_method: str, default "svd"
1386
+ Method used to invert the covariance matrix when calculating the pdf of a multivariate normal
1387
+ (or when generating samples). One of "cholesky", "eigh", or "svd". "cholesky" is fastest, but least robust
1388
+ to ill-conditioned matrices, while "svd" is slow but extremely robust.
1389
+
1390
+ In general, if your model has measurement error, "cholesky" will be safe to use. Otherwise, "svd" is
1391
+ recommended. "eigh" can also be tried if sampling with "svd" is very slow, but it is not as robust as "svd".
1373
1392
1374
1393
kwargs:
1375
1394
Additional keyword arguments are passed to pymc.sample_posterior_predictive
@@ -1406,10 +1425,13 @@ def sample_conditional_posterior(
1406
1425
random_seed : int, RandomState or Generator, optional
1407
1426
Seed for the random number generator.
1408
1427
1409
- mvn_method: str
1410
- Method used to compute draws from multivariate normal. One of "cholesky", "eigh", or "svd". "cholesky" is
1411
- fastest, but least robust to ill-conditioned matrices, while "svd" is slow but extremely robust. Default
1412
- is "svd".
1428
+ mvn_method: str, default "svd"
1429
+ Method used to invert the covariance matrix when calculating the pdf of a multivariate normal
1430
+ (or when generating samples). One of "cholesky", "eigh", or "svd". "cholesky" is fastest, but least robust
1431
+ to ill-conditioned matrices, while "svd" is slow but extremely robust.
1432
+
1433
+ In general, if your model has measurement error, "cholesky" will be safe to use. Otherwise, "svd" is
1434
+ recommended. "eigh" can also be tried if sampling with "svd" is very slow, but it is not as robust as "svd".
1413
1435
1414
1436
kwargs:
1415
1437
Additional keyword arguments are passed to pymc.sample_posterior_predictive
@@ -1461,10 +1483,13 @@ def sample_unconditional_prior(
1461
1483
random_seed : int, RandomState or Generator, optional
1462
1484
Seed for the random number generator.
1463
1485
1464
- mvn_method: str
1465
- Method used to compute draws from multivariate normal. One of "cholesky", "eigh", or "svd". "cholesky" is
1466
- fastest, but least robust to ill-conditioned matrices, while "svd" is slow but extremely robust. Default
1467
- is "svd".
1486
+ mvn_method: str, default "svd"
1487
+ Method used to invert the covariance matrix when calculating the pdf of a multivariate normal
1488
+ (or when generating samples). One of "cholesky", "eigh", or "svd". "cholesky" is fastest, but least robust
1489
+ to ill-conditioned matrices, while "svd" is slow but extremely robust.
1490
+
1491
+ In general, if your model has measurement error, "cholesky" will be safe to use. Otherwise, "svd" is
1492
+ recommended. "eigh" can also be tried if sampling with "svd" is very slow, but it is not as robust as "svd".
1468
1493
1469
1494
kwargs:
1470
1495
Additional keyword arguments are passed to pymc.sample_posterior_predictive
@@ -1527,10 +1552,13 @@ def sample_unconditional_posterior(
1527
1552
random_seed : int, RandomState or Generator, optional
1528
1553
Seed for the random number generator.
1529
1554
1530
- mvn_method: str
1531
- Method used to compute draws from multivariate normal. One of "cholesky", "eigh", or "svd". "cholesky" is
1532
- fastest, but least robust to ill-conditioned matrices, while "svd" is slow but extremely robust. Default
1533
- is "svd".
1555
+ mvn_method: str, default "svd"
1556
+ Method used to invert the covariance matrix when calculating the pdf of a multivariate normal
1557
+ (or when generating samples). One of "cholesky", "eigh", or "svd". "cholesky" is fastest, but least robust
1558
+ to ill-conditioned matrices, while "svd" is slow but extremely robust.
1559
+
1560
+ In general, if your model has measurement error, "cholesky" will be safe to use. Otherwise, "svd" is
1561
+ recommended. "eigh" can also be tried if sampling with "svd" is very slow, but it is not as robust as "svd".
1534
1562
1535
1563
Returns
1536
1564
-------
@@ -2051,10 +2079,13 @@ def forecast(
2051
2079
verbose: bool, default=True
2052
2080
Whether to print diagnostic information about forecasting.
2053
2081
2054
- mvn_method: str
2055
- Method used to compute draws from multivariate normal. One of "cholesky", "eigh", or "svd". "cholesky" is
2056
- fastest, but least robust to ill-conditioned matrices, while "svd" is slow but extremely robust. Default
2057
- is "svd".
2082
+ mvn_method: str, default "svd"
2083
+ Method used to invert the covariance matrix when calculating the pdf of a multivariate normal
2084
+ (or when generating samples). One of "cholesky", "eigh", or "svd". "cholesky" is fastest, but least robust
2085
+ to ill-conditioned matrices, while "svd" is slow but extremely robust.
2086
+
2087
+ In general, if your model has measurement error, "cholesky" will be safe to use. Otherwise, "svd" is
2088
+ recommended. "eigh" can also be tried if sampling with "svd" is very slow, but it is not as robust as "svd".
2058
2089
2059
2090
kwargs:
2060
2091
Additional keyword arguments are passed to pymc.sample_posterior_predictive
@@ -2246,10 +2277,13 @@ def impulse_response_function(
2246
2277
random_seed : int, RandomState or Generator, optional
2247
2278
Seed for the random number generator.
2248
2279
2249
- mvn_method: str
2250
- Method used to compute draws from multivariate normal. One of "cholesky", "eigh", or "svd". "cholesky" is
2251
- fastest, but least robust to ill-conditioned matrices, while "svd" is slow but extremely robust. Default
2252
- is "svd".
2280
+ mvn_method: str, default "svd"
2281
+ Method used to invert the covariance matrix when calculating the pdf of a multivariate normal
2282
+ (or when generating samples). One of "cholesky", "eigh", or "svd". "cholesky" is fastest, but least robust
2283
+ to ill-conditioned matrices, while "svd" is slow but extremely robust.
2284
+
2285
+ In general, if your model has measurement error, "cholesky" will be safe to use. Otherwise, "svd" is
2286
+ recommended. "eigh" can also be tried if sampling with "svd" is very slow, but it is not as robust as "svd".
2253
2287
2254
2288
kwargs:
2255
2289
Additional keyword arguments are passed to pymc.sample_posterior_predictive
0 commit comments