library(stringr)
library(ggplot2)
library(foreign)
library(lme4)
## Loading required package: Matrix
## Loading required package: Rcpp
library(data.table)
# from
# https://osf.io/ubst3/osffiles/DataUsedforStereotypeAwarenessExclusion.12.4.2013.sav/version/1/download/
gibson = read.spss("DataUsedforStereotypeAwarenessExclusion.12.4.2013.sav",
to.data.frame = T)
## Warning: DataUsedforStereotypeAwarenessExclusion.12.4.2013.sav: Unrecognized record type 7, subtype 18 encountered in system file
## Warning: DataUsedforStereotypeAwarenessExclusion.12.4.2013.sav: Unrecognized record type 7, subtype 24 encountered in system file
## re-encoding from UTF-8
# from
# https://osf.io/sgw26/osffiles/final_dataset_139_to_send.sav/version/1/download/
moon = read.spss("final_dataset_139_to_send.sav", to.data.frame = T)
## Warning: final_dataset_139_to_send.sav: Unrecognized record type 7, subtype 14 encountered in system file
## Warning: final_dataset_139_to_send.sav: Unrecognized record type 7, subtype 18 encountered in system file
## Warning: final_dataset_139_to_send.sav: Unrecognized record type 7, subtype 24 encountered in system file
## re-encoding from UTF-8
moon$identity_salience = str_match(moon$identity_salience, "^([a-zA-Z]+)")[,
2]
gibson$identity_salience = gibson$IdentityCorrectSalience
gibson$answered_correctly = gibson$AnsweredCorrectly
gibson$questions_attempted = gibson$QuestionsAttempted
gibson$sample = "gibson"
moon$sample = "moon"
moon = as.data.table(moon)
gibson = as.data.table(gibson)
gibson = gibson[, `:=`(aware_include, AwarenessofACStereotype == "Yes" & AwarenessofMFStereotype ==
"Yes")]
moon = moon[, `:=`(aware_include, awareness == "Aware of Both Stereotypes"),
]
gibson$identity_salience = as.character(gibson$identity_salience)
gibson$identity_salience = car::Recode(gibson$identity_salience, "'Asian'='2 Asian';'Control'='0 Control';'Female'='1 Female'")
moon$identity_salience = car::Recode(moon$identity_salience, "'Asian'='2 Asian';'Control'='0 Control';'Female'='1 Female'")
both = rbind(gibson[, list(identity_salience, answered_correctly, aware_include,
sample)], moon[, list(identity_salience, answered_correctly, aware_include,
sample)])
both$identity_salience = as.factor(both$identity_salience)
contrasts(both$identity_salience)
## 1 Female 2 Asian
## 0 Control 0 0
## 1 Female 1 0
## 2 Asian 0 1
gibson$identity_salience = as.factor(gibson$identity_salience)
contrasts(gibson$identity_salience)
## 1 Female 2 Asian
## 0 Control 0 0
## 1 Female 1 0
## 2 Asian 0 1
moon$identity_salience = as.factor(moon$identity_salience)
contrasts(moon$identity_salience)
## 1 Female 2 Asian
## 0 Control 0 0
## 1 Female 1 0
## 2 Asian 0 1
summary(moon)
## identity_salience answered_correctly questions_attempted accuracy
## 0 Control:48 Min. : 0.00 Min. : 2.0 Min. :0.000
## 1 Female :38 1st Qu.: 3.00 1st Qu.: 9.0 1st Qu.:0.333
## 2 Asian :53 Median : 5.00 Median :11.0 Median :0.500
## Mean : 4.84 Mean :10.4 Mean :0.464
## 3rd Qu.: 6.00 3rd Qu.:12.0 3rd Qu.:0.583
## Max. :10.00 Max. :12.0 Max. :0.833
##
## quantitativesatscore
## 800 :24
## 780 : 8
## 720 : 5
## 760 : 5
## 750 : 4
## 650 : 3
## (Other) :90
## QUANT0
## :139
##
##
##
##
##
##
## QUANT1
## :139
##
##
##
##
##
##
## QUANT2
## :139
##
##
##
##
##
##
## QUANT3
## :139
##
##
##
##
##
##
## QUANT4
## :139
##
##
##
##
##
##
## QUANT5
## :139
##
##
##
##
##
##
## QUANT6
## :139
##
##
##
##
##
##
## enjoyment mathtalent testdifficulty
## Strongly Disagree1: 8 Strongly Disagree1:16 Strongly Disagree1: 4
## Disagree2 :23 Disagree2 :26 Disagree2 :14
## Somewhat Disagree3:20 Somewhat Disagree3:25 Somewhat Disagree3:11
## Neutral4 :26 Neutral4 :30 Neutral4 :38
## Somewhat Agree5 :25 Somewhat Agree5 :31 Somewhat Agree5 :45
## Agree6 :30 Agree6 : 9 Agree6 :24
## Strongly Agree7 : 7 Strongly Agree7 : 2 Strongly Agree7 : 3
## perceptionsofperformance
## Strongly Disagree1:15
## Disagree2 :31
## Somewhat Disagree3:33
## Neutral4 :34
## Somewhat Agree5 :21
## Agree6 : 3
## Strongly Agree7 : 2
## guesses
## 1 :22
## 2 :21
## 0 :20
## 3 :20
## 4 :11
## 5 : 9
## (Other) :36
## GUESS0
## :139
##
##
##
##
##
##
## GUESS1
## :139
##
##
##
##
##
##
## GUESS2
## :139
##
##
##
##
##
##
## GUESS3
## :139
##
##
##
##
##
##
## GUESS4
## :139
##
##
##
##
##
##
## GUESS5
## :139
##
##
##
##
##
##
## GUESS6
## :139
##
##
##
##
##
##
## purpose
## no idea : 2
## \r\npeople's perceived ability vs actual ability? Asian stereotypes about math? : 1
## Abilities at math for female versus male, as well as racial classifications : 1
## Analyzing people's perceptions of others and themselves. : 1
## Based on that pretest, I'm thinking it's to see how people who prefer English do on math tests and then see what really are the standards for "sucking at math" for people who say they suck at math, but in reality our "suckiness" might just be the "great" : 1
## compare different individual math ability : 1
## (Other) :132
## PURPO0
## :134
## Then you are probably going to compare the results of the test with the responses of how people thought they did and see if there is a correlation (negative or positive) between scores and confidence. : 1
## . : 1
## e had a pretest about certain stereotypes and other questions that compare our own opinions and what it actually is. At the end of this survey, it ask me on my opinion on how well I scored and other various opinionated questions. Thus, I believe another g: 1
## f someone else. : 1
## feel like that was intentional - to record the first part of the experiment, and then compare it to the second part. The first part had to do with our attitudes towards certain subjects, and this is trying to test for our actual attitudes (or something li: 1
##
## PURPO1
## :137
## al of this experiment is to compare and contrast what people think to what reality shows. : 1
## e that). : 1
##
##
##
##
## PURPO2
## :139
##
##
##
##
##
##
## PURPO3
## :139
##
##
##
##
##
##
## PURPO4
## :139
##
##
##
##
##
##
## PURPO5
## :139
##
##
##
##
##
##
## PURPO6
## :139
##
##
##
##
##
##
## check
## A. There was a theme emphasizing gender (male/female):40
## B. There was a theme emphasizing race/ethnicity :45
## C. Neither a or b :54
##
##
##
##
## mathidentificationscore awareness
## Min. :1.00 Not Aware of Both Stereotypes: 33
## 1st Qu.:2.89 Aware of Both Stereotypes :106
## Median :3.44
## Mean :3.32
## 3rd Qu.:3.89
## Max. :4.78
##
## filter_. sample aware_include
## Not Selected: 33 Length:139 Mode :logical
## Selected :106 Class :character FALSE:33
## Mode :character TRUE :106
## NA's :0
##
##
##
summary(gibson)
## Participant Setting IdentityCorrectSalience DummyFemale
## 100AC : 1 In Lab : 19 Asian :57 Min. :0.00
## 101AC : 1 Public Place:149 Control:53 1st Qu.:0.00
## 102AC : 1 Female :58 Median :1.00
## 103AC : 1 Mean :0.52
## 104AC : 1 3rd Qu.:1.00
## 105AC : 1 Max. :1.00
## (Other) :162 NA's :57
## DummyAsian DummyVariable1 DummyVariable2 SalienceforTtest
## Min. :0.00 AnyoneElse:111 AnyoneElse:110 Min. :1.00
## 1st Qu.:0.00 Asian : 57 Female : 58 1st Qu.:1.00
## Median :1.00 Median :2.00
## Mean :0.51 Mean :1.98
## 3rd Qu.:1.00 3rd Qu.:3.00
## Max. :1.00 Max. :3.00
## NA's :57
## Math1 Math2 Math3 Math4 Math5
## : 2 : 2 : 2 : 2 : 2
## A : 7 0 : 1 0 : 5 0 : 7 0 :17
## B :146 A : 2 A : 6 A : 6 A :20
## C : 5 B : 30 B : 17 B :118 B :13
## D : 1 C :110 C : 12 C : 13 C :15
## E : 7 D : 18 D :100 D : 16 D :79
## E : 5 E : 26 E : 6 E :22
## Math6 Math7 Math8 Math9 Math10
## : 2 : 2 : 2 : 2 : 2
## 0 :10 0 : 6 0 :29 0 :18 0 :34
## A :16 A :22 A : 9 A :14 A : 9
## B :13 B :12 B :18 B :29 B :19
## C :34 C : 9 C :45 C :14 C :17
## D :80 D :32 D :58 D :11 D :65
## E :13 E :85 E : 7 E :80 E :22
## Math11 Math12 AnsweredCorrectly QuestionsAttempted
## : 2 : 2 Min. : 1.00 Min. : 3.0
## 0 :51 0 :39 1st Qu.: 4.00 1st Qu.:10.0
## A : 9 A :16 Median : 6.00 Median :12.0
## B :13 B :10 Mean : 5.95 Mean :10.8
## C :21 C :30 3rd Qu.: 8.00 3rd Qu.:12.0
## D :30 D :33 Max. :12.00 Max. :12.0
## E :42 E :38 NA's :2 NA's :2
## Accuracy SATScore GREScore Enjoyment
## Min. :0.0833 Min. : 23 Min. :164 Min. :1.00
## 1st Qu.:0.3854 1st Qu.:650 1st Qu.:323 1st Qu.:4.00
## Median :0.5635 Median :720 Median :482 Median :5.00
## Mean :0.5602 Mean :665 Mean :482 Mean :4.92
## 3rd Qu.:0.7500 3rd Qu.:785 3rd Qu.:641 3rd Qu.:6.00
## Max. :1.0000 Max. :800 Max. :800 Max. :7.00
## NA's :2 NA's :49 NA's :166 NA's :8
## MathTalent TestDifficulty PerformancePerception Guesses
## Min. :1.00 Min. :1.00 Min. :1.00 Min. : 0.00
## 1st Qu.:3.00 1st Qu.:3.00 1st Qu.:4.00 1st Qu.: 1.00
## Median :4.00 Median :4.00 Median :4.00 Median : 3.00
## Mean :3.96 Mean :3.76 Mean :4.54 Mean : 2.89
## 3rd Qu.:5.00 3rd Qu.:5.00 3rd Qu.:6.00 3rd Qu.: 4.00
## Max. :7.00 Max. :7.00 Max. :7.00 Max. :12.00
## NA's :7 NA's :7 NA's :7 NA's :18
## Motivation
## : 17
## 80% : 1
## Are woman better at language than man? Are men better at math than woman? : 1
## Are women better at English and men better at Math. : 1
## As college students, how disconnected we come from basic math talents : 1
## Assess the math skills of American college students : 1
## (Other) :146
## MathIdentity1 MathIdentity2 MathIdentity3 MathIdentity4
## Min. : 1.00 Min. :1.00 Min. :1.00 Min. :1.00
## 1st Qu.: 3.00 1st Qu.:2.00 1st Qu.:2.00 1st Qu.:3.00
## Median : 4.00 Median :4.00 Median :3.00 Median :4.00
## Mean : 3.91 Mean :3.33 Mean :3.08 Mean :3.76
## 3rd Qu.: 4.00 3rd Qu.:4.00 3rd Qu.:4.00 3rd Qu.:4.00
## Max. :45.00 Max. :5.00 Max. :5.00 Max. :5.00
## NA's :7 NA's :7 NA's :7 NA's :7
## MathIdentity5 MathIdentity6 MathIdentity7 MathIdentity8
## Min. :1.00 Min. :1.00 Min. :1.00 Min. :1.00
## 1st Qu.:3.00 1st Qu.:1.00 1st Qu.:3.00 1st Qu.:1.00
## Median :4.00 Median :2.00 Median :4.00 Median :2.00
## Mean :3.62 Mean :1.75 Mean :3.78 Mean :2.24
## 3rd Qu.:4.00 3rd Qu.:2.00 3rd Qu.:5.00 3rd Qu.:3.00
## Max. :5.00 Max. :5.00 Max. :5.00 Max. :5.00
## NA's :7 NA's :7 NA's :7 NA's :7
## MathIdentity9 MathIdentity10 MathIdentity11 MathIdentity12
## Min. :1.00 Min. :1.00 Min. :1.00 Min. :1.00
## 1st Qu.:3.00 1st Qu.:2.00 1st Qu.:2.00 1st Qu.:2.00
## Median :3.00 Median :3.00 Median :3.00 Median :3.00
## Mean :3.45 Mean :3.21 Mean :2.81 Mean :2.79
## 3rd Qu.:4.00 3rd Qu.:4.00 3rd Qu.:4.00 3rd Qu.:4.00
## Max. :5.00 Max. :5.00 Max. :5.00 Max. :5.00
## NA's :7 NA's :7 NA's :7 NA's :8
## MathIdentity13 MathIdentity14 MathIdentity15 MathIdentity16
## Min. :1.00 Min. :1.00 Min. :1.00 Min. :1.00
## 1st Qu.:3.00 1st Qu.:3.00 1st Qu.:3.00 1st Qu.:3.00
## Median :4.00 Median :4.00 Median :4.00 Median :3.00
## Mean :3.82 Mean :4.08 Mean :3.69 Mean :3.48
## 3rd Qu.:5.00 3rd Qu.:5.00 3rd Qu.:4.00 3rd Qu.:4.00
## Max. :6.00 Max. :5.00 Max. :5.00 Max. :5.00
## NA's :8 NA's :8 NA's :9 NA's :8
## AwarenessofMFStereotype AwarenessofACStereotype AwarenessofBoth ThrowOut
## No : 26 No : 13 Min. :1.00 Yes: 10
## Yes :136 Yes :149 1st Qu.:1.00 No :158
## NA's: 6 NA's: 6 Median :1.00
## Mean :1.22
## 3rd Qu.:1.00
## Max. :2.00
## NA's :136
## filter_. InComparisonSample MathIdentity8Reversed
## Not Selected: 41 Yes: 38 Min. :1.00
## Selected :127 No :130 1st Qu.:3.00
## Median :4.00
## Mean :3.76
## 3rd Qu.:5.00
## Max. :5.00
## NA's :7
## MathIdentification MathIdentificationCategory School
## Min. :1.22 Low : 7 Emory :27
## 1st Qu.:3.00 Medium:59 GATech :72
## Median :3.44 High :93 UGA :33
## Mean :3.45 NA's : 9 AnywhereElse:32
## 3rd Qu.:4.11 NA's : 4
## Max. :5.00
## NA's :7
## SchoolType c_mathid conditionXmathid c_dummyfemale
## MathHeavy :99 Min. :-2.225 Min. :-1.770 Min. :-0.52
## NotsoMathHeavy:65 1st Qu.:-0.447 1st Qu.:-0.333 1st Qu.:-0.52
## NA's : 4 Median :-0.002 Median :-0.002 Median : 0.48
## Mean : 0.000 Mean :-0.036 Mean : 0.00
## 3rd Qu.: 0.664 3rd Qu.: 0.114 3rd Qu.: 0.48
## Max. : 1.553 Max. : 2.238 Max. : 0.48
## NA's :7 NA's :7 NA's :57
## c_dummyasian asianXmathid femaleXmathid identity_salience
## Min. :-0.51 Min. :-1.08 Min. :-0.85 0 Control:53
## 1st Qu.:-0.51 1st Qu.:-0.28 1st Qu.:-0.31 1 Female :58
## Median : 0.49 Median : 0.00 Median : 0.00 2 Asian :57
## Mean : 0.00 Mean : 0.01 Mean :-0.02
## 3rd Qu.: 0.49 3rd Qu.: 0.32 3rd Qu.: 0.23
## Max. : 0.49 Max. : 1.14 Max. : 1.16
## NA's :57 NA's :63 NA's :60
## answered_correctly questions_attempted sample aware_include
## Min. : 1.00 Min. : 3.0 Length:168 Mode :logical
## 1st Qu.: 4.00 1st Qu.:10.0 Class :character FALSE:32
## Median : 6.00 Median :12.0 Mode :character TRUE :130
## Mean : 5.95 Mean :10.8 NA's :6
## 3rd Qu.: 8.00 3rd Qu.:12.0
## Max. :12.00 Max. :12.0
## NA's :2 NA's :2
theme_set(theme_minimal(base_size = 18))
qplot(moon$answered_correctly)
## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust this.
ggplot(moon) + geom_bar(aes(x = questions_attempted)) # ceiling effects, which will hamper accuracy data too
## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust this.
ggplot(gibson) + geom_bar(aes(x = questions_attempted)) # in both samples
## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust this.
ggplot(moon) + geom_bar(aes(x = accuracy))
## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust this.
ggplot(gibson) + geom_bar(aes(x = accuracy))
## Error: object 'accuracy' not found
ggplot(moon) + geom_bar(aes(x = answered_correctly)) # looking better
## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust this.
ggplot(gibson) + geom_bar(aes(x = answered_correctly))
## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust this.
ggplot(moon) + geom_jitter(aes(x = accuracy, y = answered_correctly))
ggplot(gibson) + geom_jitter(aes(x = accuracy, y = answered_correctly))
## Error: object 'accuracy' not found
ggplot(moon) + geom_jitter(aes(x = identity_salience, y = questions_attempted))
ggplot(moon) + geom_jitter(aes(x = identity_salience, y = answered_correctly))
ggplot(moon) + geom_boxplot(aes(x = identity_salience, y = answered_correctly))
ggplot(moon, aes(x = identity_salience, y = answered_correctly)) + geom_jitter(alpha = I(0.5)) +
geom_pointrange(stat = "summary", fun.data = "mean_cl_boot", colour = "red") +
facet_wrap(~aware_include)
ggplot(gibson, aes(x = identity_salience, y = answered_correctly)) + geom_jitter(alpha = I(0.5)) +
geom_pointrange(stat = "summary", fun.data = "mean_cl_boot", colour = "red") +
facet_wrap(~aware_include)
## Warning: Removed 2 rows containing missing values (stat_summary).
## Warning: Removed 2 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_segment).
ggplot(gibson, aes(x = identity_salience, y = answered_correctly)) + geom_jitter(alpha = I(0.5)) +
geom_pointrange(stat = "summary", fun.data = "mean_cl_boot", colour = "red")
## Warning: Removed 2 rows containing missing values (stat_summary).
## Warning: Removed 2 rows containing missing values (geom_point).
ggplot(both, aes(x = identity_salience, y = answered_correctly)) + geom_jitter(alpha = I(0.5)) +
geom_pointrange(stat = "summary", fun.data = "mean_cl_boot", colour = "red")
## Warning: Removed 2 rows containing missing values (stat_summary).
## Warning: Removed 2 rows containing missing values (geom_point).
t.test(answered_correctly ~ identity_salience, data = gibson[gibson$identity_salience %in%
c("2 Asian", "1 Female"), ])
##
## Welch Two Sample t-test
##
## data: answered_correctly by identity_salience
## t = -1.629, df = 110.7, p-value = 0.1062
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -1.7538 0.1713
## sample estimates:
## mean in group 1 Female mean in group 2 Asian
## 5.655 6.446
t.test(answered_correctly ~ identity_salience, data = gibson[gibson$identity_salience %in%
c("2 Asian", "0 Control"), ])
##
## Welch Two Sample t-test
##
## data: answered_correctly by identity_salience
## t = -1.318, df = 104.6, p-value = 0.1904
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -1.7443 0.3514
## sample estimates:
## mean in group 0 Control mean in group 2 Asian
## 5.750 6.446
t.test(answered_correctly ~ identity_salience, data = gibson[gibson$identity_salience %in%
c("1 Female", "0 Control"), ])
##
## Welch Two Sample t-test
##
## data: answered_correctly by identity_salience
## t = 0.1866, df = 102.9, p-value = 0.8523
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.9129 1.1025
## sample estimates:
## mean in group 0 Control mean in group 1 Female
## 5.750 5.655
t.test(answered_correctly ~ identity_salience, data = moon[moon$identity_salience %in%
c("2 Asian", "1 Female"), ])
##
## Welch Two Sample t-test
##
## data: answered_correctly by identity_salience
## t = -0.5869, df = 84.14, p-value = 0.5589
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -1.1178 0.6084
## sample estimates:
## mean in group 1 Female mean in group 2 Asian
## 4.500 4.755
t.test(answered_correctly ~ identity_salience, data = moon[moon$identity_salience %in%
c("2 Asian", "0 Control"), ])
##
## Welch Two Sample t-test
##
## data: answered_correctly by identity_salience
## t = 1.12, df = 98.96, p-value = 0.2653
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.3498 1.2570
## sample estimates:
## mean in group 0 Control mean in group 2 Asian
## 5.208 4.755
t.test(answered_correctly ~ identity_salience, data = moon[moon$identity_salience %in%
c("1 Female", "0 Control"), ])
##
## Welch Two Sample t-test
##
## data: answered_correctly by identity_salience
## t = 1.684, df = 78.72, p-value = 0.09607
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.1288 1.5454
## sample estimates:
## mean in group 0 Control mean in group 1 Female
## 5.208 4.500
t.test(answered_correctly ~ identity_salience, data = both[both$identity_salience %in%
c("2 Asian", "1 Female"), ])
##
## Welch Two Sample t-test
##
## data: answered_correctly by identity_salience
## t = -1.237, df = 202.7, p-value = 0.2176
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -1.1050 0.2531
## sample estimates:
## mean in group 1 Female mean in group 2 Asian
## 5.198 5.624
t.test(answered_correctly ~ identity_salience, data = both[aware_include ==
T & identity_salience %in% c("2 Asian", "1 Female"), ])
##
## Welch Two Sample t-test
##
## data: answered_correctly by identity_salience
## t = -1.904, df = 152.4, p-value = 0.05881
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -1.59407 0.02948
## sample estimates:
## mean in group 1 Female mean in group 2 Asian
## 5.097 5.880
summary(m1 <- glm(answered_correctly ~ identity_salience, data = gibson2, family = poisson))
## Error: error in evaluating the argument 'object' in selecting a method for function 'summary': Error in is.data.frame(data) : object 'gibson2' not found
## Calls: glm ... <Anonymous> -> model.frame.default -> is.data.frame
summary(m1 <- glm(answered_correctly ~ SATScore + identity_salience, data = gibson2,
family = poisson))
## Error: error in evaluating the argument 'object' in selecting a method for function 'summary': Error in is.data.frame(data) : object 'gibson2' not found
## Calls: glm ... <Anonymous> -> model.frame.default -> is.data.frame
gibson2 = gibson[aware_include == TRUE, ]
moon2 = moon[aware_include == TRUE, ]
both2 = both[aware_include == TRUE, ]
moon2$identity_salience = as.factor(moon2$identity_salience)
summary(m1 <- glm(answered_correctly ~ identity_salience, data = moon2, family = poisson))
##
## Call:
## glm(formula = answered_correctly ~ identity_salience, family = poisson,
## data = moon2)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.931 -0.662 -0.114 0.511 2.051
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.6466 0.0722 22.82 <2e-16 ***
## identity_salience1 Female -0.1888 0.1176 -1.61 0.11
## identity_salience2 Asian -0.0710 0.1007 -0.71 0.48
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 98.316 on 105 degrees of freedom
## Residual deviance: 95.699 on 103 degrees of freedom
## AIC: 455.2
##
## Number of Fisher Scoring iterations: 4
t.test(answered_correctly ~ identity_salience, data = both2[both2$identity_salience %in%
c("2 Asian", "1 Female"), ])
##
## Welch Two Sample t-test
##
## data: answered_correctly by identity_salience
## t = -1.904, df = 152.4, p-value = 0.05881
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -1.59407 0.02948
## sample estimates:
## mean in group 1 Female mean in group 2 Asian
## 5.097 5.880
wilcox.test(answered_correctly ~ identity_salience, data = both2[both2$identity_salience %in%
c("2 Asian", "1 Female"), ], conf.int = T)
##
## Wilcoxon rank sum test with continuity correction
##
## data: answered_correctly by identity_salience
## W = 2516, p-value = 0.08835
## alternative hypothesis: true location shift is not equal to 0
## 95 percent confidence interval:
## -2.000e+00 9.908e-06
## sample estimates:
## difference in location
## -1
t.test(answered_correctly ~ identity_salience, data = both2[both2$identity_salience %in%
c("0 Control", "1 Female"), ])
##
## Welch Two Sample t-test
##
## data: answered_correctly by identity_salience
## t = 0.9916, df = 146.5, p-value = 0.323
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.3816 1.1501
## sample estimates:
## mean in group 0 Control mean in group 1 Female
## 5.481 5.097
t.test(answered_correctly ~ identity_salience, data = both2[both2$identity_salience %in%
c("2 Asian", "0 Control"), ])
##
## Welch Two Sample t-test
##
## data: answered_correctly by identity_salience
## t = -1.023, df = 160, p-value = 0.3079
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -1.1666 0.3705
## sample estimates:
## mean in group 0 Control mean in group 2 Asian
## 5.481 5.880
qplot(rpois(lambda = mean(both2$answered_correctly), n = 200))
## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust this.
qplot(both2$answered_correctly) # pretty much perfect poisson
## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust this.
summary(m1 <- glmer(answered_correctly ~ identity_salience + (1 | sample), data = both2,
family = poisson))
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: poisson ( log )
## Formula: answered_correctly ~ identity_salience + (1 | sample)
## Data: both2
##
## AIC BIC logLik deviance df.resid
## 1083.4 1097.3 -537.7 1075.4 232
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.1037 -0.6776 -0.0073 0.6669 2.7718
##
## Random effects:
## Groups Name Variance Std.Dev.
## sample (Intercept) 0.0133 0.115
## Number of obs: 236, groups: sample, 2
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.6855 0.0944 17.85 <2e-16 ***
## identity_salience1 Female -0.0901 0.0707 -1.27 0.20
## identity_salience2 Asian 0.0807 0.0656 1.23 0.22
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) idn_1F
## idntty_sl1F -0.333
## idntty_sl2A -0.366 0.482
summary(m1 <- glm(answered_correctly ~ identity_salience, data = both2, family = poisson(link = log)))
##
## Call:
## glm(formula = answered_correctly ~ identity_salience, family = poisson(link = log),
## data = both2)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -3.193 -0.823 -0.043 0.622 2.597
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.7014 0.0475 35.85 <2e-16 ***
## identity_salience1 Female -0.0727 0.0705 -1.03 0.30
## identity_salience2 Asian 0.0701 0.0656 1.07 0.29
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 276.2 on 235 degrees of freedom
## Residual deviance: 271.9 on 233 degrees of freedom
## AIC: 1093
##
## Number of Fisher Scoring iterations: 4
summary(aov(formula = answered_correctly ~ identity_salience, data = both2))
## Df Sum Sq Mean Sq F value Pr(>F)
## identity_salience 2 24 11.83 1.92 0.15
## Residuals 233 1437 6.17
contrasts(both2$identity_salience) = contr.treatment(n = c("0 Control", "1 Female",
"2 Asian"), base = 3)
summary(m1 <- glmer(answered_correctly ~ identity_salience + (1 | sample), data = both2,
family = poisson))
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: poisson ( log )
## Formula: answered_correctly ~ identity_salience + (1 | sample)
## Data: both2
##
## AIC BIC logLik deviance df.resid
## 1083.4 1097.3 -537.7 1075.4 232
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.1037 -0.6776 -0.0073 0.6669 2.7718
##
## Random effects:
## Groups Name Variance Std.Dev.
## sample (Intercept) 0.0133 0.115
## Number of obs: 236, groups: sample, 2
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.7662 0.0932 18.95 <2e-16 ***
## identity_salience0 Control -0.0807 0.0656 -1.23 0.219
## identity_salience1 Female -0.1708 0.0695 -2.46 0.014 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) idn_0C
## idntty_sl0C -0.333
## idntty_sl1F -0.313 0.454
summary(m1 <- glm(answered_correctly ~ identity_salience, data = both2, family = poisson(link = log)))
##
## Call:
## glm(formula = answered_correctly ~ identity_salience, family = poisson(link = log),
## data = both2)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -3.193 -0.823 -0.043 0.622 2.597
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.7715 0.0453 39.13 <2e-16 ***
## identity_salience0 Control -0.0701 0.0656 -1.07 0.285
## identity_salience1 Female -0.1428 0.0691 -2.07 0.039 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 276.2 on 235 degrees of freedom
## Residual deviance: 271.9 on 233 degrees of freedom
## AIC: 1093
##
## Number of Fisher Scoring iterations: 4