53
53
# ' corresponding `yrep` values. `100 * prob`% central simultaneous confidence
54
54
# ' intervals are provided to asses if ´y´ and ´yrep´ originate from the same
55
55
# ' distribution. The PIT values can also be provided directly as `pit`.
56
- # ' See Säilynoja et al. for more details.}
56
+ # ' See Säilynoja et al. (2021) for more details.}
57
57
# ' }
58
58
# '
59
59
# ' @template reference-vis-paper
@@ -568,7 +568,10 @@ ppc_pit_ecdf <- function(y,
568
568
dplyr :: group_map(~ mean(.x $ value [.x $ is_y ] > = .x $ value [! .x $ is_y ])) %> %
569
569
unlist()
570
570
if (is.null(K )) {
571
- K <- min(length(unique(ppc_data(y , yrep )$ rep_id )) + 1 , length(pit ))
571
+ K <- min(
572
+ length(unique(ppc_data(y , yrep )$ rep_id )) + 1 ,
573
+ length(pit )
574
+ )
572
575
}
573
576
} else {
574
577
inform(" 'pit' specified so ignoring 'y', and 'yrep' if specified." )
@@ -578,11 +581,11 @@ ppc_pit_ecdf <- function(y,
578
581
}
579
582
}
580
583
N <- length(pit )
581
- gamma <- adjust_gamma(N ,
584
+ gamma <- adjust_gamma(N = N ,
582
585
K = K ,
583
586
prob = prob ,
584
587
interpolate_adj = interpolate_adj )
585
- lims <- ecdf_intervals(N , K = K , gamma = gamma )
588
+ lims <- ecdf_intervals(gamma = gamma , N = N , K = K )
586
589
ggplot() +
587
590
aes_(
588
591
x = 1 : K / K ,
@@ -630,15 +633,15 @@ ppc_pit_ecdf_grouped <-
630
633
K <- length(unique(ppc_data(y , yrep )$ rep_id )) + 1
631
634
}
632
635
} else {
633
- inform(" 'pit' specified so ignoring 'y', and 'yrep' if specified." )
636
+ inform(" 'pit' specified so ignoring 'y' and 'yrep' if specified." )
634
637
pit <- validate_pit(pit )
635
638
}
636
639
N <- length(pit )
637
640
638
641
gammas <- lapply(unique(group ), function (g ) {
639
642
N_g <- sum(group == g )
640
643
adjust_gamma(
641
- N_g ,
644
+ N = N_g ,
642
645
K = min(N_g , K ),
643
646
prob = prob ,
644
647
interpolate_adj = interpolate_adj
@@ -653,18 +656,19 @@ ppc_pit_ecdf_grouped <-
653
656
seq(0 , 1 , length.out = min(nrow(.x ), K ))),
654
657
group = .y [1 ],
655
658
lims_upper = ecdf_intervals(
659
+ gamma = gammas [[unlist(.y [1 ])]],
656
660
N = nrow(.x ),
657
- K = min(nrow(.x ), K ),
658
- gamma = gammas [[unlist(.y [1 ])]]
659
- )$ upper [- 1 ] / nrow(.x ),
661
+ K = min(nrow(.x ), K )
662
+ )$ upper [- 1 ] / nrow(.x ),
660
663
lims_lower = ecdf_intervals(
664
+ gamma = gammas [[unlist(.y [1 ])]],
661
665
N = nrow(.x ),
662
- K = min(nrow(.x ), K ),
663
- gamma = gammas [[unlist(.y [1 ])]]
664
- )$ lower [- 1 ] / nrow(.x ),
666
+ K = min(nrow(.x ), K )
667
+ )$ lower [- 1 ] / nrow(.x ),
665
668
x = seq(0 , 1 , length.out = min(nrow(.x ), K ))
666
669
)) %> %
667
670
dplyr :: bind_rows()
671
+
668
672
ggplot(data ) +
669
673
aes_(
670
674
x = ~ x ,
0 commit comments