options(help_type="html") library(sensR) ################################# ## Bi et al 1997 has an example using the following four protocols: n <- c(40, 40, 40, 40) x <- c(25, 25, 30, 35) protocol <- c("triangle", "duotrio", "threeAFC", "twoAFC") ## Lets start by getting an overview of the data: dprime_table(x, n, protocol) ## Notice that this is just the same as discrim(): discrim(25, 40, method="triangle") ################################# ## The any-differences test: dprime_compare(x, n, protocol) ## Lets look at the arguments that dprime_compare takes: args(dprime_compare) ## so we can get the weighted average estimate of d-prime with dprime_compare(x, n, protocol, estim="weighted.avg") ## Could also change the confidence level: dprime_compare(x, n, protocol, conf.level= 0.90) ################################# ## Test of common d-prime: dprime_test(x, n, protocol) (dpfit <- dprime_test(x, n, protocol)) dpfit ## which kind of test is provided here? ## what are the conclusions? ## Could we test the same for the data individually? posthoc(dpfit, test="zero", padj.method="none") ## Notice how much stronger the joint test is. ## Lets look at the arguments for dprime_test: args(dprime_test) ## So we could do a similarity test with: dprime_test(x, n, protocol, alternative="similarity", dprime0=1.9) ## Notice that none of the individual tests would be significant: posthoc(dpfit, test=1.9, alternative = "less", padj.method="none") ################################################################## ## Memo rules: ## dprime_compare: The any-differences hypothesis One p-value ## dprime_test: Tests of common d-prime One p-value ## posthoc: Tests involving individual d-primes Many p-values ################################################################## ## Post-hoc comparisons ################################################################## ## All pairwise comparisons: posthoc(dpfit) posthoc(dpfit, padj.method="none") ## alternatively: posthoc(dpfit, test="pairwise") ?p.adjust ## a little borring, so here are some other data: x2 <- c(30, 22, 35, 30) (dpfit2 <- dprime_compare(x2, n, protocol)) posthoc(dpfit2, test="pairwise") dprime_table(x2, n, protocol) ################################# ## Test *some* pairwise comparisons: ## Assume d' from group 2 is a _standard_ ## now perform all comparisons with group 2: posthoc(dpfit2, test="base", base=2) ################################# ## Test: different from common d-prime: posthoc(dpfit, test="common") posthoc(dpfit2, test="common", padj="none") ## recall the common d-prime: coef(dprime_test(x, n, protocol)) (d.c <- coef(dprime_test(x, n, protocol))[1, 1]) ## now consider the test: posthoc(dpfit, test=d.c, padj="none") ## So what is the difference here? ################################# ## Test: different from specific value: ## test if dprimes are different from zero: posthoc(dpfit, test=0, padj="none") ## Alternatively: posthoc(dpfit, test="zero", padj="none") ?posthoc args(posthoc) ################################################################## ### Misc: discrim(20, 20, method="triangle", statistic="likelihood") discrim(20, 20, method="triangle", statistic="Wald") discrim(4, 20, method="triangle", statistic="likelihood") discrim(4, 20, method="triangle", statistic="Wald")