# [ncl-talk] Regression

Fri Oct 5 12:28:04 MDT 2018

```Hi Morteza,
What is typically done in this situation is that an area-average of the
nino4 region is calculated, and then that timeseries is used to regress
against another 3D field.
For example:
llats = -5.    ; nino4 region
llatn = 5.
llonw = 160.
llone = 210.
nino4 =
wgt_areaave(sst(:,{llats:llatn},{llonw:llone}),coswgt({llats:llatn}),1.0,0)
nino4 at long_name = "nino4 timeseries (monthly)"
RC  = regCoef_n(nino4,SSTA_Tropical_Pacific,0,0)

The resulting RC array will be 2-dimensional.

Hope that makes sense. If you have any further questions please respond to
the ncl-talk email list.

On Fri, Oct 5, 2018 at 7:23 AM Morteza Qadimi <mqadimi at yahoo.com> wrote:

> Hi;
>
> I need to regress tropical Pacific SST with Nino 4 region SST and then
> substract it from original SST of tropical Pacific. But original SSTA data
> are 3D (time*lat*lon) and the regressed SST anomaly array is 4D. I can’t
> find out what is the problem. I’ve given some info about what I’ve done.
>
>
>
> SSTA_Tropical_Pacific (468*11*86)
>
> SSTA_Nino4_Region (468*6*6)
>
> RC  = regCoef_n(SSTA_Tropical_Pacific, SSTA_Nino4_Region, 0,0)
>
> printVarSummary (RC)
>
>
>
> output ----------------------à
>
> Variable: RC12
>
> Type: float
>
> Total Size: 136224 bytes
>
>             34056 values
>
> Number of Dimensions: 4
>
> Dimensions and sizes:   [11] x [86] x [6] x [6]
>
> Coordinates:
>
> Number Of Attributes: 5
>
>   _FillValue :  -9.96921e+36
>
>   nptxy :       <ARRAY of 34056 elements>
>
>   rstd :        <ARRAY of 34056 elements>
>
>   yintercept :  <ARRAY of 34056 elements>
>
>   tval :        <ARRAY of 34056 elements>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

--