msbernst — Sep 16, 2014, 9:39 AM
library(aod)
Warning: package 'aod' was built under R version 3.0.2
library(ggplot2)
library(plyr)
setwd('~/Documents/projects/darkmatter/analysis/qualtrics/')
musicdata <- read.csv("qualtrics_pilot.csv")
count(musicdata, c('is_hegemonic'))
is_hegemonic freq
1 0 2
2 1 63
qplot(is_hegemonic, data = musicdata, geom="histogram")
stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
this.
posted_ot_plot <- ggplot(musicdata, aes(x = posted_on_topic)) + geom_histogram()
posted_ot_plot + facet_grid(is_hegemonic ~ condition)
stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
this. stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to
adjust this. stat_bin: binwidth defaulted to range/30. Use 'binwidth = x'
to adjust this.
count(musicdata, c('is_hegemonic', 'condition', 'posted_on_topic'))
is_hegemonic condition posted_on_topic freq
1 0 over 1 2
2 1 over 0 32
3 1 over 1 2
4 1 under 0 27
5 1 under 1 2
print(summary(musicdata))
is_hegemonic condition posted posted_on_topic
Min. :0.000 over :36 Min. :0.000 Min. :0.0000
1st Qu.:1.000 under:29 1st Qu.:0.000 1st Qu.:0.0000
Median :1.000 Median :0.000 Median :0.0000
Mean :0.969 Mean :0.215 Mean :0.0923
3rd Qu.:1.000 3rd Qu.:0.000 3rd Qu.:0.0000
Max. :1.000 Max. :1.000 Max. :1.0000
musicdata$condition <- factor(musicdata$condition)
logit <- glm(posted_on_topic ~ is_hegemonic + condition, data = musicdata, family = "binomial")
print(summary(logit))
Call:
glm(formula = posted_on_topic ~ is_hegemonic + condition, family = "binomial",
data = musicdata)
Deviance Residuals:
Min 1Q Median 3Q Max
-0.378 -0.378 -0.348 -0.348 2.380
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 17.57 2797.44 0.01 0.99
is_hegemonic -20.34 2797.44 -0.01 0.99
conditionunder 0.17 1.03 0.16 0.87
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 40.020 on 64 degrees of freedom
Residual deviance: 29.768 on 62 degrees of freedom
AIC: 35.77
Number of Fisher Scoring iterations: 16
print(confint.default(logit))
2.5 % 97.5 %
(Intercept) -5465.319 5500.452
is_hegemonic -5503.224 5462.547
conditionunder -1.856 2.196
# based on http://www.ats.ucla.edu/stat/r/dae/logit.htm