Commit 795460722e5c20fd6ad555dda7b98015d0074ddc
1 parent
fafb9193
Update User Manual after feedback from Luigi
Showing
3 changed files
with
39 additions
and
27 deletions
doc/source/users/user_manual/irf_cta.rst
| ... | ... | @@ -147,10 +147,13 @@ Running the other tools is equivalent. |
| 147 | 147 | Specifying the response function in an observation definition file |
| 148 | 148 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 149 | 149 | |
| 150 | -In the above example, only a single global response function can be | |
| 151 | -used for all CTA observations. If you need to specify response functions | |
| 152 | -per observation you can add the information directly in the XML observation | |
| 153 | -definition file: | |
| 150 | +In the above example, only a single global response function can be used for all | |
| 151 | +CTA observations. If you need to specify response functions per observation you | |
| 152 | +can add the information directly in the | |
| 153 | +:ref:`observation definition XML file <glossary_obsdef>`. You will learn more | |
| 154 | +about :ref:`observation definition XML files <glossary_obsdef>` in the | |
| 155 | +section :ref:`um_observations`. Here an example of specifying the response | |
| 156 | +information in the :ref:`observation definition XML file <glossary_obsdef>`: | |
| 154 | 157 | |
| 155 | 158 | .. code-block:: xml |
| 156 | 159 | |
| ... | ... | @@ -181,7 +184,8 @@ Specifying individual instrument response files |
| 181 | 184 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 182 | 185 | |
| 183 | 186 | If you need even more control over individual response files, you can |
| 184 | -specify them individually in the XML observation file as follows: | |
| 187 | +specify them individually in the | |
| 188 | +:ref:`observation definition XML file <glossary_obsdef>` as follows: | |
| 185 | 189 | |
| 186 | 190 | .. code-block:: xml |
| 187 | 191 | ... | ... |
doc/source/users/user_manual/likelihood.rst
| ... | ... | @@ -22,7 +22,8 @@ For unbinned data the Poisson formula |
| 22 | 22 | .. math:: |
| 23 | 23 | -\ln L(M) = E(M) - \sum_i \ln P(p'_i, E'_i ,t'_i | M) |
| 24 | 24 | |
| 25 | -is used, where the sum is taken over all events :math:`i`, characterised by the | |
| 25 | +is used, where :math:`\ln L(M)` is the so-called log-likelihood function and | |
| 26 | +the sum is taken over all events :math:`i`, characterised by the | |
| 26 | 27 | instrument direction :math:`p'_i`, the measured energy :math:`E'_i` |
| 27 | 28 | and the trigger time :math:`t'_i`. :math:`P(p', E' ,t' | M)` is |
| 28 | 29 | the probability density that given the :ref:`model <um_models>` :math:`M`, an |
| ... | ... | @@ -136,7 +137,7 @@ where |
| 136 | 137 | \alpha = \frac{\int_\mathrm{on} d\Omega}{\int_\mathrm{off} d\Omega} |
| 137 | 138 | |
| 138 | 139 | is the ratio between the solid angles of the On region and the Off region. |
| 139 | -The terms in the last row are added so that :math:`-2 \ln L(M_s)` follows a | |
| 140 | +The terms in the last row are added so that :math:`2 \ln L(M_s)` follows a | |
| 140 | 141 | :math:`\chi^2` distribution. |
| 141 | 142 | |
| 142 | 143 | Some special cases need to be handled separately in ``wstat``. |
| ... | ... | @@ -176,10 +177,16 @@ Levenberg-Marquardt algorithm |
| 176 | 177 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 177 | 178 | |
| 178 | 179 | ctools uses an iterative Levenberg-Marquardt algorithm for maximum likelihood |
| 179 | -estimation. The Levenberg-Marquardt algorithm starts with an inital guess of | |
| 180 | -the :ref:`model <um_models>` parameters :math:`a_k` and iteratively | |
| 181 | -replaces this estimate by a new estimate :math:`a_k + \Delta a_k`. The | |
| 182 | -:math:`\Delta a_k` are determined by solving | |
| 180 | +estimation. Since the Levenberg-Marquardt algorithm minimizes a function, we | |
| 181 | +use | |
| 182 | + | |
| 183 | +.. math:: | |
| 184 | + f(M) = -\ln L(M) | |
| 185 | + | |
| 186 | +as the function to minimize by the algorithm. The Levenberg-Marquardt algorithm | |
| 187 | +starts with an inital guess of the :ref:`model <um_models>` parameters | |
| 188 | +:math:`a_k` and iteratively replaces this estimate by a new estimate | |
| 189 | +:math:`a_k + \Delta a_k`. The :math:`\Delta a_k` are determined by solving | |
| 183 | 190 | |
| 184 | 191 | .. math:: |
| 185 | 192 | \sum_l \alpha_{kl} (1 + \delta_{kl} \lambda) \Delta a_l = \beta_k |
| ... | ... | @@ -198,15 +205,16 @@ is the gradient and |
| 198 | 205 | :math:`\delta_{kl}` is the Kronecker delta that is :math:`1` for |
| 199 | 206 | :math:`k=l` and :math:`0` otherwise. :math:`\lambda` is a damping parameter |
| 200 | 207 | that initially is set to 0.001. If a Levenberg-Marquardt iteration leads to |
| 201 | -an increase of the log-likelihood function, :math:`\lambda` is decreased by a | |
| 202 | -factor of 10. If the log-likelihood function does not improve, :math:`\lambda` | |
| 203 | -is increased by a factor of 10 and the iteration is repeated. The iterations | |
| 204 | -stop when the log-likelihood increase is less than a small value, typically | |
| 205 | -0.005; the optimiser status is then set to ``converged``. The iterations are | |
| 206 | -also stopped if the log-likelihood function does not improve for (typically) | |
| 207 | -ten iterations; the optimiser status is then set to ``stalled``. The matrix | |
| 208 | -equation is solved using a sparse matrix Cholesky decomposition. Parameters | |
| 209 | -are constrained within their parameter limits in case they exist. | |
| 208 | +an increase of the log-likelihood function :math:`\ln L(M)`, :math:`\lambda` | |
| 209 | +is decreased by a factor of 10. If the log-likelihood function :math:`\ln L(M)` | |
| 210 | +does not improve, :math:`\lambda` is increased by a factor of 10 and the | |
| 211 | +iteration is repeated. The iterations stop when the log-likelihood increase is | |
| 212 | +less than a small value, typically 0.005; the optimiser status is then set to | |
| 213 | +``converged``. The iterations are also stopped if the log-likelihood function | |
| 214 | +does not increase for (typically) ten iterations; the optimiser status is then | |
| 215 | +set to ``stalled``. The matrix equation is solved using a sparse matrix Cholesky | |
| 216 | +decomposition. Parameters are constrained within their parameter limits in case | |
| 217 | +they exist. | |
| 210 | 218 | |
| 211 | 219 | Model fitting using the Levenberg-Marquardt algorithm is implemented by |
| 212 | 220 | :ref:`ctlike`. |
| ... | ... | @@ -238,11 +246,11 @@ The detection significance of the source model is estimated using the so |
| 238 | 246 | called Test Statistic (TS) which is defined as |
| 239 | 247 | |
| 240 | 248 | .. math:: |
| 241 | - \mathrm{TS} = 2 \, (\ln L(M_b) - \ln L(M_s+M_b)) | |
| 249 | + \mathrm{TS} = 2 \, ( \ln L(M_s+M_b) - \ln L(M_b) ) | |
| 242 | 250 | |
| 243 | -where :math:`-\ln L(M_s+M_b)` is the log-likelihood value obtained when | |
| 251 | +where :math:`\ln L(M_s+M_b)` is the log-likelihood value obtained when | |
| 244 | 252 | fitting the source and the background together to the data, and |
| 245 | -:math:`-\ln L(M_b)` is the log-likelihood value obtained when fitting only | |
| 253 | +:math:`\ln L(M_b)` is the log-likelihood value obtained when fitting only | |
| 246 | 254 | the background model to the data. |
| 247 | 255 | Under the hypothesis that the model :math:`M_b` provides a satisfactory fit |
| 248 | 256 | of the data, :math:`TS` follows a :math:`\chi^2_n` distribution with |
| ... | ... | @@ -263,13 +271,13 @@ Upper flux limits |
| 263 | 271 | |
| 264 | 272 | If gamma-ray emission from a source is not detected, an upper flux limit can |
| 265 | 273 | be derived by determining the flux :math:`F_\mathrm{up}` that leads to a |
| 266 | -log-likelihood decrease of :math:`\Delta ln L` with respect to the maximum | |
| 274 | +log-likelihood decrease of :math:`\Delta \ln L` with respect to the maximum | |
| 267 | 275 | log-likelihood estimate :math:`F_\mathrm{0}`: |
| 268 | 276 | |
| 269 | 277 | .. math:: |
| 270 | - -\ln L(F_\mathrm{up}) = -\ln L(F_\mathrm{0}) + \Delta \ln L | |
| 278 | + \ln L(F_\mathrm{up}) = \ln L(F_\mathrm{0}) - \Delta \ln L | |
| 271 | 279 | |
| 272 | -The log-likelihood decrease :math:`\Delta ln L` is computed from the | |
| 280 | +The log-likelihood decrease :math:`\Delta \ln L` is computed from the | |
| 273 | 281 | chance probability (p-value) using |
| 274 | 282 | |
| 275 | 283 | .. math:: | ... | ... |
doc/source/users/user_manual/observations.rst
| ... | ... | @@ -19,7 +19,7 @@ so-called observation definition XML file. ctools will then compute the joint |
| 19 | 19 | log-likelihood |
| 20 | 20 | |
| 21 | 21 | .. math:: |
| 22 | - -\ln L(M) = -\sum_k \ln L_k(M) | |
| 22 | + \ln L(M) = \sum_k \ln L_k(M) | |
| 23 | 23 | |
| 24 | 24 | for the maximum likelihood estimations, where the sum is taken over the |
| 25 | 25 | individual observations :math:`k`. Below you will see the first lines of an | ... | ... |