Calculates identities Z1 to Z18 as defined in (Costello and Watts 2016; Zhu et al. 2020) . Probability theory predicts that these will all equal 0.
Z_identities(
a = NULL,
b = NULL,
a_and_b = NULL,
a_or_b = NULL,
a_given_b = NULL,
b_given_a = NULL,
a_given_not_b = NULL,
b_given_not_a = NULL,
a_and_not_b = NULL,
b_and_not_a = NULL,
not_a = NULL,
not_b = NULL
)
Dataframe with identities Z1 to Z18
If some of the probability estimates are not given, calculation will proceed and equalities that cannot be calculated will be coded as NA.
Z_identities(
a=.5,
b=.1,
a_and_b=.05,
a_or_b=.55,
a_given_b=.5,
b_given_a=.1,
a_given_not_b=.5,
b_given_not_a=.1,
a_and_not_b=.45,
b_and_not_a=.05,
)
#> z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13 z14 z15 z16 z17 z18
#> 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#Get identities for a set of participants
library(magrittr)
library(dplyr)
library(tidyr)
data.frame(
ID = LETTERS[1:20],
a=runif(20),
b=runif(20),
a_and_b=runif(20),
a_or_b=runif(20),
a_given_b=runif(20),
b_given_a=runif(20),
a_given_not_b=runif(20),
b_given_not_a=runif(20),
a_and_not_b=runif(20),
b_and_not_a=runif(20),
not_a=runif(20),
not_b=runif(20)
) %>%
group_by(ID) %>%
do(
Z_identities(
.$a,
.$b,
.$a_and_b,
.$a_or_b,
.$a_given_b,
.$b_given_a,
.$a_given_not_b,
.$b_given_not_a,
.$a_and_not_b,
.$b_and_not_a,
.$not_a,
.$not_b
)
)
#> # A tibble: 20 × 19
#> # Groups: ID [20]
#> ID z1 z2 z3 z4 z5 z6 z7 z8 z9
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 A -1.13 -0.518 -0.0802 0.438 1.57 1.05 1.49 2.63 0.0880
#> 2 B 0.740 -0.578 0.646 1.22 0.484 -0.0943 1.13 0.389 -0.272
#> 3 C 0.124 -0.181 0.887 1.07 0.944 0.762 1.83 1.71 -0.0505
#> 4 D -0.643 -0.543 -0.102 0.442 1.08 0.541 0.983 1.63 0.0225
#> 5 E 0.296 -0.893 0.264 1.16 0.862 -0.0317 1.13 0.830 0.468
#> 6 F 0.251 -1.16 0.381 1.55 1.29 0.130 1.68 1.42 0.370
#> 7 G -1.17 0.220 0.0348 -0.185 0.983 1.20 1.02 2.19 -0.232
#> 8 H -0.713 -0.208 -0.00549 0.203 0.916 0.708 0.910 1.62 -0.0783
#> 9 I -0.0864 0.432 0.875 0.443 0.529 0.961 1.40 1.49 0.0923
#> 10 J 0.793 -0.474 0.658 1.13 0.338 -0.136 0.996 0.203 -0.605
#> 11 K -0.00206 0.930 1.38 0.451 0.453 1.38 1.83 1.84 -0.589
#> 12 L -0.286 0.0328 0.125 0.0925 0.379 0.412 0.504 0.790 -0.119
#> 13 M 0.132 0.0904 0.368 0.277 0.145 0.235 0.513 0.380 0.156
#> 14 N -0.0407 -0.372 0.742 1.11 1.15 0.783 1.90 1.94 0.254
#> 15 O -0.00232 0.313 0.840 0.527 0.529 0.843 1.37 1.37 -0.0568
#> 16 P -0.172 -0.886 0.276 1.16 1.33 0.448 1.61 1.78 0.00642
#> 17 Q 0.529 -0.0647 0.933 0.997 0.468 0.404 1.40 0.872 0.242
#> 18 R -0.261 -0.520 0.276 0.797 1.06 0.538 1.33 1.60 0.743
#> 19 S -0.353 0.240 -0.0850 -0.325 0.0278 0.268 -0.0572 0.296 -0.222
#> 20 T 0.453 1.02 1.59 0.570 0.117 1.14 1.71 1.25 -0.517
#> # ℹ 9 more variables: z10 <dbl>, z11 <dbl>, z12 <dbl>, z13 <dbl>, z14 <dbl>,
#> # z15 <dbl>, z16 <dbl>, z17 <dbl>, z18 <dbl>