Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add kurtosis (and others?) as metric to evaluate performance of heteroscedasticity inference #442

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion examples/advanced/plot_standardization.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
maxc_arr = np.maximum(np.abs(planc_arr), np.abs(profc_arr))

# Remove large outliers
dh_arr[np.abs(dh_arr) > 4 * xdem.spatialstats.nmad(dh_arr)] = np.nan
dh_arr[np.abs(dh_arr) > 7 * xdem.spatialstats.nmad(dh_arr)] = np.nan

# Define bins for 2D binning
custom_bin_slope = np.unique(
Expand Down Expand Up @@ -97,6 +97,12 @@
z_dh.data[mask_glacier.data] = np.nan
z_dh.data[np.abs(z_dh.data) > 4] = np.nan

from scipy.stats import kurtosis
kbef = kurtosis(dh_arr, nan_policy="omit")
kaft = kurtosis(z_dh.flatten(), nan_policy="omit")
print("Excess kurtosis before standardization: {}".format(kbef))
print("Excess kurtosis after standardization: {}".format(kaft))

# %%
# We perform a scale-correction for the standardization, to ensure that the spread of the data is exactly 1.
# The NMAD is used as a robust measure for the spread (see :ref:`robuststats-nmad`).
Expand Down
Loading