J

[a]Andreas<EMAIL_ADDRESS>if different from
[a]University of Copenhagen, Department of Neuroscience, Blegdamsvej 3, 2200
Copenhagen, Denmark

# Fitting multiple small-angle scattering datasets simultaneously: on the
optimal use of priors and weights

###### Abstract

Small-angle X-ray and neutron scattering (SAXS and SANS) are powerful
techniques for elucidating the structure of diverse particles and materials.
This study address the challenge of effectively combining SAXS and SANS data
for accurate structural parameter determination. Surprisingly, our results
demonstrate that equally weighting all data points leads to the most accurate
parameter estimation, even when SAXS data significantly outnumber SANS data.
We compared this approach with weighting schemes normalized by the number of
points and by the derived information content. Furthermore, we assessed the
impact of prior knowledge by incorporating Gaussian priors for model
parameters. Our findings indicate that Gaussian priors improve the accuracy of
refined parameter values compared to uniform priors. When using a minimum and
a maximum values for model parameters, which is common practice, uniform
priors are implicitely applied. Finally, we show that utilizing information
content aids in determining the degrees of freedom, enabling accurate
calculation of the goodness of fit. In conclusion, this research provides
valuable insights into the optimal combination of SAXS and SANS data,
emphasizing the importance of weighting schemes and prior knowledge for
enhanced accuracy in structural parameter determination.

Supply a synopsis of the paper for inclusion in the Table of Contents.

##  1 Introduction

Small-angle X-ray and neutron scattering (SAXS and SANS) provide structural
information about nanoscale-structures, ranging from a few to hundreds of
nanometers.These methods find applications across diverse materials, including
amorphous materials like gels, polymers, liquids and glasses, as well as
biological macromolecules such as proteins, DNA, lipids and their complexes.
Additionally, hard materials, including nanoparticles, falls within the scope
of investigation. The resolution, typically between 10-50 Å, depends factors
like, sample size, homogeneity, symmetry, concentration as well as
intstumental factors including detector type, divergence and measured angular
range. In SANS, the contrast of the sample with respect to the sample can be
varied using hydrogen-deuterium exchange [Heller2010]. By combining SAXS and
SANS measurements with different contrasts, one can increase the information
content of the data, and more accurately refine structural parameters. SAXS
and SANS have elegantly been combined, e.g., in studies of toroidal polymers
assemblies [Hollamby2016], protein/DNA complexes [Sonntag2017], multishell-
nanoparticles [Lin2020], block copolymer micelles [Manet2011], multilamellar
lipid vesicles [Heftberger2013], and membrane protein-containing lipid
nanodiscs [Kynde2014-bR], to mention a few examples. Due to the
complementarity of SAXS and SANS, several SANS beamlines now offers SAXS
measurements at home-source SAXS instruments close to, or even at the beamline
[Metwalli2021].

However, sample preparation remains a considerable challenge, in terms of both
time and cost. Moreover, there is high demand on beamtime at synchrotron SAXS
and SANS facilities, so it is important that the data is also analyzed in the
most optimal way. Analysis of SAXS or SANS data can be done by hypothesizing a
model, and refining the parameters of this model against the measured data. If
the sample has been measured with both SAXS and SANS, these data may be fitted
simultaneously, resulting in more accurately refined structural parameters.
But, as we shall see, one needs to assign proper weights on the data to obtain
the most accurate solution. It is not trivial what weights to use when doing a
simultaneous fit: should one simply weigh with the number of points, or should
the number of points be normalized out in the minimization? Should the noise
level and information content be taken into account in the minimization
algorithm? In this paper, I will discuss the best weighting scheme by doing
model refinement against simulated data.

Another crucial aspect in simultaneous fitting is the inclusion of molecular
constraints [Zemb2010] or prior knowledge. The manner in which prior knowledge
is included in the minimization algorithm has a strong effect on the accuracy
of the refined parameters. Here, we argue for the superioty of Gaussian priors
over the commonly used uniform priors. Uniform priors are impliciteyly applied
in most software packages for SAXS and SANS analysis through the use of hard
limits for the parameter values. Drawing inspiration from successful
applications in X-ray crystallography [Headd2012-Phenix], electron microscopy
model refinement [Scheres2012-Bayes, Scheres2012-RELION], and for the
combining of SAXS and molecular dynamics simulations [Hummer2015], we advocate
for the use of Bayesian refinement with Gaussian priors for enhanced accuracy
in parameter determination.

##  2 Methods

###  2.1 Core-multishell model

For generating the simulated data and for fitting these data, a core-
multishell model was used. The model is built up using the form factor
amplitude for a sphere with radius $R$:

$\displaystyle\psi(q,R)=3\frac{\sin(qR)-qR\cos(qR)}{(qR)^{3}},$ (1)

where $q=4\pi\sin(\theta)/\lambda$, $2\theta$ is the scattering angle and
$\lambda$ is the wavelength of the incoming wave. The core radius of the model
is denoted $R_{\mathrm{c}}$, and the outer radius of the $i^{th}$ shell is
denoted $R_{i}$. We will denote the volume of a sphere with radius $R_{i}$ by
$V_{i}=4\pi R_{i}^{3}/3$. The excess scattering length densities of the
shells, i.e, the contrasts with respect to the buffer, are denoted
$\Delta\rho_{i}$. Using the shorthand notation $A_{i}=V_{i}\psi(q,R_{i})$, the
form factor for a core-multishell particle with $n_{s}$ shells can be written
as [Pedersen1997]:

$\displaystyle
P(q)=\left[\frac{A_{\mathrm{c}}+\sum_{i=1}^{n_{s}}\frac{\Delta\rho_{i}}{\Delta\rho_{\mathrm{c}}}(A_{i}-A_{i-1})}{V_{\mathrm{c}}+\sum_{i=1}^{n_{s}}\frac{\Delta\rho_{i}}{\Delta\rho_{\mathrm{c}}}(V_{i}-V_{i-1})}\right]^{2},$
(2)

where subscripts 0 in the sums refer to the core. For this paper, we used
three shells ($n_{\mathrm{s}}=3$). The intensity is modelled with a scaling
and a constant background, $I_{\mathrm{model}}(q)=aP(q)+b$. Only the relative
values of the contrasts affects $P(q)$, so the model has 9 parameters ($K=9$):
four radii ($R_{\mathrm{c}},R_{1},R_{2},R_{3}$), three relative contrasts
($\Delta\rho_{i}/\Delta\rho_{c})$, as well as scaling and background ($a$ and
$b$). When fitting two datasets with the model, five additional parameters are
introduced, namely three additional relative contrasts, as well as scaling and
background for the second dataset, so in that case $K=14$.

###  2.2 Simulated SAXS and SANS data

First, $q$ was defined, with $q_{\mathrm{min}}$=0.001 Å-1 and
$q_{\mathrm{max}}$=0.5 Å-1. The simulated SAXS data contained 400 points, and
the simulated SANS data contained 50 points, unless stated otherwise in the
results section. Theoretical curves were then calculated and evaluated at
these $q$-values, using $I_{\mathrm{model}}(q)=aP(q)+b$. The SAXS data was
scaled by $a_{\mathrm{SAXS}}=0.5$ cm-1 and the SANS data by
$a_{\mathrm{SANS}}=0.8$ cm-1, and the background $b=10^{-5}$ cm-1 was used for
both SAXS and SANS data. To ensure realistic errors, similar to what would be
obtained from an experiment, the errors were modelled using an empirical model
[Sedlak2017-errors]:

$\displaystyle\sigma_{i}=\sqrt{\frac{I_{s}(q_{i})+2cI_{s}(0.2\mathrm{\AA}^{-1})/(1-c)}{4500q_{i}}},$
(3)

where $I_{s}(q_{i})=sI_{\mathrm{model}}(q_{i})/I(0)$ is the normalized and
scaled model intensity evaluated at $q_{i}$. For simulated SAXS data, $s=100$
and $c=0.85$ was used (high signal-to-noise ratio), whereas for simulated SANS
data, $s=10$ and $c=0.95$ was used (low signal-to-noise ratio). The simulated
intensities ($I_{i}$) were then pulled stochastically from normal
distributions with mean $\mu_{i}=I_{\mathrm{model}}(q_{i})$ and standard
deviations $\sigma_{i}$. To simulate data with increasing noise, the variance
($\sigma_{i}^{2}$) was multiplied with a noise factor, before simulation of
the intensities, i.e. $\sigma_{i}^{2}\rightarrow
f_{\mathrm{noise}}\sigma_{i}^{2}$. The noise was increased logarithmically, by
varying $\log(f_{\mathrm{noise}})$ from $-4$ to $10$. In order to simulate
data with over- or underestimated errors, a factor was multiplied on
$\sigma_{i}$ after simulation of the data, such that $\sigma_{i}$ no longer
reflected the fluctuations of the simulated intensities. For each condition,
i.e., the different weight schemes and priors described in the results
section, 50,000 SAXS and 50,000 SANS datasets were simulated and fitted with
the model.

###  2.3 BayesFit - fitting multiple datasets with priors

BayesFit is a program that can fit SAXS and SANS data simultaneously with an
analytical model, using Gaussian priors. I.e. it is an implementation of the
aforementioned Bayesian refinement for SAXS and SANS data. BayesFit reads an
input file, and this input file contains information about the data, the name
of the model, the prior values for each model parameter
($\mu_{\mathrm{prior},k}$ and $\sigma_{\mathrm{prior},k}$), and the weighting
scheme ($w_{j}$) used to weight different datasets against each other.
BayesFit then minimizes:

$\displaystyle\min\left[\left(\sum_{j=1}^{N_{\mathrm{dataset}}}w_{j}\chi^{2}_{j}\right)+\alpha
S\right],$ (4)

where $\chi^{2}$ and $S$ are given as:

$\displaystyle\chi^{2}$
$\displaystyle=\sum_{i=1}^{M}\left(\frac{I_{i}-I_{\mathrm{model}}(q_{i})}{\sigma_{i}}\right)^{2},$
(5) $\displaystyle S$
$\displaystyle=\sum_{k=1}^{K}\left(\frac{p_{k}-\mu_{\mathrm{prior},k}}{\sigma_{\mathrm{prior},k}}\right)^{2}.$
(6)

$p_{k}$ is the refined value of the $k^{th}$ model parameter and $M$ is the
number of datapoints. The minimization is done for a range of $\alpha$ values,
and the probabilities of the solution at each value are calculated, as
described previously [Hansen2000, Larsen2018-BayesFit]. For the refinements in
this paper, BayesFit scanned 11 logarithmically spaced values of $\alpha$ and
the range was manually adjusted to ensure that it contained the $\alpha$
values giving rise to the highest probabilities. BayesFit utilizes Scipy’s
curve_fit function [Virtanen2020-scipy]. In order to use the curve_fit
function, an array was defined with all $q$-values from both SAXS and SANS
data, and dummy $q$-values for each of the prior values. A corresponding array
was defined with all simulated intensities ($I_{i}$) from the SAXS and SANS
datasets and the prior means ($\mu_{\mathrm{prior},k}$). An uncertainty array
was finally constructed, with the errors of the simulated data ($\sigma_{i}$)
as well as the prior standard deviations ($\sigma_{\mathrm{prior},k}$). The
experimental errors were scaled with $w_{j}^{-1/2}$ before fitting, to obtain
the weigthing in equation (4). The prior means ($\mu_{\mathrm{prior},k}$) were
used as initial guesses in the subsequent Levenberg-Marquardt minimization
algorithm. The upper and lower limits were set to $\pm
5\sigma_{\mathrm{prior},k}$, and radii were constrained to positive values. To
apply uniform priors, $\alpha$ was fixed at $10^{-10}$, effectively quenching
the effect of the prior, except for the upper and lower limits, which were
adjusted by changing the $\sigma_{\mathrm{prior},k}$ in the input file.
$\mu_{\mathrm{prior},k}$ were also used as initial guesses when fitting with
uniform priors. Parameter values for all priors are listed in Table 1 and
Table 2. Normalized gradient matrices were used to calculate the information
content [Vestergaard2006] and the probability of the solution [Hansen2000,
Larsen2018-BayesFit]. These matrices were constructed numerically from
$\chi^{2}$ using the forward Euler method. Eigenvalues were found using NumPy
[Harris2020-numpy]. Each refined model parameter was then calculated as a
probability-weighted average:

$\displaystyle
p_{\mathrm{refined},k}=\sum_{i=1}^{N_{\alpha}}PD(\alpha_{i})p_{k}(\alpha_{i}),$
(7)

where $PD(\alpha_{i})$ is the probability density of the solution at
$\alpha_{i}$, and $p_{k}(\alpha_{i})$ is the refined value of the $k^{th}$
parameter at $\alpha_{i}$. $N_{\alpha}$ is the number of $\alpha$ values that
were scanned. Goodness of fit and information content were also calculated, as
described in the results section. The source code for BayesFit is available at
https://github.com/andreashlarsen/Larsen2023-BayesFit, along with all scripts
for simulating data and plotting the results. The program is meant as a proof-
of-principle, and the goal is that inclusion of Gaussian priors should be
implemented in other software packages for SAXS and SANS analysis, which are
far superior in the number of verified models, user interface and additional
features, e.g., WillItFit [Pedersen2013-WillItFit], SASfit
[Kohlbrecher2022-SASfit], SasView (www.sasview.org) or Irena
[Ilavsky2009-Irena].

###  2.4 Calculating information content

The number of Shannon channels ($N_{\mathrm{s}}$) and the number of good
parameters ($N_{\mathrm{g,BIFT}}$) were calculated with the Bayesian indirect
Fourier transformation (BIFT) algorithm [Hansen2000], as implemented in
BayesApp version1.1 [Hansen2012, Larsen2021-chi2]. Shanum [Konarev2015] as
implemented in ATSAS version 3.0.3 [Manalastas-Cantos2021], was used to
estimate the number of Shanum channels ($N_{\mathrm{m}}$).

###  2.5 Calculating Kullback-Leibler divergence

The Kullback-Leibler divergence provides a measure for the information gain
about model parameters after refinement. BayesFit uses the special case for
normal distributions (https://statproofbook.github.io/P/norm-kl.html, accessed
26/6-2023):

$\displaystyle
D_{\mathrm{KL,k}}(P|Q)=\frac{1}{2}\left[\frac{(\mu_{\mathrm{prior},k}-p_{k})^{2}}{\sigma_{\mathrm{prior},k}^{2}}+\frac{\sigma_{\mathrm{post},k}^{2}}{\sigma_{\mathrm{prior},k}^{2}}-\log\frac{\sigma_{\mathrm{post},k}^{2}}{\sigma_{\mathrm{prior},k}^{2}}-1\right].$
(8)

With this expression, numerical integration is avoided. The Kullback-Leibler
divergence, as calculated in equation (8) provides the information gain in
units of nat. BayesFit outputs $D_{\mathrm{KL}}$ in units of bit, by the
conversion factor nat/bit = ln(2). In the case of uniform priors, a numerical
integration is evaluated, but exploiting that the integration limits are
defined by the upper and lower bounds of the uniform prior
($p_{k,\mathrm{max}}$ and $p_{k,\mathrm{min}}$). The uniform prior is then
$Q_{\mathrm{prior}}(p_{k})=1/(p_{k,\mathrm{max}}-p_{k,\mathrm{min}})$, and the
posterior ($P_{\mathrm{post}}(p_{k})$) is a truncated normal distribution. The
Kullback-Leibler divergence is in that case calculated by a numerical
evaluation (using 10,000 steps) of the integral:

$\displaystyle
D_{\mathrm{KL,k}}(P|Q)=\int_{p_{k,\mathrm{min}}}^{p_{k,\mathrm{max}}}P_{\mathrm{post}}(p_{k})\log_{2}\left(\frac{P_{\mathrm{post}}(p_{k})}{Q_{\mathrm{prior}}(p_{k})}\right)dp_{k},$
(9)

which provides the information gain in units of bit.

##  3 Information content in small-angle scattering

A central concept used in this paper is that of information content. The
information content in a SAS dataset is not a uniquely defined. Here, I will
refer to the information content as an estimate of the number of independent
parameters that can be refined from a given dataset.

###  3.1 Information content using the sampling theorem

Information theory provides a framework for estimating the information content
from SAS data. The Nyquist-Shannon sampling theorem states that a given signal
must be samples with at least twice the highest frequency of interest
[Shannon1949, Nyquist1928]. In information theory, the signal is typically
measured as a function of time, and converted to frequencies using Fourier
transformation. In SAS, the measured signal is a function of inverse distance,
$q$, where $q$ is given in terms of the wavelength $\lambda$ and scattering
angle $2\theta$ as $q=4\pi\sin(\theta)/\lambda$. The sampling rate must
therefore be sampled with a $\Delta q$ corresponding to at least twice the
largest distance of interest, i.e. the largest distance in the particle,
$D_{\mathrm{max}}$. Using the inverse relation between distance ($d$) and
momentum transfer, $q=2\pi/d$, we obtain $\Delta q\leq\pi/D_{\mathrm{max}}$
[Damaschun1968, Muller1979]. If $\pi/D_{\mathrm{max}}$ (the first Shannon
channel) is within the measured $q$-range and if the sample consists of
particles in solution, then $D_{\mathrm{max}}$ can be estimated using indirect
Fourier transformation (IFT) of the data [Glatter1977, Hansen2000]. For other
types of samples such as gels and liquids, where the $D_{\mathrm{max}}$ may
not be estimated by IFT, the scientist must decide on the largest distance of
interest in order to estimate the minimum sampling rate. The number of
independent parameters retrievable from the data can then be calculated as the
measured $q$-range divided by the minimum sampling rate. This is also denoted
the number of Shannon channels and is an estimate of the maximum number of
independent parameters that can be retrieved from data:

$\displaystyle
N_{\mathrm{s}}=D_{\mathrm{max}}(q_{\mathrm{max}}-q_{\mathrm{min}})/\pi.$ (10)

Therefore, as a rule of thumb, one should not attempt to refine more than
$N_{\mathrm{s}}$ independent parameters from a given dataset (Evrard2011,
Muller1992, Lenz2023), as this would lead to overfitting of data, i.e., data
become ”too easy” to fit.

SAS data is usually oversampled, i.e. the $q$-spacing is smaller than
$\pi/D_{\mathrm{max}}$. Oversampling in this content should not be confused
with oversampling in data analysis, where repulling from an underrepresented
population is applied to get a more representative dataset, which again leads
to data points that are no longer statistically independent. Oversampling in
the way it is done in SAS does not violate the assumption of independent data
points. This is important, as independence is assumed when using $\chi^{2}$
for minimization as assessment of the goodness of fit. The amount of
oversampling can be adjusted by the physical size of the detector pixels, as
well as the (re)binning of data in postprocessing.

$N_{\mathrm{s}}$ is a good first-order approximation of the information
content in data, but is indifferent to the signal-to-noise ratio. That is, two
datasets with the same $q$-range and $D_{\mathrm{max}}$ has the same
$N_{\mathrm{s}}$, regardless of the concentration, exposure, incoherent
background, etc. Taupin and Luzzati argued that, as the scattering decays as
$q^{-4}$ at high angles, the data can be described by a $q^{-4}$ decay at all
$q$-values above a critical value, $q_{\mathrm{m}}$ [Taupin1982]. Above this
value, the data carries only two degrees of freedom that describe the scale
and background of the quadratic decay, $I(q>q_{\mathrm{m}})\sim a(q^{-4})+b$.
Using this, the number of independent parameters (i.e., the information
content) in data may be written as:

$\displaystyle N_{t}=2+D_{\mathrm{max}}(q_{\mathrm{m}}-q_{\mathrm{min}})/\pi.$
(11)

In principle, this idea can be extended to any part of the curve that can be
described exactly by a parametric model in a given $q$-range.

Although theoretically sound, a more practical method is to consider the
$q_{\mathrm{m}}$ above which the signal-to-noise ratio is below some threshold
value.

###  3.2 Information content using indirect Fourier transformation

In IFT, a pair distance distribution ($p(r)$) is described by a number of
parameters, and Fourier transformed to fit the data. The parameters are then
refined until an appropriate balance between the prior and the goodness of fit
is achieved. The prior is typically that $p(r)$ is smooth [Glatter1977,
Hansen2000, Konarev2015]. But how many parameters are needed to adequately
describe the data? A noisy dataset can be fitted well by a few parameters,
whereas more parameters are necessary to describe a dataset measured in a wide
$q$-range and with a high signal-to-noise ratio. Shanum determines the number
of parameters necessary to describe the data and uses this as the information
content [Konarev2015]. We denote this estimate the number of Shanum channels
$N_{\mathrm{m}}$. The theoretical upper limit for $N_{\mathrm{m}}$ is $M$, the
number of points in data, but $N_{\mathrm{m}}$ will always be smaller than
that. Interestingly, due to oversampling, $N_{\mathrm{m}}$ may exceed
$N_{\mathrm{s}}$ [Konarev2015], as data is so well sampled between
$q_{\mathrm{min}}$ and $q_{\mathrm{max}}$, that very good estimates for the
intensity can be made just outside this range, so the effective ”information
bandwidth” is extended. For all practical purposes, however,
$N_{\mathrm{m}}<N_{\mathrm{s}}$, and $N_{\mathrm{s}}$ may be considered a
practical upper limit for the information content of data. Shanum applies a
smoothness prior in the IFT, and the prior is the reason that $N_{\mathrm{m}}$
is usually smaller than $N_{\mathrm{s}}$: the rest of the information stems
from prior knowledge.

In this paper, we use a similar measure for the information content, which
rely on Bayesian IFT (BIFT) [Hansen2000]. Bayesian statistics provides a
convenient formalism for inclusion of priors:

$\displaystyle\mathrm{P}(\mathbf{p}|\text{data})\propto\mathrm{P}(\text{data}|\mathbf{p})\mathrm{P}(\mathbf{p}),$
(12)

where $\mathbf{p}=\\{p_{1},p_{2},...,p_{K}\\}$ are the refined model
parameters, $\mathrm{P}(\mathbf{p}|\text{data})$ is the probability of the
model given the data (posterior probability), which is the quantity we wish to
maximize. $\mathrm{P}(\text{data}|\mathbf{p})$ is the likelihood, and using
the assumption that the data points are independent, then
$-2\log(\text{likelihood})=\chi^{2}$ (equation (5)). Since $\log(x)$ is a
monotonic function, $\chi^{2}$ can be minimized to maximize the likelihood.
Finally, $\mathrm{P}(\mathbf{p})$ is the prior, i.e, the probability of the
refined parameter values in the model. To find the most probable $p(r)$ given
the data, the quantity $\chi^{2}+\alpha S$ is minimized, where $S$ is a
smoothness prior (equation (6)) and $\alpha$ is a hyperparameter that can be
uniquely determined by maximizing the posterior probability [Hansen2000].
Higher $\alpha$ means that more weight is given to the prior ($S$) and less to
the likelihood ($\chi^{2}$), vice versa. The information content can then be
estimated as the number of good parameters [Gull1989, Muller1996,
Vestergaard2006]:

$\displaystyle
N_{\mathrm{g}}=\sum_{k=1}^{K}\frac{\lambda_{k}}{\alpha+\lambda_{k}},$ (13)

where $\lambda_{k}$ is the $k^{th}$ eigenvalues of the normalized gradient
matrix of $\chi^{2}$. In other words, $\lambda_{k}/(\alpha+\lambda_{k})$ is a
number between 0 and 1, where 0 means that the $k^{th}$ effective parameter
has no influence on $\chi^{2}$, whereas a value of unity means that it has a
large impact on $\chi^{2}$. Just like $N_{\mathrm{m}}$, $N_{\mathrm{g}}$ may
exceed $N_{\mathrm{s}}$ [Vestergaard2006], but for all practical purposes,
$N_{\mathrm{s}}$ can be considered an upper limit for $N_{\mathrm{g}}$, which
decreases as the noise in data increases (Fig. 1).

###  3.3 Information content using analytical models

The number of good parameters, $N_{\mathrm{g}}$, can also be retrieved if the
data is fitted with an analytical model, and is therefore not restricted to
IFT. This can be done by introducing priors for each model parameter and
refining the model against the data using these priors [Larsen2018-BayesFit].
The priors are estimates of the model parameters, e.g, for spherical
nanoparticles, this could be estimates of their radius, concentration, or
polydispersity. In that case, $N_{\mathrm{g}}\leq K$, where $K$ is the number
of model parameters. The intuition behind this is, that given the prior
knowledge, the data only contains the extra information, which is not already
contained in the prior. For example, if a sample of homogeneous spherical
nanoparticles are measured, and known to be described with a model
$I=aP(q,R)+b$, where $a$ is scaling and $b$ is a constant background, and
$P(q,R)$ is the form factor for a sphere with radius $R$, then one can only
hope to retrieve three parameters from data: $R$, $a$ and $b$. If the model
does not fit, then the situation does of course change. It is usually when
data do not fit the prior, that we learn the most. However, assuming that the
simple sphere model fits data, then $N_{\mathrm{g}}=3$ is the upper limit of
the information gain from data. In the example with the monodisperse,
homogeneous and perfectly spherical nanoparticles, $N_{\mathrm{g}}=3$ would
mean that the parametrization of the model is correct, but the values of these
parameters ($a$, $b$ and $R$) were determined only from the data (not from the
prior). However, depending on the prior knowledge, the information gain may
well be smaller, e.g. if $R$ is known to be in some narrow interval (a uniform
prior), or a mean and uncertainty is known (a normal distributed prior). Then
the information gain from refining $R$ only corresponds to the amount by which
the posterior value of $R$ is changed compared to the prior value. In other
words, $N_{\mathrm{g}}$ is an estimate for how much we have learned from the
data. It can be considered as a quantification of surprise or gained
knowledge.

Albeit this concept may seem rather different from the IFT method, one should
keep in mind that IFT also apply a prior, albeit a rather general prior
compared to the one applied when using a geometric model to describe data.
Generally, the more that is known before the experiment, the smaller is the
information content of data, so $N_{\mathrm{g}}$ estimated from IFT is
generally larger than $N_{\mathrm{g}}$ from fitting with an analytical model.
$N_{\mathrm{g}}$ from model fitting was implemented in the program BayesFit
[Larsen2018-BayesFit], but only for a few models and with a single dataset as
input. BayesFit was therefore reimplemented for the present publication (see
Methods). The information content gained from analytical modelling will here
be denoted $N_{\mathrm{g,BayesFit}}$, and the information content from BIFT
will be denoted $N_{\mathrm{g,BIFT}}$.

In Fig. 1, $N_{\mathrm{s}}$, $N_{\mathrm{m}}$, $N_{\mathrm{g,BIFT}}$ and
$N_{\mathrm{g,BayesFit}}$ are plotted for simulated data with increasing
noise. The data were simulated using a model of core-multishell particles with
three shells (see Methods). To obtain $N_{\mathrm{g,BayesFit}}$, the data were
fitted with the same core-multishell model which was used to generate the
simulated data. $N_{\mathrm{g,BIFT}}$ and $N_{\mathrm{m}}$ are higher than
$N_{\mathrm{s}}$ for data with very low signal-to-noise ratio, but both
decrease with increasing noise. $N_{\mathrm{g,BayesFit}}$ equals $K$ for data
with very low signal-to-noise ratio and converges to zero as the noise
increases (Fig. S1).

Figure 1: Information content of simulated SAXS data with increasing noise
from a core-multishell particle. (A) Examples of simulated SAXS data with
increasing noise. (B) The information content as estimated by the number of
Shannon channels $N_{\mathrm{s}}$ (black), the number of Shanum channels
$N_{\mathrm{m}}$ (blue) and the number of good parameters
$N_{\mathrm{g,BIFT}}$ (gray). The information content was also estimated with
the number of good parameters from model fitting $N_{\mathrm{g,BayesFit}}$
(light blue). Dashed lines indicate the noise levels corresponding to data in
panel A.

###  3.4 Degrees of freedom and information content

The expectation value of $\chi^{2}$ is the degrees of freedom of the fit,
which is given as $M$ minus the degrees of freedom of the model ($\nu$).
Therefore, the reduced $\chi^{2}$ has an expectation value of unity:

$\displaystyle\chi^{2}_{\mathrm{r}}=\chi^{2}/(M-\nu).$ (14)

For a simple model and little or no prior knowledge about the parameter
values, $\nu=K$, where $K$ is the number of model parameters. E.g. a simple
mean has $\nu=1$, a linear function $y=ax+b$ has $\nu=2$, etc. For more
complex models, the parameters may, however, be correlated. E.g, in the case
of BIFT, $\nu$ is not trivially found. However, it has been shown that
$N_{\mathrm{BIFT}}$ is a good estimate of $\nu$ in BIFT [Larsen2021-chi2].
Likewise, $N_{\mathrm{g,BayesFit}}$ is a good measure for $\nu$ for refinement
of analytical models against SAS data, as demonstrated here for the core-
multishell model refined against either simulated SAXS or simulated SANS data
(Fig. S2).

###  3.5 Information content for multiple datasets

The above methods were all developed for single datasets, and the information
content from multiple datasets of the same sample are not additive
[Pedersen2014-info]. An evident example to illustrate that point, is that a
repeated measurement of the same sample and with the same exposure time gives
two datasets with about the same values of $N_{\mathrm{s}}$, $N_{\mathrm{m}}$
and $N_{\mathrm{g,BIFT}}$, but the total information content is not twice that
of a single dataset, especially if each of the datasets have good signal-to-
noise ratios. In that case, the second dataset may only increase the total
information content slightly. The information gain can, however, be quantified
by investigating the change of the parameter values after simultaneous model
fitting against both datasets, using an entropy expression
[Pedersen2014-info]. This entropy measure may again be used to estimate the
information gain about a given parameter from refinement against one or more
datasets, e.g. when designing an experiment. In the present paper, it will be
shown that $N_{\mathrm{g,BayesFit}}$ can be used to estimate the information
gain from model refinement against multiple datasets, and that
$N_{\mathrm{g,BayesFit}}$ is also a good estimate of $\nu$ in this case.

##  4 Results

###  4.1 Setup for finding the best weighting scheme

When refining a model against multiple datasets, e.g. a SAXS and a SANS
dataset, a central question is how to weigh the datasets against each other.
The refinement is done by minimizing the weighted sum:

$\displaystyle\min\left[\sum_{j=1}^{N_{\mathrm{dataset}}}w_{j}\chi^{2}_{j}\right],$
(15)

where $\chi^{2}$ is defined in (5). The set of model parameter values that
minimize (15) are the optimal parameters. Assuming independent data points, we
reach that the sum of $\chi^{2}$ should be minimized with no additional
weighing, i.e., $w_{j}=1$. This is the first weighting scheme we will test.
However, equation (15) is a sum over the non-reduced $\chi^{2}$, so if the
first dataset contains, e.g., 1000 datapoints and the second dataset 100
points, then $\chi^{2}_{1}/\chi^{2}_{2}\sim 10$, given a good fit to data. To
counteract that the result is dominated by the larger dataset, one can use the
weight, $w_{j}=1/M_{j}$. This is the second weighting scheme that will be
tested. A third approach is to weigh by the information content, e.g.
$N_{\mathrm{g,BIFT}}$, after normalization by the number of points. That way,
the dataset with the highest information content also gets the highest weight,
i.e., $w_{j}=N_{\mathrm{g,BIFT},j}/M_{j}$. This is the third weighting scheme
that will be tested. The idea of utilizing the information content to give
correct weight to data has previously been applied to combine SAXS and
molecular dynamics simulations [Shevchuk2017].

In order to test which weighting scheme performs best, two datasets were
simulated for a sample of core-multishell particles. The particles had three
shells, so a total of four radii can be refined from the data. The true values
are 10, 30, 50 and 70 Å. The first dataset contained 400 datapoints with a
high signal-to-noise ratio, and the second dataset contained only 50
datapoints and a lower signal-to-noise ratio. These data mimic an experiment,
where the sample is measured with synchrotron SAXS and with SANS, and the core
and shells have different contrasts in SAXS and SANS (Fig. 2). The simulated
data were then fitted with the true model (i.e. the model that was used to
generate the simulated data), using weights $w_{j}=1$, $w_{j}=1/M_{j}$ or
$w_{j}=N_{\mathrm{g,BIFT},j}/M_{j}$. The model parameters were also refined
against only the SAXS data and only the SANS data. This was repeated 50,000
times ($n_{\mathrm{rep}}$) for each weighting scheme, to get a distribution of
refined parameter values. The best weighting scheme is the one that gives the
most accurate parameters values after refinement, i.e., closest to the true
value. For this paper, we will focus on refinement of the radii, and to
quantify the accuracy, we define the deviation from the true value as:

$\displaystyle\Delta
R=\sqrt{\frac{1}{n_{\mathrm{rep}}}\sum_{i=1}^{n_{\mathrm{rep}}}(R_{\mathrm{true}}-R_{\mathrm{refined},i})^{2}}.$
(16)

We note that, since the mean is not estimated, there are zero degrees of
freedom, and the denominator is therefore $n_{\mathrm{rep}}$ and not
$n_{\mathrm{rep}}-1$ as in the usual standard deviation.

###  4.2 Which weighting scheme is best?

The radius of the core ($R_{\mathrm{c}}$) was difficult to determine
accurately from the data, and the distribution of $R_{\mathrm{c}}$ after
refinement is bimodal (Fig. 2D). The three weighting schemes perform equally
well, with $\Delta R=1.7$ Å. This $\Delta R$ means that the refined values
were typically 1-2 Å from the true value, $R_{\mathrm{c}}=10$ Å. All weighting
schemes outperformed the refinement from either the SAXS or SANS data alone,
illustrating the usefulness of including multiple contrasts. The outer radius
of the first shell ($R_{1}$) was refined most accurately across the repeats
when using $w_{j}=1$, closely followed by $w_{j}=N_{\mathrm{g,BIFT},j}/M_{j}$,
whereas with weighting scheme $w_{j}=1/M_{j}$, the refined values were
generally further away from the true value (Fig. 2E). All weighting schemes
outperformed refinement from SAXS or SANS alone. Qualitatively, the results
are the same for the outer radius of the second shell ($R_{2}$): $w_{j}=1$
provides the most accurate values, followed by
$w_{j}=N_{\mathrm{g,BIFT,i}}/M_{j}$, which is better than $w_{j}=1/M_{j}$
(Fig. 2F). Again, all weighting schemes outperformed refinement against either
SAXS or SANS. For the outer radius of the third shell ($R_{3}$), the same
order is repeated, except that $w_{j}=1$ and
$w_{j}=N_{\mathrm{g,BIFT},j}/M_{j}$ resulted in equally accurate results (Fig.
2G).

Figure 2: Refinement of core-multishell model against simulated data, using
different weighting schemes, and 50,000 repeats. (A) Cross-section of core-
multishell particles with relative contrasts and radii annotated. (B)
Simulated SAXS data, containing 400 points. (C) Simulated SANS data containing
50 points. (D-G) Refined values of $R_{\mathrm{c}}$, $R_{1}$, $R_{\mathrm{2}}$
and $R_{3}$, using different weighting schemes and the resulting deviations
from the true value ($\Delta R$).

From these simulations, the immediate conclusion is that $w_{j}=1$ should be
used. But is that also true for a more extreme situation, where the SAXS data
consist of 2000 data points (instead of 400) and the SANS data still consists
of 50 datapoints (Fig3)? For $R_{\mathrm{c}}$, the weights $w_{j}=1$ still
gives the most accurate results (Fig. 3C), followed by
$w_{j}=N_{\mathrm{g,BIFT},j}/M_{j}$ and $w_{j}=1/M_{j}$, which performs
equally well. All three weighting schemes result in more accurate refined
values of $R_{c}$ compared to refinement against either SANS or SAXS data
alone. For $R_{1}$, the same order of accuracy is found, except for a notable
difference: the weights $w_{j}=1/M_{j}$ performs worse than refinement against
SAXS data alone (Fig. 3D). So a scientist using this weighting scheme risks
getting a worse refinement of the radius of the second shell after measuring
and including SANS data, compared to refinement against SAXS data alone. The
weighting scheme $w_{j}=1$ outperforms all other methods for $R_{2}$ (Fig3E).
The outer radius of the particle is determined equally well by each of the
three weighting schemes, and by the 2000-point SAXS data alone (Fig. 3F).

Figure 3: Model radii after refinement against simulated data, $50,000$
repeats. (A) Simulated SAXS data with 2000 points. (B) Simulated SANS data
with 50 points. (C) Distribution of refined values for the core radius
$R_{c}$. (D-F) Distribution for the outer radii of shell 1, shell 2, or shell
3.

In the above cases, one dataset contained more points than the other, but
which weighting scheme is best when $M_{1}=M_{2}$? To test this, SAXS and SANS
data, both containing 300 datapoints, were simulated (Fig. 4). In that case,
$w_{j}=1$ and $w=1/M_{j}$ represent the same weighting scheme, and has the
same minimum, so only one is reported. Interestingly, for $R_{\mathrm{c}}$,
$w_{j}=N_{\mathrm{g,BIFT},j}/M_{j}$ performs better than $w_{j}=1$. For
$R_{1}$ and $R_{2}$, $w_{j}=1$ performs best and for $R_{3}$, the weighting
schemes performs equally well. All weighting schemes provide more accurate
results than refinement against either SAXS or SANS data alone.

Figure 4: Model radii after refinement against simulated data, $50,000$
repeats. (A-B) Simulated SAXS and SANS data containing 300 points. (C-F)
Distribution of refined values of the core radius and the outer shell radii.

This analysis suggests that $w_{j}=1$ generally resulted in the most accurate
refinement, although all the simulated data were highly oversampled
($M>>N_{\mathrm{s}}$).

###  4.3 Over- or underestimated errors

Over- or underestimated errors in one dataset will give rise to erroneous
weights. To get a feeling for the effect of this, data were simulated again,
but this time, the errors of the SANS data were multiplied with a factor
between 0.1 and 10, after they had been simulated. I.e. the errors of the
simulated data ranged from highly underestimated (a factor of 0.1) to highly
overestimated (a factor of 10). The SAXS data were kept unchanged. The radii
of the model were determined from refinement against this data. Not
surprisingly, the radii are best determined when the errors are correct (Fig.
5). $R_{c}$ was rather accurately refined, although the errors of the SANS
data were underestimated, even with a factor 0.1. $\Delta R$ only increased
from 1.7 Å to 1.8 Å. On the other hand, if the errors on SANS data were
overestimated by a factor of 10, $\Delta R$ increased to 5.2 Å (Fig. 5B). For
$R_{1}$, over- and underestimation of errors in SANS data had similar effect
on the refined values, namely that $\Delta R$ increases from 1.8 Å to about 3
Å (Fig. 5C). For $R_{2}$, overestimation of the errors in SANS data had little
effect on the refined values of the radius, whereas underestimation led to
substantially worse refinement of $R_{2}$; when the errors were multiplied
with a factor 0.1 (highly underestimated), $\Delta R$ increased almost 5-fold
from 1.2 Å to 5.0 Å(Fig. 5D). Qualitatively, the results are similar for
$R_{3}$: overestimation of SANS errors has little effect on the refined
radius, but underestimation significantly worsens the accuracy, with $\Delta
R$ increasing from 0.1 Å to 0.6 Å(Fig. 5E). These results illustrate that
over- or underestimation of errors may lead to substantially worse estimates
of the refined model parameters. The effect depends on the contrast situation,
the signal-to-noise ratio of the datasets, and on the degree of over- or
underestimation. Therefore, errors should be assessed and, if possible,
corrected before model refinement against multiple data [Larsen2021-chi2].

Figure 5: Effect of over- or underestimated errors on parameter refinement.
(A) Simulated SANS data with over- or underestimated errors. (B-E) Radii of
the core-multishell model when refined against SAXS and SANS data, where the
errors of the SANS data were over- or underestimated by a factor between 0.1
(highly underestimated) to 10 (highly overestimated).

###  4.4 Inclusion of priors

Priors can be included in model refinement against a single SAS dataset
[Larsen2018-BayesFit], and it has been shown that inclusion of Gaussian priors
improves the robustness of the refinement, in particular for noisy data, as
well as the error estimates of the refined parameters. For this paper,
BayesFit was reimplemented in Python and extended to be able to fit multiple
datasets simultaneously (Methods). BayesFit minimizes the sum:

$\displaystyle\min\left[\left(\sum_{j=1}^{N_{\mathrm{dataset}}}\chi^{2}_{j}\right)+\alpha
S\right],$ (17)

where $S$ represents the prior, and $\alpha$ is a regularization parameter,
which is determined uniquely and automatically [Hansen2000,
Larsen2018-BayesFit] by the program. Higher $\alpha$ gives more weight to the
prior.

To assess the effect of priors, SAXS and SANS data of core-multishell
particles were simulated, and refined using different priors, denoted (i)
uniform prior, (ii) poor prior, (iii) good prior, and (iv) best prior (Table
1). The latter three are Gaussian priors. In conventional model refinement, no
prior is applied to the parameters. However, in most programs, the user may
set a minimum and a maximum value for each parameter, e.g. to prevent negative
values for geometrical parameters or to guide the mnmimization algorithm away
from unrealistic values [Kohlbrecher2022-SASfit, Ilavsky2009-Irena]. This is
equivalent to using uniform priors for the parameters. Alternatively, a
Gaussian prior may be applied for each parameter. A Gaussian prior is defined
by a mean $\mu_{\mathrm{prior}}$ and a standard deviation
$\sigma_{\mathrm{prior}}$, which may stem from a previous measurement or from
physical knowledge about the system. An example is a concentration
measurement, which provides a mean and an experimental error. Another example
is knowledge about the approximate size or polydispersity of a given particle,
e.g. from a light scattering experiment or electron microscopy. Such knowledge
can also be expressed in terms of a mean and a standard deviation
[Larsen2018-BayesFit], and can in many cases be assumed to be normal
distributed, due to the central limit theorem. The question is then: is model
refinement improved by inclusion of priors, and if yes, how good should the
prior be in order to improve the fit? In order to answer these questions, we
will compare the Gaussian priors with a non-informative uniform prior. The fit
with the uniform prior had the true values as the starting values in the fit.
The minimum and maximum limits were defined as $\pm 5\sigma_{\mathrm{best}}$,
where $\sigma_{\mathrm{best}}$ are the standard deviations of the best prior
(Table 1). The algorithm also constrained the radii to only take positive
values.

The estimate of $R_{\mathrm{c}}$ was substantially improved by all tested
Gaussian priors compared to the uniform prior (Fig. 6A). Interestingly, the
refined value of $R_{\mathrm{c}}$ was dramatically improved also when using
the poor prior with $\mu_{\mathrm{poor,R0}}=5$ Å and
$\sigma_{\mathrm{poor,R0}}=5$ Å (True value is $R_{\mathrm{c}}=10$ Å). Using
the poor prior in the refinement, the average deviation decreased from $\Delta
R=2.0$ Å when using the uniform prior to 0.9 Å when applying the poor Gaussian
prior. The best prior, resulted in a very narrow distribution of refined
values $\Delta R=0.9$ Å, although the prior width was much wider,
$\sigma_{\mathrm{best,R0}}=5$ Å (Fig. S3).

Figure 6: Radii of the core-multishell model were refined against SAXS and
SANS data, using a uniform prior (red), a poor Gaussian prior (light blue), a
good Gaussian prior (dark blue) or the best Gaussian prior (black). The
probability distributions were normalized, such that their maximum value is
unity, for easier comparison

The results are basically the same for $R_{1}$, i.e., the Gaussian priors
increase the accuracy of the model refinement substantially compared to the
uniform prior. For $R_{2}$, the result is qualitatively the same, although the
improvements by the poor and good priors are less prominent compared to the
uniform prior. For $R_{3}$, the Gaussian priors do not improve or worsens the
posterior estimate much, as this parameter is both accurately and precisely
defined by the data. Generally, the better a parameter is determined from data
itself, the smaller is the effect of the prior, whereas when a parameter is
ill-determined by the data, then the prior dramatically improves the fit
[Larsen2018-BayesFit]. Notably, the priors do not worsen the refined
parameters, even when being relatively poor (Fig. 6).

How narrow should the limits of the uniform prior be, to obtain as good
results as the Gaussian priors? To investigate this, the refinement was
repeated for all simulated data with priors having the upper and lower limits
set to values between $\mu_{\mathrm{best},k}\pm 0.5\sigma_{\mathrm{best},k}$
and $\mu_{\mathrm{best},k}\pm 5$ $\sigma_{\mathrm{best},k}$, where
$\mu_{\mathrm{best},k}$ and $\sigma_{\mathrm{best},k}$ are mean and standard
deviation of the best Gaussian prior (Table 1). Even with the narrowest window
for the uniform prior, i.e. when the algorithm was allowed to deviate only
$0.5\sigma_{\mathrm{best},k}$ from $\mu_{\mathrm{best},k}$, then the deviation
from the true value after refinement was still substantially larger than the
refined parameters obtained by the best prior (Fig. S4). A remarkable result
is, that the poor prior resulted in smaller deviation from the true values of
all the radii compared to the uniform priors with minimum and maximum values
at $\pm 1$ $\sigma_{\mathrm{best}}$. For $R_{2}$ and $R_{3}$, the poor
Gaussian prior even outperformed the most informative uniform prior, with
minimum and maximum values set to $\mu_{\mathrm{best},k}\pm 0.5$
$\sigma_{\mathrm{best},k}$ (Fig. S4). This illustrates that Gaussian priors
are much better than conventional uniform priors at stabilizing and guiding
the minimization algorithm towards the correct solution.

###  4.5 Information content from multiple datasets

In this section, we will discuss the information content from multiple
datasets. Given the fit to $N_{\mathrm{dataset}}$ datasets, the total
$\chi^{2}_{\mathrm{tot}}$ is simply given as the sum:

$\displaystyle\chi^{2}_{\mathrm{tot}}=\sum_{j=1}^{N_{\mathrm{dataset}}}\chi^{2}_{j}.$
(18)

Therefore, we can apply equation (13) to calculate the number of good
parameters determined from a simultaneous fit against multiple data, where
$\lambda_{i}$ is the $i^{\mathrm{th}}$ eigenvalue of the normalized gradient
matrix of $\chi^{2}_{\mathrm{tot}}$. $N_{\mathrm{g,BayesFit}}$ reflects how
much is learned, i.e., better data will increase $N_{\mathrm{g,BayesFit}}$, as
will a less accurate or less precise prior. For example, the average values of
$N_{\mathrm{g,BayesFit}}$ for the non-informative uniform prior is 14.0, i.e.
equal to the number of model parameters, whereas $N_{\mathrm{g,BayesFit}}=9.7$
for the poor prior, 8.8 for the good prior and only 3.2 for the best prior
(prior values in Table 1 and 2), which reflects how much is learned from doing
the refinement of the model. If more is known beforehand, less is learned.

Table 1: True values and prior values for the radii of the model. For the uniform priors, the first number is the initial value used in the fit, and the next numbers are the lower and upper limits. For the Gaussian priors, the mean and standard deviation are given along with the upper and lower limits, which are $\mu\pm 5\sigma$, or zero for the lower limit. Prior name |  $R_{\mathrm{c}}$ (min,max) [Å] |  $R_{1}$ (min,max) [Å] |  $R_{2}$ (min,max) [Å] |  $R_{3}$ (min,max) [Å]
---|---|---|---|---
True value | 10 | 30 | 50 | 70
Uniform5σ |  $10$ (0,35) | 30 (0,80) | 50 (0,125) | 70 (0,170)
Uniform4σ |  $10$ (0,30) | 30 (0,70) | 50 (0,110) | 70 (0,150)
Uniform3σ |  $10$ (0,25) | 30 (0,60) | 50 (5,95) | 70 (10,130)
Uniform2σ |  $10$ (0,20) | 30 (10,50) | 50 (20,80) | 70 (30,110)
Uniform1σ |  $10$ (5,15) | 30 (20,40) | 50 (35,65) | 70 (50,90)
Uniform${}_{\frac{1}{2}\sigma}$ |  $10$ (7.5,12.5) | 30 (25,35) | 50 (40,55) | 70 (60,80)
Gaussianpoor |  $5\pm 5$ (0,30) |  $40\pm 10$ (0,90) |  $45\pm 15$ (0,120) |  $90\pm 20$ (0,190)
Gaussiangood |  $8\pm 4$ (0,28) |  $35\pm 10$ (0,85) |  $40\pm 20$ (0,140) |  $80\pm 10$ (30,130)
Gaussianbest |  $10\pm 5$ (0,35) |  $30\pm 10$ (0,80) |  $50\pm 15$ (0,125) |  $70\pm 20$ 70 (0,170)
Table 2: Prior values of model parameters (except the radii who are listed in Table 1). The Gaussian priors (Poor, Good and Best) are defined by $\mu$ and $\sigma$, and the Gaussian priors have the same values for all parameters but the radii. In addition, upper and lower limits were set at $\mu\pm 5\sigma$. The uniform priors used $\mu$ from the best Gaussian prior as the initial guess in the fit, and $\mu\pm X\sigma$ as upper and lower limits, where $X$ is either ½, 1, 2, 3, 4 or 5.  Parameter | True value | $\mu\pm\sigma$ | ($\mu-5\sigma,\mu+5\sigma$)
---|---|---|---
$(\frac{\Delta\rho_{1}}{\Delta\rho_{\mathrm{c}}})_{\mathrm{SAXS}}$ | 2 | $2.0\pm 0.2$ | $(1.0,3.0)$
$(\frac{\Delta\rho_{1}}{\Delta\rho_{\mathrm{c}}})_{\mathrm{SANS}}$ | -0.1 | $-0.10\pm 0.01$ | $(-0.15,-0.05)$
$(\frac{\Delta\rho_{2}}{\Delta\rho_{\mathrm{c}}})_{\mathrm{SAXS}}$ | 3 | $3\pm 3$ | $(1.5,4.5)$
$(\frac{\Delta\rho_{2}}{\Delta\rho_{\mathrm{c}}})_{\mathrm{SANS}}$ | 0.1 | $0.10\pm 0.01$ | $(0.05,0.15)$
$(\frac{\Delta\rho_{3}}{\Delta\rho_{\mathrm{c}}})_{\mathrm{SAXS}}$ | 4 | $4.0\pm 0.4$ | $(2.0,6.0)$
$(\frac{\Delta\rho_{3}}{\Delta\rho_{\mathrm{c}}})_{\mathrm{SANS}}$ | 0.05 | $0.050\pm 0.005$ | $(0.025,0.075)$
$a_{\mathrm{SAXS}}$ [cm-1] | 0.5 | $0.50\pm 0.05$ | $(0.25,0.75)$
$a_{\mathrm{SANS}}$ [cm-1] | 0.8 | $0.80\pm 0.08$ | $(0.1,0.9)$
$b_{\mathrm{SAXS}}$ [$10^{-4}$ cm-1] | 0.1 | $0.1\pm 100$ | $(-500,500)$
$b_{\mathrm{SANS}}$ [$10^{-4}$ cm-1] | 1.0 | $1.0\pm 100$ | $(-499,501)$

###  4.6 Degrees of freedom from multiple datasets, used to estimate the
goodness of fit for each dataset

We have previously established that $\nu$ can be accurately determined by
$N_{\mathrm{g}}$ in $\chi^{2}_{\mathrm{r}}$ (equation (14)) for a single
dataset [Larsen2021-chi2]. That is also the case for fitting against multiple
datasets, no matter what prior is selected, which is showcased here with the
core-multishell example (Fig. 7).

Figure 7: Distributions for $\chi^{2}_{\mathrm{r}}$ using $M-K$ (red),
$M-N_{\mathrm{g}}$ (gray) or $M$ (blue) as the degrees of freedom and the
theoretical distribution (black dashed line). Average values should
theoretically be unity. (A) Refinement with the non-informative uniform prior.
$N_{\mathrm{g}}=K=14$, so the $\chi^{2}_{\mathrm{r}}$-distribution for $\nu=K$
and $\nu=N_{\mathrm{g}}$ are identical. (B) refinement with the poor Gaussian
prior. (C) Refinement with the good Gaussian prior. (D) Refinement with the
best Gaussian prior.

When fitting multiple datasets, it is also relevant to monitor the goodness of
fit to each of the datasets, e.g., how well does the model fit, respectively,
the SAXS and SANS data. In other words, what are $\chi^{2}_{\mathrm{r,SAXS}}$
and $\chi^{2}_{\mathrm{r,SANS}}$. The non-reduced quantities,
$\chi^{2}_{\mathrm{SAXS}}$ and $\chi^{2}_{\mathrm{SANS}}$, can readily be
calculated, but in order to calculate the reduced values, one must determine
$\nu_{\mathrm{SAXS}}$ and $\nu_{\mathrm{SANS}}$, respectively. A first
approximation is to use the conventional $\nu=K$, i.e. the number of
parameters in the model. Another option is to use $N_{\mathrm{g}}$ of the fit,
i.e. $N_{\mathrm{g,SAXS+SANS}}$, but both of these will overestimate
$\nu_{\mathrm{SAXS}}$ and $\nu_{\mathrm{SANS}}$. E.g., the scaling used to fit
the SAXS data does not give any freedom with respect to fitting the SANS data,
so this should not be counted into $\nu_{\mathrm{SANS}}$. Instead, we must
estimate $\nu_{j}=N_{\mathrm{g},j}$. First step is to apply equation (13) for
each dataset, using the gradient matrices of, respectively,
$\chi^{2}_{\mathrm{SAXS}}$ and $\chi^{2}_{\mathrm{SANS}}$. For the SAXS data,
we get:

$\displaystyle n_{\mathrm{SAXS}}$
$\displaystyle=\sum_{i=1}^{K}\frac{\lambda_{\mathrm{SAXS},i}}{\alpha+\lambda_{\mathrm{SAXS},i}}.$
(19)

The sum is over all model parameters, e.g. for the core-multishell, $K=14$.
However, the parameters that have no effect on the fit do not contribute to
the sum (e.g. SANS scaling on the SAXS fit). The next step is to take shared
parameters into account, because the SAXS and the SANS data contain
information about the same parameters. Consequently, equation (13) will
slightly overestimate the information content-contribution from each set of
data. To circumvent this, we require that the sum of information content from
each dataset equals the total information content:

$\displaystyle N_{\mathrm{g,SAXS}}+N_{\mathrm{g,SANS}}=N_{\mathrm{g}}.$ (20)

The shared information content is
$N_{\mathrm{share}}=n_{\mathrm{SAXS}}+n_{\mathrm{SANS}}-N_{\mathrm{g}}$, and
the requirement is fulfilled if:

$\displaystyle
N_{\mathrm{g,SAXS}}=n_{\mathrm{SAXS}}-\left(\frac{n_{\mathrm{SANS}}}{n_{\mathrm{SANS}}+n_{\mathrm{SAXS}}}\right)N_{\mathrm{share}}.$
(21)

The second term subtracts a fraction of the shared information content to
fulfill the requirement of equation (20). The information is here distributed
proportinal to the relative information content. Thus, we can use
$\nu_{\mathrm{SAXS}}=N_{\mathrm{g,SAXS}}$ when calculating the goodness of fit
(equation (14)) with respect to each dataset in a simultaneous fit. We note
that the above can be generalized to any number of datasets:

$\displaystyle n_{j}$
$\displaystyle=\sum_{i=1}^{K}\frac{\lambda_{j,i}}{\alpha+\lambda_{j,i}}$
$\displaystyle n_{\Sigma}$
$\displaystyle=\sum_{j=1}^{N_{\mathrm{dataset}}}n_{j}$ (22) $\displaystyle
N_{\mathrm{g},j}$
$\displaystyle=n_{j}-\left(\frac{n_{\Sigma}-n_{j}}{n_{\Sigma}}\right)\left(n_{\Sigma}-N_{\mathrm{g}}\right).$
(23)

To assess whether this is indeed a good measure for $\nu$ for each dataset,
the goodness of fit was monitored for the refinement of the core-multishell
model against simulated SAXS and SANS data. The usual priors were used, and
$\chi^{2}_{\mathrm{r,SAXS}}$ and $\chi^{2}_{\mathrm{r,SANS}}$ were calculated
using either $\nu_{j}=K$, $\nu_{j}=N_{\mathrm{g}}$,
$\nu_{j}=N_{\mathrm{g},j}$, $\nu_{j}=n_{j}$, or $\nu_{j}=0$. For the SAXS
data, where the number of datapoints is much larger than the information
content, $M_{\mathrm{SAXS}}=400\gg N_{\mathrm{g,SAXS}}$, the choice of $\nu$
makes no substantial difference (Fig. 8). But the theoretical distribution for
$\chi^{2}_{\mathrm{r}}$ is, nonetheless, best reproduced using either
$\nu_{j}=N_{\mathrm{g},j}$ or $\nu_{j}=n_{j}$. For the SANS data, where
$M_{\mathrm{SANS}}=50$ is comparable to the information content, the
differences are more prominent. Generally, the theoretical distribution for
$\chi^{2}_{r}$ are best reproduced using $\nu_{j}=N_{\mathrm{g},j}$, although
the mean values are systematically a bit overestimated. So there is room for
improvement, but as we are already splitting hairs, we will use this
expression.

Figure 8: Distribution of $\chi^{2}_{r}$ for SAXS (left) and SANS (right),
after refinement against both SAXS and SANS data. Different values for the
degrees of freedom were used (full lines). The theoretical distribution with
mean of unity shown (black dashed line). Fitted using either the non-
informative uniform prior (A-B), the poor Gaussian prior (C-D), the good
Gaussian prior (E-F), or the best Gaussian prior (G-H)

.

###  4.7 Information content about specific parameters: Kullback-Leibler
divergence

$N_{\mathrm{g,BIFT}}$ is useful for examining the overall information content,
but does not tell what parameters we gain information about. In order to
examine this, we can probe the information gain for each parameter, as
suggested previously [Pedersen2014-info]. The difference between the prior and
the posterior distribution can be quantified using the Kullback-Leibler
divergence ($D_{\mathrm{KL}}$), which is also called the relative entropy or
information gain:

$\displaystyle
D_{\mathrm{KL,k}}(P|Q)=\int_{-\infty}^{\infty}P_{\mathrm{post}}(p_{k})\log\left(\frac{P_{\mathrm{post}}(p_{k})}{Q_{\mathrm{prior}}(p_{k})}\right)dp_{k},$
(24)

where $P_{\mathrm{post}}(p_{k})$ and $Q_{\mathrm{prior}}(p_{k})$ are the
posterior and prior probability distributions for the $k^{th}$ model parameter
($p_{k}$).

As an example, we will use $D_{\mathrm{KL}}$ to examine the information gain
about the radii when refining the core-multishell model against SAXS data
alone, SANS data alone and the combination (Table 3). Not surprisingly, the
information gain is largest when both datasets are used. Generally, the SANS
data contains most information about $R_{\mathrm{c}}$, whereas SAXS and SANS
contribute equally to the refinement of $R_{1}$. Most of the information about
$R_{2}$ and $R_{3}$ comes from the SAXS data. This reflects the contrast
situation and the signal-to-noise ratios of data (Fig. 2). Notably, for
$R_{3}$, the information gain from SAXS is the same as the information gain
from SAXS and SANS together, so the information contribution from the SANS
data about $R_{3}$ is negligible. The information gain depends strongly on the
priors. The prior information provided by the user increases as we go from the
non-informative uniform prior, to the poor and good Gaussian priors.
Therefore, the total information gain from model refinement against data
decreases. This is because more was known beforehand, so less is learned.
However, the information gain about the model radii is larger when using the
best prior, compared to the poor or good prior. This is the opposite
conclusion to what was observed for $N_{\mathrm{g}}$, where the better priors
always resulted in smaller values of $N_{\mathrm{g}}$. There are two
contributions to $D_{\mathrm{KL}}$ for normal distributions: change of the
mean and narrowing the width of the posterior distribution compared to the
prior. As the mean is barely changed when using the best prior, the large
$D_{\mathrm{KL}}$ stems from the exceptionally narrow width of the posterior
distributions for the radii when refining with the best prior, as compared to
wider posterior distributions obtained with the poor or good Gaussian priors
(Fig. 6 and Fig. S3). Moreover, when using the best prior for refinement, then
SAXS data contribute more than SANS data in the refinement of
$R_{\mathrm{c}}$, although $R_{\mathrm{c}}$ is mainly estimated from the SANS
data when using the uniform, or the poor or good Gaussian priors.

Table 3: Kullback-Leibler divergence (in units of bit) for the model radii, using the poor, good and best prior. | $D_{\mathrm{KL,SAXS}}$ | $D_{\mathrm{KL,SANS}}$ | $D_{\mathrm{KL,SAXS+SANS}}$
---|---|---|---
uniform prior |  |  |
$R_{\mathrm{c}}$ | 10.6 | 11.4 | 11.8
$R_{\mathrm{1}}$ | 13.0 | 11.6 | 13.7
$R_{\mathrm{2}}$ | 14.0 | 10.9 | 14.3
$R_{\mathrm{3}}$ | 17.3 | 12.5 | 17.4
Total | 55.0 | 46.4 | 57.1
poor prior |  |  |
$R_{\mathrm{c}}$ | 0.5 | 2.3 | 2.6
$R_{\mathrm{1}}$ | 2.5 | 2.8 | 3.2
$R_{\mathrm{2}}$ | 2.9 | 0.9 | 3.1
$R_{\mathrm{3}}$ | 7.1 | 3.2 | 7.1
Total | 13.1 | 9.3 | 16.1
good prior |  |  |
$R_{\mathrm{c}}$ | 0.6 | 1.7 | 2.0
$R_{\mathrm{1}}$ | 2.1 | 2.4 | 2.9
$R_{\mathrm{2}}$ | 3.5 | 1.4 | 3.7
$R_{\mathrm{3}}$ | 6.6 | 3.0 | 6.6
Total | 12.8 | 8.6 | 15.1
best prior |  |  |
$R_{\mathrm{c}}$ | 3.8 | 2.9 | 4.4
$R_{\mathrm{1}}$ | 4.1 | 3.1 | 4.6
$R_{\mathrm{2}}$ | 4.3 | 2.5 | 4.6
$R_{\mathrm{3}}$ | 6.9 | 3.6 | 7.0
Total | 19.2 | 12.1 | 20.6

##  5 Discussion

###  5.1 Why is the model refinement not always dominated by the dataset with
many datapoints?

As we saw for simulated data, even when one dataset had 2000 data points and
the other only 50 datapoints, the refined parameters were still affected by
both datasets. This is because that data may contain orthogonal information. A
simple thought example is a situation where two layers/structural domains have
exactly the same contrast in SAXS, but different contrasts in SANS. In that
situation, only the SANS data can provide information about the limits between
these structural domains. This could, e.g. be two layers in a core-multishell
particle. Albeit the SAXS data in the thought example may have far more points
and much better signal-to-noise ratio, the information about the borders
between these layer can only come from the SANS data. The less extreme example
is when the contrast is low in SAXS and high in SANS, vice versa. Therefore,
an additional dataset may contain a lot of structural information albeit
having a relatively low signal-to-noise ratio, if the information content is
orthogonal with respect to the information content of the first dataset. On
the other hand, if the contrast situation is similar in multiple small-angle
scattering datasets that are simultaneously fitted, then the refined
parameters will be dominated by the dataset having the better signal-to-noise
ratio [Pedersen2014-info, Larsen2020-tia1, Larsen2021-chi2], which should be
taken into account in experimental design.

The fact that the data points are statistically independent means that no
additional weighting is necessary, i.e., $w_{j}=1$ leads to the most accurate
result. This was demonstrated here for simulated data. But can statistical
dependency come from smearing effects, which are not included in the
simulations? Resolution effects mean that photons (or neutrons) measured in
different bins may stem from the same scattering event, e.g. from the same
Bragg reflection. Intuitively, that sounds like statistical dependence:
adjacent bins have information about the same structural feature. However, as
long as resolution effects are included in the model, then this will not
violate the assumption about statistical independence. The two bins are still
independent sampling points of the underlying model. The same goes for, e.g.,
polydispersity or other types of smearing effects.

###  5.2 When experimental errors are ill-defined

We have seen that error estimates are important for getting the correct weight
between multiple datasets, when doing model refinement (Fig. 5). A simple
method has previously been presented to identify, and in some cases, correct
over- or underestimated errors [Larsen2021-chi2]. However, this is far from
sufficient, and in particular, there is only limited work on how to identify
systematic errors, e.g., from non-optimal buffer subtraction or from errors in
the way the theoretical curve is calculated [Shevchuk2017]. This becomes
particularly important when high flux, long exposure times, and stable samples
at high concentrations allow the statistical errors from counting statistics
to be minimized to a level, where the fluctuations in data are dominated by
other error sources, which are not accounted for in the reported experimental
errors. Goodness of fit measures that exploit runs tests do not depend on
statistical errors and are therefore valuable tools in that context
[Franke2015, Kofinger2021].

###  5.3 SAXS contrast variation

Throughout this paper, we have considered a combination of a SAXS and a SANS
dataset. However, several SANS contrast could as well be considered, and
contrast variation can also be done in SAXS, by adding electron-dense solutes
to the buffer, although changes to the sample must be carefully considered
[Gabel2019]. Likewise, when doing SANS contrast variation, one must consider
whether deuteration of particle or solvent affects the sample structure. That
is out of scope for the present paper, but has been investigated by others
[Efimova2006].

###  5.4 Rebinning of SAS data

It has been proposed to use the information content as a guide to what extent
data should be rebinned [Pedersen2014-info]. Here, I argue that oversampling
is not problematic per se. On the contrary, oversampling can lead to increased
information content that may in principle exceed $N_{\mathrm{s}}$
[Konarev2015, Vestergaard2006] (Fig. 1). Since oversampling, as it is done in
SAS, does not lead to violation of the assumption of statistically independent
data points, this should not be the motivation for rebinning data. However,
there are other good reasons for rebinning of data, including: (i) rebinning
reduces computational cost in the data analysis, by reducing the number of
points; (ii) rebinning improves visual assessment of the data quality and of
the goodness of fit; (iii) rebinning is necessary to achieve proper sampling
at each $q$-value, i.e. obtain a good estimates of the mean values in each
bin. Therefore, as a rule of thumb, the fewer the counts, the larger the bins
should be. For the same reasons, it may be a good idea to do logarithmic
binning of data, such that bins are larger at higher $q$-values, where the
signal is lower. If each bin is not sampled enough, the data become too easy
to fit, as the mean intensity at each $q$-value is poorly determined by data.
On the other hand, if the bin size becomes too large, it may lead to smearing
of sharp features such as peaks from Bragg reflections.

###  5.5 Information content - what is it good for?

We have reviewed and discussed different measures of information content. The
number of Shannon channels ($N_{\mathrm{s}}$), the number of Shanum channels
($N_{\mathrm{m}}$) and the good parameters (from IFT, $N_{\mathrm{g,BIFT}}$)
all provide good estimates of the maximum number of independent parameters
that can retrieved from data. These measures are only valid for a single
dataset. $N_{\mathrm{m}}$ and $N_{\mathrm{g,BIFT}}$ are superior to
$N_{\mathrm{s}}$ as they take into account the noise level in data, and
$N_{\mathrm{s}}$ can be considered a practical upper limit for
$N_{\mathrm{m}}$ and $N_{\mathrm{g,BIFT}}$. The number of good parameters can
be used to accurately estimate the degrees of freedom, and thereby the
goodness of fit, using $\chi^{2}_{r}$. This is both the case when doing IFT,
and when doing model refinement of geometric models against one or several
datasets. The Kullback-Leibler divergence, on the other hand, provide a good
measure for the information gain about selected parameters. It may also be
used to examine the information gain from each contrast, when refining a model
against multiple datasets. As previously demonstrated, such entropy measure
may be used when designing an experiment [Pedersen2014-info].

##  6 Conclusion

There are four main findings of this paper.

Firstly, we addressed the challenge of simultaneously fitting SAXS and SANS
data, in particular when the number of points in the SAXS data drastically
outhumbered the number of SANS datapoints. It was argued that the most optimal
weighting scheme for simultaneous fitting of multiple datasets is simply
$w_{j}=1$, i.e. the sum of (the non-reduced) $\chi^{2}$ values should be
minimized, as $w_{j}=1$ leads to the most accurate refined structural
parameters. This was compared to normalization by the number of points
($w_{j}=1/M_{j}$) or weighting with the information content
($w_{j}=N_{\mathrm{g},j}/M_{j}$).

Secondly, we investigated the most optimal method of including prior
knowledge, and compared Gaussina priors with commonly used uniform priors. It
was demonstrated that inclusion of Gaussian priors gives more accurate
refinement of structural parameters than the conventional use of uniform
priors. Uniform priors allow the parameter to take any value in a given
interval with equally likely probability, whereas Gaussian priors guide the
refined parameters towards a prior mean. Even poor priors were superior to
uniform priors, as prior did not prevent the refined parameters to reach the
accurate values, despite being different from the prior estimates.

Thirdly, different measures for the information content in data were compared.
It was demonstrated that the number of good parameters ($N_{\mathrm{g,BIFT}}$)
and the number of Shanum channels ($N_{\mathrm{m}}$) are superior estimates of
the information content in a given dataset compared to he number of Shannon
channels ($N_{\mathrm{s}}$), since $N_{\mathrm{g}}$ and $N_{\mathrm{m}}$ take
the signal-to-noise ratio of data into account. Both measures can be used to
estimate an upper limit for how many independent parameters that can be
retrieved from data. In order to estimate the information content about
individual parameters, an entropy measure may be used (equation (24)), as
previously suggested [Pedersen2014-info].

Finally, we explored potential applications of the information content. We
found that $N_{\mathrm{g}}$ is a very good estimate of the degrees of freedom
in a model ($\nu\approx N_{\mathrm{g}}$), which is used to estimate the
goodness of fit, $\chi^{2}_{\mathrm{r}}=\chi^{2}/(M-\nu)$ (equations (5) and
(14)). An accurate determination of $\nu$ is only important when the number of
datapoints is not much larger than the information content, because if $M\gg
N_{\mathrm{g}}$ then $M-N_{\mathrm{g}}\sim M$. In simultaneous fitting of SAXS
and SANS data, a total $N_{\mathrm{g}}$ can be determined for all data or for
each dataset individually (equations (20) and (21)), and a method for doing
the latter was outlined.

Using the optimal weighing and priors, as suggested here, allow for more
accurate refinement of structural parameters from a combination of several SAS
datasets. The principles established for accurate SAS data analysis in this
study can readily be extended to other types of ordered data, notably
reflectometry data, where multiple contrasts are often fitted simultaneously.
Bayesian refinement has already been suggested as an optimal analysis strategy
in reflectometry [McCluskey2020].

Implementing optimal strategies for data analysis, as proposed in this study,
stands as a pragmatic approach to enhance accuracy of structural refinements.
These strategies require minimal resources compared to the immense work that
is needed to prepare samples and maintain SAXS and SANS instruments. Still,
they offer substrantial improvement in the accuracy of the refined parameters.

##  7 Acknowledgements

The author would like to thank Martin Cramer Pedersen, Lise Arleth, Steen
Hansen, Brian Pauw, and Jochen Hub for valuable discussions. The project was
funded by the Carlsberg Foundation (grant CF19-0288) and the Lundbeck
Foundation (grant R347-2020-2339).

## References

  * [1] [Damaschun _et al._]Damaschun, Müller Pürschel1968Damaschun1968 Damaschun, G., Müller, J. J. Pürschel, H.-V. 1968\.  _Monatshefte for Chemie_ , 99, 2343–2348.
  * [2] [Efimova _et al._]Efimova, Hemers, Wierczinski, Norde van Well2007Efimova2006 Efimova, Y. M., Hemers, S., Wierczinski, B., Norde, W. van Well, A. A. 2007.  _Biopolymers_ , 85(3), 264–273.
  * [3] [Franke _et al._]Franke, Jeffries Svergun2015Franke2015 Franke, D., Jeffries, C. M. Svergun, D. I. 2015.  _Nature Methods_ , 12(5), 419–422.
  * [4] [Gabel _et al._]Gabel, Engilberge, Pérez Girard2019Gabel2019 Gabel, F., Engilberge, S., Pérez, J. Girard, E. 2019\.  _IUCrJ_ , 6, 521–525.
  * [5] Glatter1977Glatter1977 Glatter, O. 1977.  _Journal of Applied Crystallography_ , 10, 415–421.
  * [6] Gull1989Gull1989 Gull, S. F. 1989.  In _Maximum Entropy and Bayesian Methods_ , edited by J. Skilling, pp. 53–71. Kluwer Acedemic Publishers.
  * [7] Hansen2000Hansen2000 Hansen, S. 2000.  _Journal of Applied Crystallography_ , 33, 1415–1421.
  * [8] Hansen2012Hansen2012 Hansen, S. 2012.  _Journal of Applied Crystallography_ , 45, 566–567.
  * [9] [Harris _et al._]Harris, Millman, van der Walt, Gommers, Virtanen, Cournapeau, Wieser, Taylor, Berg, Smith, Kern, Picus, Hoyer, van Kerkwijk, Brett, Haldane, del Río, Wiebe, Peterson, Gérard-Marchant, Sheppard, Reddy, Weckesser, Abbasi, Gohlke Oliphant2020Harris2020-numpy Harris, C. R., Millman, K. J., van der Walt, S. J., Gommers, R., Virtanen, P., Cournapeau, D., Wieser, E., Taylor, J., Berg, S., Smith, N. J., Kern, R., Picus, M., Hoyer, S., van Kerkwijk, M. H., Brett, M., Haldane, A., del Río, J. F., Wiebe, M., Peterson, P., Gérard-Marchant, P., Sheppard, K., Reddy, T., Weckesser, W., Abbasi, H., Gohlke, C. Oliphant, T. E. 2020.  _Nature_ , 585(7825), 357–362.
  * [10] [Headd _et al._]Headd, Echols, Afonine, Grosse-Kunstleve, Chen, Moriarty, Richardson, Richardson Adams2012Headd2012-Phenix Headd, J. J., Echols, N., Afonine, P. V., Grosse-Kunstleve, R. W., Chen, V. B., Moriarty, N. W., Richardson, D. C., Richardson, J. S. Adams, P. D. 2012.  _Acta Crystallographica Section D: Biological Crystallography_ , 68(4), 381–390.
  * [11] [Heftberger _et al._]Heftberger, Kollmitzer, Heberle, Pan, Rappolt, Amenitsch, Kučerka, Katsaras Pabst2014Heftberger2013 Heftberger, P., Kollmitzer, B., Heberle, F. A., Pan, J., Rappolt, M., Amenitsch, H., Kučerka, N., Katsaras, J. Pabst, G. 2014\.  _Journal of Applied Crystallography_ , 47(1), 173–180.
  * [12] Heller2010Heller2010 Heller, W. T. 2010.  _Acta Crystallographica Section D Biological Crystallography_ , D66, 1213–1217.
  * [13] [Hollamby _et al._]Hollamby, Aratsu, Pauw, Rogers, Smith, Yamauchi, Lin Yagai2016Hollamby2016 Hollamby, M. J., Aratsu, K., Pauw, B. R., Rogers, S. E., Smith, A. J., Yamauchi, M., Lin, X. Yagai, S. 2016.  _Angewandte Chemie_ , 55(34), 9890–9893.
  * [14] Hummer Köfinger2015Hummer2015 Hummer, G. Köfinger, J. 2015.  _Journal of Chemical Physics_ , 143(24).
  * [15] Ilavsky Jemian2009Ilavsky2009-Irena Ilavsky, J. Jemian, P. R. 2009.  _Journal of Applied Crystallography_ , 42(2), 347–353.
  * [16] [Koefinger _et al._]Koefinger, Hummer Köfinger2021Kofinger2021 Koefinger, J., Hummer, G. Köfinger, J. 2021.  _ChemRxiv_ , p. DOI: 10.26434/chemrxiv.13373351.v2.
  * [17] [Kohlbrecher _et al._]Kohlbrecher, Breßler Barty2022Kohlbrecher2022-SASfit Kohlbrecher, J., Breßler, I. Barty, A. 2022.  _Journal of Applied Crystallography_ , 55, 1677–1688.
  * [18] Konarev Svergun2015Konarev2015 Konarev, P. V. Svergun, D. I. 2015.  _IUCrJ_ , 2, 352–360.
  * [19] [Kynde _et al._]Kynde, Skar-Gislinge, Pedersen, Midtgaard, Simonsen, Schweins, Mortensen Arleth2014Kynde2014-bR Kynde, S. A., Skar-Gislinge, N., Pedersen, M. C., Midtgaard, S. R., Simonsen, J. B., Schweins, R., Mortensen, K. Arleth, L. 2014.  _Acta Crystallographica Section D: Biological Crystallography_ , 70(2), 371–383.
  * [20] [Larsen _et al._]Larsen, Arleth Hansen2018Larsen2018-BayesFit Larsen, A. H., Arleth, L. Hansen, S. 2018.  _Journal of Applied Crystallography_ , 51, 1151–1161.
  * [21] Larsen Pedersen2021Larsen2021-chi2 Larsen, A. H. Pedersen, M. C. 2021.  _Journal of Applied Crystallography_ , 54(5), 1281–1289.
  * [22] [Larsen _et al._]Larsen, Wang, Bottaro, Sergei Grudinin, Arleth Lindorff-Larsen2020Larsen2020-tia1 Larsen, A. H., Wang, Y., Bottaro, S., Sergei Grudinin, Arleth, L. Lindorff-Larsen, K. 2020.  _PLoS Computational Biology_ , 16(4), e1007870.
  * [23] [Lin _et al._]Lin, Greve, Härtner, Götz, Walter, Wu, Rechberger, Spiecker, Busch, Schmutzler, Avadhut, Hartmann, Unruh, Peukert Segets2020Lin2020 Lin, W., Greve, C., Härtner, S., Götz, K., Walter, J., Wu, M., Rechberger, S., Spiecker, E., Busch, S., Schmutzler, T., Avadhut, Y., Hartmann, M., Unruh, T., Peukert, W. Segets, D. 2020\.  _Particle and Particle Systems Characterization_ , 37, 2000145\.
  * [24] [Manalastas-Cantos _et al._]Manalastas-Cantos, Konarev, Hajizadeh, Kikhney, Petoukhov, Molodenskiy, Panjkovich, Mertens, Gruzinov, Borges, Jeffries, Sverguna Frankea2021Manalastas-Cantos2021 Manalastas-Cantos, K., Konarev, P. V., Hajizadeh, N. R., Kikhney, A. G., Petoukhov, M. V., Molodenskiy, D. S., Panjkovich, A., Mertens, H. D., Gruzinov, A., Borges, C., Jeffries, C. M., Sverguna, D. I. Frankea, D. 2021.  _Journal of Applied Crystallography_ , 54, 343–355.
  * [25] [Manet _et al._]Manet, Lecchi, Impéror-Clerc, Zholobenko, Durand, Oliveira, Pedersen, Grillo, Meneau Rochas2011Manet2011 Manet, S., Lecchi, A., Impéror-Clerc, M., Zholobenko, V., Durand, D., Oliveira, C. L., Pedersen, J. S., Grillo, I., Meneau, F. Rochas, C. 2011.  _Journal of Physical Chemistry B_ , 115(39), 11318–11329.
  * [26] [McCluskey _et al._]McCluskey, Cooper, Arnold Snow2020McCluskey2020 McCluskey, A. R., Cooper, J. F., Arnold, T. Snow, T. 2020\.  _Machine Learning: Science and Technology_ , 1, 035002.
  * [27] [Metwalli _et al._]Metwalli, Götz, Zech, Bär, Schuldes, Martel, Porcar Unruh2021Metwalli2021 Metwalli, E., Götz, K., Zech, T., Bär, C., Schuldes, I., Martel, A., Porcar, L. Unruh, T. 2021.  _Applied Sciences_ , 11, 5925.
  * [28] Müller Damaschun1979Muller1979 Müller, J. J. Damaschun, G. 1979.  _Journal of Applied Crystallography_ , 12(3), 267–274.
  * [29] [Müller _et al._]Müller, Hansen Pürschel1996Muller1996 Müller, J. J., Hansen, S. Pürschel, H. V. 1996\.  _Journal of Applied Crystallography_ , 29, 547–554.
  * [30] Nyquist1928Nyquist1928 Nyquist, H. 1928.  _Transactions of the American Institute of Electrical Engineers_ , 47, 617–644.
  * [31] Pedersen1997Pedersen1997 Pedersen, J. 1997.  _Advances in Colloid and Interface Science_ , 70, 171–210.
  * [32] [Pedersen _et al._]Pedersen, Arleth Mortensen2013Pedersen2013-WillItFit Pedersen, M. C., Arleth, L. Mortensen, K. 2013.  _Journal of Applied Crystallography_ , 46(6), 1894–1898.
  * [33] [Pedersen _et al._]Pedersen, Hansen, Markussen, Arleth Mortensen2014Pedersen2014-info Pedersen, M. C., Hansen, S. L., Markussen, B., Arleth, L. Mortensen, K. 2014.  _Journal of Applied Crystallography_ , 47, 2000–2010.
  * [34] Scheres2012 _a_ Scheres2012-Bayes Scheres, S. H. 2012 _a_.  _Journal of Molecular Biology_ , 415, 406–418.
  * [35] Scheres2012 _b_ Scheres2012-RELION Scheres, S. H. 2012 _b_.  _Journal of Structural Biology_ , 180, 519–530.
  * [36] [Sedlak _et al._]Sedlak, Bruetzel Lipfert2017Sedlak2017-errors Sedlak, S. M., Bruetzel, L. K. Lipfert, J. 2017.  _Journal of Applied Crystallography_ , 50, 621–630.
  * [37] Shannon1949Shannon1949 Shannon, C. E. 1949.  _Proceedings of the IRE_ , 37, 10–21.
  * [38] Shevchuk Hub2017Shevchuk2017 Shevchuk, R. Hub, J. S. 2017.  _PLoS Computational Biology_ , 13, e1005800.
  * [39] [Sonntag _et al._]Sonntag, Jagtap, Simon, Appavou, Geerlof, Stehle, Gabel, Hennig Sattler2017Sonntag2017 Sonntag, M., Jagtap, P. K. A., Simon, B., Appavou, M. S., Geerlof, A., Stehle, R., Gabel, F., Hennig, J. Sattler, M. 2017.  _Angewandte Chemie - International Edition_ , 56(32), 9322–9325.
  * [40] Taupin Luzzati1982Taupin1982 Taupin, D. Luzzati, V. 1982.  _Journal of Applied Crystallography_ , 15(3), 289–300.
  * [41] Vestergaard Hansen2006Vestergaard2006 Vestergaard, B. Hansen, S. 2006.  _Journal of Applied Crystallography_ , 39, 797–804.
  * [42] [Virtanen _et al._]Virtanen, Gommers, Oliphant _et al._ 2020Virtanen2020-scipy Virtanen, P., Gommers, R., Oliphant, T. E. _et al._ 2020\.  _Nature Methods_ , 17(3), 261–272.
  * [43] Zemb Diat2010Zemb2010 Zemb, T. Diat, O. 2010.  _Journal of Physics: Conference Series_ , 247, 012002.
  * [44]

##  8 Supplemental Information

Figure S1: Information content of simulated data with increasing noise. The
information content was estimated by the number of Shannon channels
$N_{\mathrm{s}}$ (black full line), which is indifferent to the noise of data,
(ii) the number of Shanum channels $N_{\mathrm{m}}$ (gray) and (iii) the
number of good parameters $N_{\mathrm{g,BIFT}}$ (dark blue). The latter two
decrease with increasing noise. The information content was also estimated
with the number of good parameters from model fitting
$N_{\mathrm{g,BayesFit}}$ (light blue), which converges to the number of model
parameters $K$ (black dashed line) for very low noise and to zero for very
high noise levels. Figure S2: Distribution of $\chi^{2}_{\mathrm{r}}$ for a
fit against either simulated SAXS data (left column, $M_{\mathrm{SAXS}}=400$)
or simulated SANS data (right column, $M_{\mathrm{SANS}}=50$), using different
values for the degrees of freedom: $M-K$ (blue), $M-N_{\mathrm{g}}$ (gray) or
$M$ (red). Refinement was done using either the non-informative uniform prior
(A-B), the poor Gaussian prior (C-D), the good Gaussian prior (E-F), or the
best Gaussian prior (G-H). Figure S3: Radii of the core-multishell model were
refined against SAXS and SANS data, using different priors. The priors (filled
areas) are plotted along with the distributions of the refined values of the
radii (full lines). Figure S4: Radii of the core-multishell model were refined
against SAXS and SANS data, using a non-informative uniform prior (red), a
poor Gaussian prior (light blue), a good Gaussian prior (dark blue) or the
best Gaussian prior (black). The probability distributions were normalized
with the maximum, for easier comparison. The model was also refined with more
informative uniform priors with upper and lower limits set to $\mu_{k}\pm
x\sigma_{\mathrm{best}}$ and $x$ is varied from 0.5 to 5, where $x=5$
corresponds to the non-informative uniform prior. (A) Core radius, (B-D) outer
radii of shells 1-3.