mesmer.stats.YeoJohnsonTransformer.fit#
- YeoJohnsonTransformer.fit(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) – yearly values used as predictors for the lambdas, must contain time_dim but can have additional dimensions for example gridcells or members.monthly_residuals (
xr.DataArray) – Monthly residuals after removing harmonic model fits, used to fit for the optimal transformation parameters (lambdas). Has time_dim which is of lengthyearly_pred[time_dim].size * 12and can also contain the same additional dimensions as yearly_pred.time_dim (str, default: “time”) – 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 “month”, “coeff” and additional dims on inputs.