[SciPy-User] calculate predicted values from regression + confidence intervall
Thu Oct 20 16:15:36 CDT 2011
On Thu, Oct 20, 2011 at 21:50, Christian K. <firstname.lastname@example.org> wrote:
> Am 20.10.11 16:12, schrieb email@example.com:
>> On Thu, Oct 20, 2011 at 5:11 AM, Christian K. <firstname.lastname@example.org> wrote:
>>> <josef.pktd <at> gmail.com> writes:
>>>>> f(X,Y) = a1-a2*log(X)+a3/Y (inverse power/Arrhenius model from accelerated
>>>>> reliability testing)
>>>> your f(X,Y) is still linear in the parameters, a1, a2, a3. So the
>>>> linear version still applies.
>>> Ok, but then I do not understand how to follow your indications for the
>>> prediction interval:
>>>>> distributed with mean y = Y = X*beta, and var(y) = X' * cov_beta * X +
>>>>> var_u_estimate (dot products for appropriate shapes)
>>> X in my case is [X,Y] and cov_beta has a shape of 3x3, since there are 3
>>> Sorry for my ignorance on statistics, I really apppreaciate your help.
>> I'm attaching a complete example for the linear in parameters case,
>> including the comparison with statsmodels.
> Ok, I got it, thank you very much. As I understood, this works for OLS
> (only?). What about if I get the covariance matrix from a 2D odr/leastsq
> fit from scipy.odr ? I noticed, that the covariance matrices differ by a
> constant (large) factor.
ODRPACK will scale the covariance matrix by the Chi^2 score of the
residuals (i.e. divide the residuals by the error bars, square, sum,
divide by nobs-nparams), IIRC. This accounts for misestimation of the
error bars. If the error bars were correctly estimated, the Chi^2
score will be ~1. If the error bars were too small compared to the
residuals, then the Chi^2 score will be high, and thus increase the
estimated variance, etc. This may or may not be what you want,
especially when comparing it with other tools, but it's what ODRPACK
computes, so it's what scipy.odr returns.
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the SciPy-User