setwd("~/Dropbox/Research/Gerald/")
p<-read.csv ("AI Help Airport Pilot.csv", header=T, sep=",")
p<-read.csv ("AI Help Airport Study 1.csv", header=T, sep=",")
table(p$Condition)
##
## AI No AI
## 196 194
#R feedback = round by round, End feedback = only feedback at the end
table(p$Feedback)
##
## End R
## 188 202
#Constructing the DV - how many rounds people complete. Surprisingly some people actually complete many rounds without incentive.
p[is.na(p)]<-0
p$DV<-(p$Q279 + p$Q286 + p$Q293 + p$Q300 + p$Q307+ p$Q314 + p$Q321 + p$Q328 + p$Q335 +
p$Q342 + p$Q349 + p$Q356 + p$Q363 + p$Q370 + p$Q377 + p$Q384+ p$Q391+p$Q398
+ p$Q405+p$Q412+p$Q419+p$Q426+p$Q440+p$Q447+p$Q454+p$Q461+p$Q468+p$Q475)
table(p$DV)
##
## 0 1 2 3 4 5 6 7 8 9 10 11 13 14 15 16 17 18
## 121 53 43 34 40 14 23 11 10 3 2 3 3 4 2 2 1 2
## 20 21 24 25 28
## 1 1 1 2 14
hist(p$DV)

p$DVnorm<-sqrt(p$DV)
hist(p$DVnorm)

p$DVbinary[p$DV==0]<-0
p$DVbinary[p$DV!=0]<-1
#Using condition (AI vs. no AI) and feedback timing to predict the DV
summary(aov(DV ~ Condition * Feedback, p))
## Df Sum Sq Mean Sq F value Pr(>F)
## Condition 1 13 12.9 0.346 0.55649
## Feedback 1 365 365.4 9.788 0.00189 **
## Condition:Feedback 1 116 115.7 3.099 0.07913 .
## Residuals 386 14409 37.3
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(aov(DVnorm ~ Condition * Feedback, p))
## Df Sum Sq Mean Sq F value Pr(>F)
## Condition 1 0.5 0.460 0.260 0.610
## Feedback 1 28.3 28.283 16.007 7.57e-05 ***
## Condition:Feedback 1 3.9 3.943 2.232 0.136
## Residuals 386 682.0 1.767
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Poisson regression
summary(glm(DV ~ Condition * Feedback, p, family=poisson))
##
## Call:
## glm(formula = DV ~ Condition * Feedback, family = poisson, data = p)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -3.365 -2.419 -1.150 0.326 9.042
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.21876 0.05608 21.734 < 2e-16 ***
## ConditionNo AI -0.25266 0.08481 -2.979 0.00289 **
## FeedbackR 0.22470 0.07389 3.041 0.00236 **
## ConditionNo AI:FeedbackR 0.54263 0.10618 5.110 3.22e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 2643.2 on 389 degrees of freedom
## Residual deviance: 2521.0 on 386 degrees of freedom
## AIC: 3388.2
##
## Number of Fisher Scoring iterations: 6
#Binary DV
summary(aov(DVbinary ~ Condition * Feedback, p))
## Df Sum Sq Mean Sq F value Pr(>F)
## Condition 1 0.18 0.1800 0.861 0.354000
## Feedback 1 2.53 2.5290 12.096 0.000563 ***
## Condition:Feedback 1 0.05 0.0459 0.220 0.639613
## Residuals 386 80.70 0.2091
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#No effect of condition
summary(lm(DV ~ Condition, p))
##
## Call:
## lm(formula = DV ~ Condition, data = p)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.1907 -3.8265 -2.0086 0.8093 24.1735
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.8265 0.4425 8.648 <2e-16 ***
## ConditionNo AI 0.3642 0.6274 0.580 0.562
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 6.195 on 388 degrees of freedom
## Multiple R-squared: 0.0008677, Adjusted R-squared: -0.001707
## F-statistic: 0.337 on 1 and 388 DF, p-value: 0.5619
summary(lm(DVnorm ~ Condition, p))
##
## Call:
## lm(formula = DVnorm ~ Condition, data = p)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.5093 -1.4406 -0.0608 0.7267 3.8509
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.44065 0.09691 14.87 <2e-16 ***
## ConditionNo AI 0.06869 0.13741 0.50 0.617
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.357 on 388 degrees of freedom
## Multiple R-squared: 0.0006437, Adjusted R-squared: -0.001932
## F-statistic: 0.2499 on 1 and 388 DF, p-value: 0.6174
#Poission
summary(glm(DV ~ Condition, p, family=poisson))
##
## Call:
## glm(formula = DV ~ Condition, family = poisson, data = p)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.8951 -2.7664 -1.1106 0.3835 7.9440
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.34196 0.03651 36.751 <2e-16 ***
## ConditionNo AI 0.09091 0.05063 1.796 0.0725 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 2643.2 on 389 degrees of freedom
## Residual deviance: 2640.0 on 388 degrees of freedom
## AIC: 3503.1
##
## Number of Fisher Scoring iterations: 6
#Obvious effect of feedback timing - round by round increases persistence.
summary(lm(DV ~ Feedback, p))
##
## Call:
## lm(formula = DV ~ Feedback, data = p)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.9406 -3.0053 -2.0053 0.9947 24.9947
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.0053 0.4464 6.732 6.05e-11 ***
## FeedbackR 1.9353 0.6203 3.120 0.00195 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 6.121 on 388 degrees of freedom
## Multiple R-squared: 0.02447, Adjusted R-squared: 0.02196
## F-statistic: 9.733 on 1 and 388 DF, p-value: 0.001945
summary(lm(DVnorm ~ Feedback, p))
##
## Call:
## lm(formula = DVnorm ~ Feedback, data = p)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.7344 -1.1959 -0.1959 0.7150 4.0956
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.19585 0.09701 12.327 < 2e-16 ***
## FeedbackR 0.53859 0.13479 3.996 7.72e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.33 on 388 degrees of freedom
## Multiple R-squared: 0.03952, Adjusted R-squared: 0.03705
## F-statistic: 15.97 on 1 and 388 DF, p-value: 7.722e-05
summary(glm(DV ~ Feedback, p, family=poisson))
##
## Call:
## glm(formula = DV ~ Feedback, family = poisson, data = p)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -3.1434 -2.4517 -1.3453 0.4609 8.6598
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.10038 0.04207 26.156 <2e-16 ***
## FeedbackR 0.49710 0.05265 9.442 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 2643.2 on 389 degrees of freedom
## Residual deviance: 2550.8 on 388 degrees of freedom
## AIC: 3413.9
##
## Number of Fisher Scoring iterations: 6
#Breaking down the (non-significant) interaction
rbr<-subset(p, Feedback=="R")
end<-subset(p, Feedback=="End")
#Directional positive effect of AI in the round by round conditions - persistence is higher with No AI
summary(lm(DV ~ Condition, rbr))
##
## Call:
## lm(formula = DV ~ Condition, data = rbr)
##
## Residuals:
## Min 1Q Median 3Q Max
## -5.6600 -4.2353 -2.2353 0.7647 23.7647
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.2353 0.6671 6.349 1.43e-09 ***
## ConditionNo AI 1.4247 0.9481 1.503 0.135
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 6.738 on 200 degrees of freedom
## Multiple R-squared: 0.01116, Adjusted R-squared: 0.006219
## F-statistic: 2.258 on 1 and 200 DF, p-value: 0.1345
summary(lm(DVnorm ~ Condition, rbr))
##
## Call:
## lm(formula = DVnorm ~ Condition, data = rbr)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.8684 -0.8684 -0.1364 0.6330 3.6884
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.6031 0.1377 11.642 <2e-16 ***
## ConditionNo AI 0.2654 0.1957 1.356 0.177
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.391 on 200 degrees of freedom
## Multiple R-squared: 0.00911, Adjusted R-squared: 0.004156
## F-statistic: 1.839 on 1 and 200 DF, p-value: 0.1766
summary(glm(DV ~ Condition, rbr, family = poisson))
##
## Call:
## glm(formula = DV ~ Condition, family = poisson, data = rbr)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -3.3645 -2.4193 -1.2122 0.3612 7.6316
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.44345 0.04811 30.003 < 2e-16 ***
## ConditionNo AI 0.28997 0.06388 4.539 5.65e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 1427.4 on 201 degrees of freedom
## Residual deviance: 1406.6 on 200 degrees of freedom
## AIC: 1922.1
##
## Number of Fisher Scoring iterations: 5
#Very small positive effect of AI in the Feedback at the End conditions
summary(lm(DV ~ Condition, end))
##
## Call:
## lm(formula = DV ~ Condition, data = end)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.383 -2.628 -1.628 0.617 25.372
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.3830 0.5521 6.127 5.22e-09 ***
## ConditionNo AI -0.7553 0.7808 -0.967 0.335
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 5.353 on 186 degrees of freedom
## Multiple R-squared: 0.005005, Adjusted R-squared: -0.000344
## F-statistic: 0.9357 on 1 and 186 DF, p-value: 0.3346
summary(lm(DVnorm ~ Condition, end))
##
## Call:
## lm(formula = DVnorm ~ Condition, data = end)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.2644 -1.1273 -0.1273 0.7356 4.1642
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.2644 0.1300 9.730 <2e-16 ***
## ConditionNo AI -0.1371 0.1838 -0.746 0.457
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.26 on 186 degrees of freedom
## Multiple R-squared: 0.002983, Adjusted R-squared: -0.002378
## F-statistic: 0.5564 on 1 and 186 DF, p-value: 0.4566
summary(glm(DV ~ Condition, end, family = poisson))
##
## Call:
## glm(formula = DV ~ Condition, family = poisson, data = end)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.601 -2.292 -1.150 0.326 9.042
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.21876 0.05608 21.734 < 2e-16 ***
## ConditionNo AI -0.25266 0.08481 -2.979 0.00289 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 1123.4 on 187 degrees of freedom
## Residual deviance: 1114.4 on 186 degrees of freedom
## AIC: 1466.1
##
## Number of Fisher Scoring iterations: 6
#How enjoyable was the task? No interaction between condition and Feedback timing
summary(aov(enjoyable ~ Condition * Feedback, p))
## Df Sum Sq Mean Sq F value Pr(>F)
## Condition 1 2.6 2.621 2.017 0.1563
## Feedback 1 7.0 7.043 5.421 0.0204 *
## Condition:Feedback 1 2.8 2.808 2.162 0.1423
## Residuals 386 501.4 1.299
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#There's a directional effect of condition - people enjoy it more without AI
summary(lm(enjoyable ~ Condition, p))
##
## Call:
## lm(formula = enjoyable ~ Condition, data = p)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.06701 -0.90306 0.09694 0.93299 2.09694
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.9031 0.0820 35.41 <2e-16 ***
## ConditionNo AI 0.1640 0.1163 1.41 0.159
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.148 on 388 degrees of freedom
## Multiple R-squared: 0.005099, Adjusted R-squared: 0.002535
## F-statistic: 1.989 on 1 and 388 DF, p-value: 0.1593
#Significant effect of timing, more enjoyable with round by round feedback
summary(lm(enjoyable ~ Feedback, p))
##
## Call:
## lm(formula = enjoyable ~ Feedback, data = p)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.8457 -0.8457 0.1543 0.8861 2.1543
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.84574 0.08336 34.137 <2e-16 ***
## FeedbackR 0.26812 0.11583 2.315 0.0211 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.143 on 388 degrees of freedom
## Multiple R-squared: 0.01362, Adjusted R-squared: 0.01108
## F-statistic: 5.358 on 1 and 388 DF, p-value: 0.02115
#Means by condition (Persistence DV)
AIr<-subset(rbr, Condition=="AI")
AIe<-subset(end, Condition=="AI")
NoAIr<-subset(rbr, Condition=="No AI")
NoAIe<-subset(end, Condition=="No AI")
mean(AIr$DV)
## [1] 4.235294
mean(AIe$DV)
## [1] 3.382979
mean(NoAIr$DV)
## [1] 5.66
mean(NoAIe$DV)
## [1] 2.62766