I am using LSQUnivariateSpline or make_lsq_spline from scipy.interpolate for given weights. Is there a simple way to get not only the resulting spline, but also the variance-covariance matrix of the spline coefficients? Is there a simple way to get the normal matrix which is generated within these functions and which is used for the LSQ-problem?
Asked
Active
Viewed 184 times
1 Answers
0
There is no supported way, no.
You can of course take what you need from the source code of make_interp_spline
:
https://github.com/scipy/scipy/blob/v1.5.2/scipy/interpolate/_bsplines.py#L854-L1009
(The normal eq matrix is constructed with _bspl._norm_eq_lsq
).
Note however that the internals are subject to change without notice.
In particular, the very use of the normal equations may go away.
For LSQUnivariateSpline, you'll need to read the Fortran sources of FITPACK. (Somewhat) good news is that it's less likely to change in future scipy versions.

ev-br
- 24,968
- 9
- 65
- 78
-
OK, understood. Now, given weights/uncertainties for the observations I would think that one might naturally ask for the variance-covariance matrix of the coefficients for the resulting (LSQ-)B-spline representation. And in turn, when using the B-spline to evaluate approximate function values, I would also ask for the respective variance-covariance matrix of the functions approximation. If i am not making some stupid mistake here, misunderstanding something. – Thomas Hilger Aug 20 '20 at 11:45
-
I mean, on paper everything is clear and I am able to transform _bspl._norm_eq_lsq to do exactly what I want it to do. However, I somehow got stuck on the next step. So any help would be fantastic. – Thomas Hilger Aug 20 '20 at 11:50