@@ -130,8 +130,7 @@ where
130
130
}
131
131
132
132
#[ deprecated( note = "Use the method calc_correlation_matrix." , since = "0.9.0" ) ]
133
- /// calculate the correlation matrix. **Deprecated**, use the `calc_correlation_matrix``
134
- /// function instead.
133
+ /// calculate the correlation matrix.
135
134
pub fn correlation_matrix ( & self ) -> OMatrix < Model :: ScalarType , Dyn , Dyn >
136
135
where
137
136
Model :: ScalarType : Float ,
@@ -263,52 +262,6 @@ where
263
262
/// let cb_upper = best_fit + cb_radius;
264
263
/// let cb_lower = best_fit - cb_radius;
265
264
/// ```
266
- /// # An Important Note on the Confidence Band Values
267
- ///
268
- /// This library chooses to implement the confidence interval such that it
269
- /// gives the same results as the python library [`lmfit`](https://lmfit.github.io/lmfit-py/).
270
- /// That means that the confidence interval is given _as if_ during the
271
- /// fitting process the weights had been uniformly scaled such that the
272
- /// reduced `$\chi^2$` after fitting is equal to unity: `$\chi_/nu^2 = \chi^2/\nu = 1$`,
273
- /// where `$\nu$` is the number of degrees of freedom (i.e. the number of data
274
- /// points minus the number of total fit parameters).
275
- ///
276
- /// Scaling the weights does not influence the best fit parameters themselves,
277
- /// but it does influence the resulting uncertainties. Read [here](https://www.astro.rug.nl/software/kapteyn/kmpfittutorial.html#reduced-chi-squared)
278
- /// for an in-depth explanation. Briefly, the expected value for
279
- /// `$\chi^2_\nu$` for a fit with `$\nu$` degrees of freedom is one.
280
- /// Therefore it can be reasonable to apply the scaling such that we force
281
- /// `$chi^2_\nu$` to take its expected value. This will correct an overestimation
282
- /// or underestimation of the errors and is often a reasonable choice to make.
283
- ///
284
- /// However, this will make this confidence band inconsistent with the other
285
- /// information from the fit, such as the standard errors from the covariance matrix
286
- /// or the reduced `$\chi^2$`. Luckily, it's easy to obtain the confidence
287
- /// bands with the errors exactly as given. Just multiply the result of this
288
- /// function with the _reduced_ `$\chi^2$` of this fit.
289
- ///
290
- /// ```no_run
291
- /// # let model : varpro::model::SeparableModel<f64> = unimplemented!();
292
- /// # let y = nalgebra::DVector::from_vec(vec![0.0, 10.0]);
293
- /// # use varpro::solvers::levmar::LevMarProblemBuilder;
294
- /// # use varpro::solvers::levmar::LevMarSolver;
295
- /// # let problem = LevMarProblemBuilder::new(model)
296
- /// # .observations(y)
297
- /// # .build()
298
- /// # .unwrap();
299
- ///
300
- /// let (fit_result,fit_statistics) = LevMarSolver::default()
301
- /// .fit_with_statistics(problem)
302
- /// .unwrap();
303
- ///
304
- /// let best_fit = fit_result.best_fit().unwrap();
305
- /// // get the unscaled confidence band by multiplying with the
306
- /// // reduced chi2
307
- /// let cb_radius_unscaled = fit_statistics.reduced_chi2() * fit_statistics.confidence_band_radius(0.683);
308
- /// // upper and lower bounds of the confidence band
309
- /// let cb_upper = best_fit + cb_radius_unscaled;
310
- /// let cb_lower = best_fit - cb_radius_unscaled;
311
- /// ```
312
265
///
313
266
/// # Panics
314
267
///
0 commit comments