Skip to content

Commit 7cb2312

Browse files
authored
Merge pull request #109 from DoubleML/p-upd-ggplot
replace dot dot notation by after_stats()
2 parents 67d4d11 + 3df8e78 commit 7cb2312

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

doc/guide/basics.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ other half of observations indexed with :math:`i \in I`
224224
}
225225

226226
g_nonorth = ggplot(data.frame(theta_rescaled=(theta_nonorth - alpha)/se_nonorth)) +
227-
geom_histogram(aes(y=..density.., x=theta_rescaled, colour = "Non-orthogonal ML", fill="Non-orthogonal ML"),
227+
geom_histogram(aes(y=after_stats(density), x=theta_rescaled, colour = "Non-orthogonal ML", fill="Non-orthogonal ML"),
228228
bins = 30, alpha = 0.3) +
229229
geom_vline(aes(xintercept = 0), col = "black") +
230230
suppressWarnings(geom_function(fun = dnorm, aes(colour = "N(0, 1)", fill="N(0, 1)"))) +
@@ -348,7 +348,7 @@ orthogonalized regressor :math:`V = D - m(X)`. We then use the final estimate
348348
}
349349

350350
g_nosplit = ggplot(data.frame(theta_rescaled=(theta_orth_nosplit - alpha)/se_orth_nosplit), aes(x = theta_rescaled)) +
351-
geom_histogram(aes(y=..density.., x=theta_rescaled, colour = "Double ML (no sample splitting)", fill="Double ML (no sample splitting)"),
351+
geom_histogram(aes(y=after_stats(density), x=theta_rescaled, colour = "Double ML (no sample splitting)", fill="Double ML (no sample splitting)"),
352352
bins = 30, alpha = 0.3) +
353353
geom_vline(aes(xintercept = 0), col = "black") +
354354
suppressWarnings(geom_function(fun = dnorm, aes(colour = "N(0, 1)", fill="N(0, 1)"))) +
@@ -452,7 +452,7 @@ Cross-fitting performs well empirically because the entire sample can be used fo
452452
}
453453

454454
g_dml = ggplot(data.frame(theta_rescaled=(theta_dml - alpha)/se_dml), aes(x = theta_rescaled)) +
455-
geom_histogram(aes(y=..density.., x=theta_rescaled, colour = "Double ML with cross-fitting", fill="Double ML with cross-fitting"),
455+
geom_histogram(aes(y=after_stats(density), x=theta_rescaled, colour = "Double ML with cross-fitting", fill="Double ML with cross-fitting"),
456456
bins = 30, alpha = 0.3) +
457457
geom_vline(aes(xintercept = 0), col = "black") +
458458
suppressWarnings(geom_function(fun = dnorm, aes(colour = "N(0, 1)", fill="N(0, 1)"))) +
@@ -525,11 +525,11 @@ The third term :math:`c^*` vanishes in probability if sample splitting is applie
525525
g_all = ggplot(data.frame(t_nonorth=(theta_nonorth - alpha)/se_nonorth,
526526
t_orth_nosplit=(theta_orth_nosplit - alpha)/se_orth_nosplit,
527527
t_dml=(theta_dml - alpha)/se_dml)) +
528-
geom_histogram(aes(x = t_nonorth, y=..density.., colour = "Non-orthogonal ML", fill="Non-orthogonal ML"),
528+
geom_histogram(aes(x = t_nonorth, y=after_stats(density), colour = "Non-orthogonal ML", fill="Non-orthogonal ML"),
529529
bins = 30, alpha = 0.3) +
530-
geom_histogram(aes(x = t_orth_nosplit, y=..density.., colour = "Double ML (no sample splitting)", fill="Double ML (no sample splitting)"),
530+
geom_histogram(aes(x = t_orth_nosplit, y=after_stats(density), colour = "Double ML (no sample splitting)", fill="Double ML (no sample splitting)"),
531531
bins = 30, alpha = 0.3) +
532-
geom_histogram(aes(x = t_dml, y=..density.., colour = "Double ML with cross-fitting", fill="Double ML with cross-fitting"),
532+
geom_histogram(aes(x = t_dml, y=after_stats(density), colour = "Double ML with cross-fitting", fill="Double ML with cross-fitting"),
533533
bins = 30, alpha = 0.3) +
534534
geom_vline(aes(xintercept = 0), col = "black") +
535535
suppressWarnings(geom_function(fun = dnorm, aes(colour = "N(0, 1)", fill="N(0, 1)"))) +
@@ -643,7 +643,7 @@ estimate :math:`\theta_0` without sample splitting. Again we observe a bias from
643643
}
644644

645645
g_nosplit = ggplot(data.frame(theta_rescaled=(theta_orth_po_nosplit - alpha)/se_orth_po_nosplit), aes(x = theta_rescaled)) +
646-
geom_histogram(aes(y=..density.., x=theta_rescaled, colour = "Double ML (no sample splitting)", fill="Double ML (no sample splitting)"),
646+
geom_histogram(aes(y=after_stats(density), x=theta_rescaled, colour = "Double ML (no sample splitting)", fill="Double ML (no sample splitting)"),
647647
bins = 30, alpha = 0.3) +
648648
geom_vline(aes(xintercept = 0), col = "black") +
649649
suppressWarnings(geom_function(fun = dnorm, aes(colour = "N(0, 1)", fill="N(0, 1)"))) +
@@ -735,7 +735,7 @@ Using sample splitting, overcomes the bias induced by overfitting.
735735
}
736736

737737
g_dml = ggplot(data.frame(theta_rescaled=(theta_dml_po - alpha)/se_dml_po), aes(x = theta_rescaled)) +
738-
geom_histogram(aes(y=..density.., x=theta_rescaled, colour = "Double ML with cross-fitting", fill="Double ML with cross-fitting"),
738+
geom_histogram(aes(y=after_stats(density), x=theta_rescaled, colour = "Double ML with cross-fitting", fill="Double ML with cross-fitting"),
739739
bins = 30, alpha = 0.3) +
740740
geom_vline(aes(xintercept = 0), col = "black") +
741741
suppressWarnings(geom_function(fun = dnorm, aes(colour = "N(0, 1)", fill="N(0, 1)"))) +
@@ -780,11 +780,11 @@ Using sample splitting, overcomes the bias induced by overfitting.
780780
g_all = ggplot(data.frame(t_nonorth=(theta_nonorth - alpha)/se_nonorth,
781781
t_orth_nosplit=(theta_orth_po_nosplit - alpha)/se_orth_po_nosplit,
782782
t_dml=(theta_dml_po - alpha)/se_dml_po)) +
783-
geom_histogram(aes(x = t_nonorth, y=..density.., colour = "Non-orthogonal ML", fill="Non-orthogonal ML"),
783+
geom_histogram(aes(x = t_nonorth, y=after_stats(density), colour = "Non-orthogonal ML", fill="Non-orthogonal ML"),
784784
bins = 30, alpha = 0.3) +
785-
geom_histogram(aes(x = t_orth_nosplit, y=..density.., colour = "Double ML (no sample splitting)", fill="Double ML (no sample splitting)"),
785+
geom_histogram(aes(x = t_orth_nosplit, y=after_stats(density), colour = "Double ML (no sample splitting)", fill="Double ML (no sample splitting)"),
786786
bins = 30, alpha = 0.3) +
787-
geom_histogram(aes(x = t_dml, y=..density.., colour = "Double ML with cross-fitting", fill="Double ML with cross-fitting"),
787+
geom_histogram(aes(x = t_dml, y=after_stats(density), colour = "Double ML with cross-fitting", fill="Double ML with cross-fitting"),
788788
bins = 30, alpha = 0.3) +
789789
geom_vline(aes(xintercept = 0), col = "black") +
790790
suppressWarnings(geom_function(fun = dnorm, aes(colour = "N(0, 1)", fill="N(0, 1)"))) +

0 commit comments

Comments
 (0)