telescopic.plotting¶
Plots of results: meeting times, the TV bound and signed histograms (needs matplotlib).
- telescopic.plotting.CHAIN_X = '#D93A74'¶
The color of chain \(X\) in plots: the magenta of the documentation’s identity.
- telescopic.plotting.CHAIN_Y = '#0095A6'¶
The color of chain \(Y\) in plots: the identity’s teal.
- telescopic.plotting.MET = '#062A4F'¶
The color of a pair once its chains have met: the identity’s ink of met chains.
- telescopic.plotting.corner(result, dims=None, bins=20)¶
A corner plot of signed histograms: marginals on the diagonal, pairs below it.
The pairs are colored by signed density with a diverging map centered on 0. Telescopic never passes signed weights to
corneror ArviZ, whose weighted quantiles assume non-negative weights.
- telescopic.plotting.marginals(result, dims=None, bins=20, axes=None)¶
Signed histograms of the marginals, with boxes of plus or minus 2 standard errors.
A bin’s density is the average over replicates of its signed mass, divided by its width, so a bin can be negative: the bias corrections carry negative weights, and where few atoms fall they can outweigh the others. The boxes show the Monte Carlo error.
- telescopic.plotting.meeting_times(result, axes=None)¶
The meeting times: a histogram of \(\tau - L\), and its survival function.
The survival function \(P(\tau - L > t)\), drawn by
survival(), is on a log scale, where a straight tail means geometric meeting times. A censored pair counts in it at every time up to the cap, where the curve ends at the fraction censored, and not in the histogram.
- telescopic.plotting.paths(replicates, dims=(0, 1), n=3, ax=None)¶
The coupled paths of a few replicates, for teaching: X solid, Y dashed.
They need the paths that
telescopic.engine.run()keeps withkeep_paths=True. In one dimension they run against time, with Y shifted by the lag so that each pair meets at its meeting time; otherwise they are drawn in the plane ofdims.X is drawn in
CHAIN_Xand Y inCHAIN_Yuntil they meet; from the meeting time on, the path of X, now the pair’s, is drawn inMET. The colors are chosen for a light figure ground. Pairs are told apart by position, not by color, and a legend names the three lines, after the lines thataxalready labels. In one dimension the ticks of the time axis are integers.- Parameters:
- replicates
telescopic.engine.Replicates The output of a run that kept its paths.
- dimstwo ints
The plane, for more than one dimension.
- n
int Replicates drawn, the first ones.
- ax
Axes, optional By default, that of a new figure.
- replicates
- Returns:
- telescopic.plotting.survival(meeting_times, lag, ax=None, *, max_iter=None, label=None)¶
The survival function \(P(\tau - L > t)\) of meeting times, on a log scale.
The curve steps at each meeting time, from \(t = 0\). A censored pair, given as
inf, counts at every time up to the cap,max_iter, where the curve ends at the fraction censored. Several calls on oneaxoverlay their curves.- Parameters:
- meeting_timesarray_like, shape (R,)
Meeting times \(\tau\), integers from
lagon,inffor a censored pair, astelescopic.CoupledSampler.meeting_times()andResult.meeting_timesgive them.- lag
int The lag \(L\) of the runs that produced them.
- ax
Axes, optional By default, that of a new figure.
- max_iter
int, optional The cap of the runs, needed when a pair is censored.
- label
str, optional The curve’s label, for a legend.
- Returns:
- telescopic.plotting.tv_bound(result, ax=None)¶
The estimated bound on the total variation distance to the target against t.
The bound is on a log scale, with
kmarked and a band of two standard errors about the average before its cap at 1, capped in turn: where the cap holds the average well above 1 the band shrinks to the line at 1. Where its lower edge is not positive, the band reaches the bottom of the axis.