Skip to content

Commit 75bf80f

Browse files
Merge pull request #147 from scikit-learn-contrib/mcar-test-implementation
Mcar test implementation
2 parents f7cbba6 + fcc866f commit 75bf80f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

examples/tutorials/plot_tuto_mcar.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,16 @@
7272
)
7373
plt.xlabel("Column 1")
7474
plt.ylabel("Column 2")
75-
plt.title("Case 1: MCAR missingness mechanism")
75+
plt.title("Case 1: MCAR data")
7676
plt.grid()
7777
plt.show()
7878

7979
# %%
8080
result = test_mcar.test(df_nan)
8181
print(f"Test p-value: {result:.2%}")
8282
# %%
83-
# The p-value is quite high, therefore we don't reject H0.
84-
# We can then suppose that our missingness mechanism is MCAR.
83+
# The p-value is larger than 0.05, therefore we don't reject the HO MCAR assumption. In this case
84+
# this is a true negative.
8585

8686
# %%
8787
# Case 2: MAR holes with mean bias (True positive)
@@ -104,7 +104,7 @@
104104
)
105105
plt.xlabel("Column 1")
106106
plt.ylabel("Column 2")
107-
plt.title("Case 2: MAR missingness mechanism")
107+
plt.title("Case 2: MAR data with mean bias")
108108
plt.grid()
109109
plt.show()
110110

@@ -113,8 +113,8 @@
113113
result = test_mcar.test(df_nan)
114114
print(f"Test p-value: {result:.2%}")
115115
# %%
116-
# The p-value is lower than the classic threshold (5%).
117-
# H0 is then rejected and we can suppose that our missingness mechanism is MAR.
116+
# The p-value is smaller than 0.05, therefore we reject the HO MCAR assumption. In this case
117+
# this is a true positive.
118118

119119
# %%
120120
# Case 3: MAR holes with any mean bias (False negative)
@@ -143,7 +143,7 @@
143143
)
144144
plt.xlabel("Column 1")
145145
plt.ylabel("Column 2")
146-
plt.title("Case 3: MAR missingness mechanism undetected by the Little's test")
146+
plt.title("Case 3: MAR data without any mean bias")
147147
plt.grid()
148148
plt.show()
149149

@@ -152,8 +152,8 @@
152152
result = test_mcar.test(df_nan)
153153
print(f"Test p-value: {result:.2%}")
154154
# %%
155-
# The p-value is higher than the classic threshold (5%).
156-
# H0 is not rejected whereas the missingness mechanism is clearly MAR.
155+
# The p-value is larger than 0.05, therefore we don't reject the HO MCAR assumption. In this case
156+
# this is a false negative since the missingness mechanism is MAR.
157157

158158
# %%
159159
# Limitations

0 commit comments

Comments
 (0)