  An isotropic stochastic background of nanohertz gravitational waves creates
excess residual power in pulsar-timing-array datasets, with characteristic
inter-pulsar correlations described by the Hellings-Downs function. These
correlations appear as nondiagonal terms in the noise covariance matrix, which
must be inverted to obtain the pulsar-timing-array likelihood. Searches for the
stochastic background, which require many likelihood evaluations, are therefore
quite computationally expensive. We propose a more efficient method: we first
compute approximate posteriors by ignoring cross correlations, and then
reweight them to exact posteriors via importance sampling. We show that this
technique results in accurate posteriors and marginal likelihood ratios,
because the approximate and exact posteriors are similar, which makes
reweighting especially accurate. The Bayes ratio between the marginal
likelihoods of the exact and approximate models, commonly used as a detection
statistic, is also estimated reliably by our method, up to ratios of at least
$10^6$.
