Re: [Numpy-discussion] 2d binning and linear regression

2010-06-22 Thread Tom Durrant
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 =

Re: [Numpy-discussion] 2d binning and linear regression

2010-06-22 Thread Tom Durrant
What exactly are trying to fit because it is rather bad practice to fit a model to some summarized data as you lose the uncertainty in the original data? If you define your boxes, you can loop through directly on each box and even fit the equation: model=mu +beta1*obs The extension is

[Numpy-discussion] 2d binning and linear regression

2010-06-20 Thread Tom Durrant
Hi All, I have a problem involving lat/lon data. Basically, I am evaluating numerical weather model data against satellite data, and trying to produce gridded plots of various statistics. There are various steps involved with this, but basically, I get to the point where I have four arrays of

Re: [Numpy-discussion] 2d binning and linear regression

2010-06-20 Thread Tom Durrant
are you doing something like np.polyfit(model, obs, 1) ? If you are using polyfit with deg=1, i.e. fitting a straight line, then this could be also calculated using the weights in histogram2d. histogram2d (histogramdd) uses np.digitize and np.bincount, so I'm surprised if the