SasView / sasmodels

Package for calculation of small angle scattering models using OpenCL.
BSD 3-Clause "New" or "Revised" License
15 stars 27 forks source link

Document error characteristics of the log normal distribution #558

Open pkienzle opened 1 year ago

pkienzle commented 1 year ago

The relationship between the model + polydispersity and the number of calculation points + distribution width is complicated. For example, the lognormal distribution is highly skew and requires a large value for nsigma and npts to get an accurate estimate. Users should try very large values for these at the end of the fit to verify that the answer does not change significantly. This needs to be mentioned in the documentation for the distribution, and more generally in the usage notes for polydispersity.

The following shows a 1% error at low q with 8-σ distribution width compared to 28-σ:

sascomp sphere radius=500,500 radius_pd=0.3 radius_pd_n=3001,3001 radius_pd_nsigma=8,28 radius_pd_type=lognormal -double!

I've experimented with sampling more densely where the probability is highest (i.e., sampling linearly in the cdf rather than the pdf), but it doesn't work very well. That's because $I(Q,R)$ can change by orders of magnitude with $R$. Despite a small probability $P(R)$ the $I(Q,R)$ term may contribute a lot to the integral $\int_0^{\infty} P(R) I(Q, R) dR$ for distributions with long tails. I'm not sure if we can do better than linear sampling.