>
>
> the basic idea is in "polyfit  on multiple data points" on
> numpy-disscusion mailing list April 2009
>
> In this case, calculations have to be done by groups
>
> subtract mean (this needs to be replaced by group demeaning)
> modeldm = model - model.mean()
> obsdm = obs - obs.mean()
>
> xx = np.histogram2d(
> xx, xedges, yedges = np.histogram2d(lat, lon, weights=modeldm*modeldm,
>      bins=(latedges,lonedges))
> xy, xedges, yedges = np.histogram2d(lat, lon, weights=obsdm*obsdm,
>      bins=(latedges,lonedges))
>
>
> slopes = xy/xx  # slopes by group
>
> expand slopes to length of original array
> predicted = model - obs * slopes_expanded
> ...
>
> the main point is to get the group functions, for demeaning, ... for
> the 2d labels (and get the labels out of histogramdd)
>
> I'm out of time (off to the airport soon), but I can look into it next
> weekend.
>
> Josef
>
> Thanks Josef, I will chase up the April list...

If I understand what you have done above, this returns the slope of best fit
lines forced through the origin, is that right?

Have a great trip!

Tom
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to