Scripts for the study: “Dogs (Canis lupus familiaris) are susceptible to the Kanizsa’s triangle illusion”

Individual analysis

Performing a two-tailed binomial test for each individual dog to assess if their choices were not different from chance level in the test trials

Subject 1
binom.test(16, 25, 1/2)
## 
##  Exact binomial test
## 
## data:  16 and 25
## number of successes = 16, number of trials = 25, p-value = 0.2295
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.4252063 0.8202832
## sample estimates:
## probability of success 
##                   0.64
Subject 2
binom.test(22, 25, 1/2)
## 
##  Exact binomial test
## 
## data:  22 and 25
## number of successes = 22, number of trials = 25, p-value = 0.0001565
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.6878097 0.9745346
## sample estimates:
## probability of success 
##                   0.88
Subject 3
binom.test(21, 25, 1/2)
## 
##  Exact binomial test
## 
## data:  21 and 25
## number of successes = 21, number of trials = 25, p-value = 0.0009105
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.6391715 0.9546205
## sample estimates:
## probability of success 
##                   0.84
Subject 4
binom.test(24, 25, 1/2)
## 
##  Exact binomial test
## 
## data:  24 and 25
## number of successes = 24, number of trials = 25, p-value = 1.55e-06
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.7964831 0.9989878
## sample estimates:
## probability of success 
##                   0.96
Subject 5
binom.test(23, 25, 1/2)
## 
##  Exact binomial test
## 
## data:  23 and 25
## number of successes = 23, number of trials = 25, p-value = 1.943e-05
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.7396942 0.9901604
## sample estimates:
## probability of success 
##                   0.92
Subject 6
binom.test(22, 25, 1/2)
## 
##  Exact binomial test
## 
## data:  22 and 25
## number of successes = 22, number of trials = 25, p-value = 0.0001565
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.6878097 0.9745346
## sample estimates:
## probability of success 
##                   0.88

Group analysis

Performing a one-sample two-tailed Student’s t test on the dogs’ mean choices in the test trials

x<-c(0.64, 0.88, 0.84, 0.96, 0.92, 0.88)
t.test(x, mu = 0.5, alternative = "two.sided")
## 
##  One Sample t-test
## 
## data:  x
## t = 7.7144, df = 5, p-value = 0.0005843
## alternative hypothesis: true mean is not equal to 0.5
## 95 percent confidence interval:
##  0.7355968 0.9710698
## sample estimates:
## mean of x 
## 0.8533333
library(effsize)
## Warning: package 'effsize' was built under R version 4.0.2
cohen.d(x, NA, mu=0.5)
## 
## Cohen's d (single sample)
## 
## d estimate: 3.14941 (large)
## Reference mu: 0.5
## 95 percent confidence interval:
##       lower       upper 
## 0.008213887 6.290606736

Additional analysis

Importing and assessing the data

library(readxl)
Kanizsa <- read_excel("/Volumes/ResearchData2/Kanizsa.xlsx", 
    col_types = c("text", "numeric", "numeric", 
        "numeric"))
mean(Kanizsa$Age)
## [1] 4.3
sd(Kanizsa$Age)
## [1] 2.615134
mean(Kanizsa$Training)
## [1] 84.83333
sd(Kanizsa$Training)
## [1] 23.92253

Performing a repeated measures binomial logistic regression to analyze if the age of the dog or the length of the training phase affected the choices in the test phase

library(lme4)
## Loading required package: Matrix
model <- glmer(Choice ~ (1|Dog) + Age  + Training, data=Kanizsa, family = "binomial")
## boundary (singular) fit: see ?isSingular
summary(model)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: Choice ~ (1 | Dog) + Age + Training
##    Data: Kanizsa
## 
##      AIC      BIC   logLik deviance df.resid 
##    123.0    135.0    -57.5    115.0      146 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.7581  0.2661  0.3296  0.3787  0.7308 
## 
## Random effects:
##  Groups Name        Variance Std.Dev.
##  Dog    (Intercept) 0        0       
## Number of obs: 150, groups:  Dog, 6
## 
## Fixed effects:
##             Estimate Std. Error z value Pr(>|z|)   
## (Intercept)  2.13219    0.95670   2.229  0.02583 * 
## Age         -0.31427    0.10487  -2.997  0.00273 **
## Training     0.01359    0.01316   1.033  0.30163   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##          (Intr) Age   
## Age       0.112       
## Training -0.839 -0.595
## convergence code: 0
## boundary (singular) fit: see ?isSingular
library(effectsize)
## Registered S3 method overwritten by 'parameters':
##   method     from      
##   ci.blavaan bayestestR
cohens_d(Age ~ Choice, data = Kanizsa)
## Cohen's d |       95% CI
## ------------------------
## 0.73      | [0.27, 1.19]
## 
## - Estimated using pooled SD.
cohens_d(Training ~ Choice, data = Kanizsa)
## Cohen's d |        95% CI
## -------------------------
## 0.17      | [-0.28, 0.62]
## 
## - Estimated using pooled SD.