mesmer.stats.fit_yeo_johnson_transform

mesmer.stats.fit_yeo_johnson_transform#

mesmer.stats.fit_yeo_johnson_transform(yearly_pred, monthly_residuals, time_dim='time')#

estimate the optimal coefficients for the parameters \(\lambda\) for each gridcell, to normalize monthly residuals conditional on yearly predictor. Here, \(\lambda\) depends on the yearly predictor according to lambda_function. The optimal coefficients for the lambda parameters for minimizing skewness are estimated on each gridcell independently using maximum likelihood.

Parameters:
  • yearly_pred (xr.DataArray of shape (n_years, n_gridcells)) – yearly values used as predictors for the lambdas.

  • monthly_residuals (xr.DataArray of shape (n_years*12, n_gridcells)) – Monthly residuals after removing harmonic model fits, used to fit for the optimal transformation parameters (lambdas).

  • time_dim (str, optional) – Name of the time dimension in the input data used to align monthly residuals and yearly predictor data (needs to be the same in both).

Returns:

lambda_coeffs (xr.DataArray) – DataArray containing the estimated coefficients needed to estimate lambda with dimensions (months, coeff, n_gridcells).