xskillscore.pearson_r_p_value
- xskillscore.pearson_r_p_value(a, b, dim=None, weights=None, skipna=False, keep_attrs=False)
2-tailed p-value associated with pearson’s correlation coefficient.
- Parameters
a (xarray.Dataset or xarray.DataArray) – Labeled array(s) over which to apply the function.
b (xarray.Dataset or xarray.DataArray) – Labeled array(s) over which to apply the function.
dim (str, list) – The dimension(s) to apply the correlation along. Note that this dimension will be reduced as a result. Defaults to None reducing all dimensions.
weights (xarray.Dataset or xarray.DataArray or None) – Weights matching dimensions of
dim
to apply during the function.skipna (bool) – If True, skip NaNs when computing function.
keep_attrs (bool) – If True, the attributes (attrs) will be copied from the first input to the new one. If False (default), the new object will be returned without attributes.
- Returns
2-tailed p-value of Pearson’s correlation coefficient.
- Return type
See also
Examples
>>> a = xr.DataArray(np.random.rand(5, 3, 3), ... dims=['time', 'x', 'y']) >>> b = xr.DataArray(np.random.rand(5, 3, 3), ... dims=['time', 'x', 'y']) >>> xs.pearson_r_p_value(a, b, dim='time') <xarray.DataArray (x: 3, y: 3)> array([[0.77888033, 0.66476199, 0.15051516], [0.59316935, 0.47567465, 0.75446898], [0.59925464, 0.58509064, 0.04161894]]) Dimensions without coordinates: x, y