[SciPy-User] calculate predicted values from regression + confidence intervall
josef.pktd@gmai...
josef.pktd@gmai...
Thu Oct 20 09:12:37 CDT 2011
On Thu, Oct 20, 2011 at 5:11 AM, Christian K. <ckkart@hoc.net> 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
> paramters.
> 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.
the relevant part is
y_pred = np.dot(xp, beta_est)
y_pred_cov = np.dot(xp, np.dot(cov_params, xp.T))
y_pred_cov = np.atleast_1d(y_pred_cov)
y_pred_std = np.sqrt(np.diag(y_pred_cov) + sigma2_u)
It took me a bit of time to match up the DIY version with statsmodels,
because of shape, ddof, sqrt bugs in the initially quickly written
example.
I hope this helps.
Josef
>
> Regards, Christian
>
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: try_predict_interval.py
Type: text/x-python
Size: 1827 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/scipy-user/attachments/20111020/58ad2d4c/attachment.py
More information about the SciPy-User
mailing list