1
$\begingroup$

Given the dataset $(t_i, y_i)$ with absolute errors $\varepsilon_{y_i}$, I want to fit a weighted cubic function and get the errors on interpolated values $\hat{y}(t)$:

$$ \hat{y}(t) = \sum^{3}_{j=0}c_jt^j $$

where $c_j$ are the coefficients determined by the weighted fitting process.

Calculating the residuals and chi squared is straightforward:

$$ r_i = y_i - \hat{y}(t_i) $$ $$ \chi^2 = \sum^n_{i=1}\left( \frac{r_i}{\varepsilon_{y_i}}\right)^2 $$

...but it's unclear to me where to go from here to get errors on $\hat{y}$ values. How do I estimate the error on the interpolation $\hat{y}(t)$?

$\endgroup$
4
  • $\begingroup$ What is $\varepsilon$ here? $\endgroup$
    – Glen_b
    Commented Sep 27 at 0:19
  • $\begingroup$ $\varepsilon$ is absolute error $\endgroup$ Commented Sep 27 at 0:35
  • $\begingroup$ That helps a bit. Do you give an explicit definition of it in terms of the variables here? $\endgroup$
    – Glen_b
    Commented Sep 27 at 0:43
  • $\begingroup$ Both $y_i$ and $\varepsilon_{y_i}$ are empirical. Specifically, $\varepsilon_{y_i}$ is based on the quality of fit of raw data to a user-selected model plus an extrapolation. $\endgroup$ Commented Sep 27 at 0:49

1 Answer 1

0
$\begingroup$

From the description you want to fit the data but not to interpolate them. Interpolation is about finding a model function that passes over all data points. On the other hand, fitting approximates some function to data.

To problem is a weighted least squares. You need to calculate first the estimators and covariance matrix $ V_c$ of the parameters $c_j$. This can be done in Python with WLS in statsmodels. The error in the fitted model is calculated by propagating the errors of the estimators,

$$ Var(\hat{y}) = \left( \nabla \hat{y} \right)^T \; V_c \; \nabla \hat{y} $$

With $\nabla \hat{y} $ the gradient wrt the $ c_j $'s. The error you are after is the square root of this variance. This as a function of the independent variable t also gives de error band $$\hat{y} \pm \sigma (\hat{y}) $$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.