diff --git "a/25/replication_package/AJPS_2021_Kim_Manuscript_RMarkdown.html" "b/25/replication_package/AJPS_2021_Kim_Manuscript_RMarkdown.html" new file mode 100644--- /dev/null +++ "b/25/replication_package/AJPS_2021_Kim_Manuscript_RMarkdown.html" @@ -0,0 +1,1302 @@ + + + + + + + + + + + + + + +AJPS_2021_Kim_Manuscript_Markdown + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
load("nyt.rdata")
+
+search_terms <- paste(c('economic mobility', 'social ladder', 'income ladder', 'social mobility', 'economic ladder',
+                        'rags to riches', 'economic mobility', 'social ladder', 'class mobility', 'socioeconomic mobility', 
+                        'intergenerational mobility', 'upward mobility', "meritocracy", "american dream", "land of opportunity",
+                        'rugged individualism', 'horatio alger', 'self-made man', 'self-made woman', 'self-made success'), 
+                      collapse = '|') 
+
+custom_stop_words <- stop_words
+
+cleaned_nyt_text$text <- as.character(cleaned_nyt_text$text)
+
+nyt_words <- cleaned_nyt_text %>%
+  unnest_tokens(word, text) %>%
+  mutate(word = gsub("\u2019", "'", word)) %>% 
+  anti_join(custom_stop_words) 
+
+bing <- get_sentiments('bing')
+
+nyt_polarity_year <- nyt_words %>%
+  inner_join(bing) %>%
+  count(sentiment, Month_Yr) %>%
+  spread(sentiment, n) %>%
+  mutate(polarity = positive - negative,
+         percent_positive = positive / (positive + negative) * 100) %>%
+  filter(!str_detect(Month_Yr, "2020"))
+
+
+nyt_polarity_year$year<- nyt_polarity_year %>% 
+  separate(Month_Yr, into = c("year", "month")) %>% 
+  pull("year")
+
+nyt_polarity_year_2000 <-  nyt_polarity_year %>% filter(year > 1999)
+
+
+polarity_over_time <- nyt_polarity_year_2000 %>%
+  ggplot(aes(as.Date(paste(Month_Yr, "-01", sep="")), 
+             polarity, 
+             color = ifelse(polarity >= 0,  '#86d7c1', '#0e698b'))) +
+  geom_col(position = "identity", 
+           color=ifelse(nyt_polarity_year_2000$polarity>= 0,'#86d7c1', '#0e698b'),
+           fill = ifelse(nyt_polarity_year_2000$polarity>= 0,'#86d7c1', '#0e698b'),
+           size = 0.1, show.legend = F) + 
+  #theme(plot.title = element_text(size = 11), legend.position = "none") + 
+  theme(plot.title = element_text(size = 11), legend.position = "none", 
+        panel.background = element_blank(), 
+        axis.title.x = element_text(color="black", size=10),
+        axis.title.y = element_text(color="black", size=10)) + 
+  theme(axis.text.x = element_text(color="black", size=10),
+        axis.text.y = element_text(color="black", size=10))  + 
+  xlab("Year") + ylab("Sentiment Score")  
+
+# ggtitle("NYT Word Sentiment Polarity Over Time (positive words - negative words per year)")
+
+polarity_over_time 
+

+
#pdf('nytsentiment.pdf',height=4,width=7)
+#polarity_over_time
+#dev.off()
+
+
+# --------------------------------------------------------------------------------------------------------------------------------
+#  MAIN MANUSCRIPT TABLE 1 # 
+# --------------------------------------------------------------------------------------------------------------------------------
+
+# mturk 
+
+load("mturk.rdata")
+
+m1 <-lm(mperception_combined ~ condition2 +  rep + dem  + optimism_index  + sjs_index, data=msample)
+mr <-lm(mperception_combined ~ condition2  + optimism_index  + sjs_index, data=msample[msample$rep==1,])
+md <- lm(mperception_combined ~ condition2  + optimism_index  + sjs_index, data=msample[msample$dem==1,])
+# interaction model 
+mrd <-lm(mperception_combined ~ condition2*rep1dem0new  + optimism_index + sjs_index, data=msample)
+
+# lab in the field 
+# main model 
+
+load("labinthefield.rdata")
+
+f1 <-lm(mperception_combined ~ condition2 + rep + dem + optimism_index + sjs_index +
+          as.factor(surveymode_n) + as.factor(date_n), data=fieldsample)
+fr <-lm(mperception_combined ~ condition2 + rep + dem + optimism_index + sjs_index +
+          as.factor(surveymode_n) + as.factor(date_n), data=fieldsample[fieldsample$rep==1,])
+fd <-lm(mperception_combined ~ condition2 + rep + dem + optimism_index + sjs_index +
+          as.factor(surveymode_n) + as.factor(date_n), data=fieldsample[fieldsample$dem==1,])
+frd <-lm(mperception_combined ~ condition2*rep1dem0new  + optimism_index + sjs_index +
+           as.factor(surveymode_n) + as.factor(date_n), data=fieldsample)
+
+table <- capture.output({stargazer(m1, mr, md, mrd,  f1, fr, fd, frd, 
+                                   dep.var.labels= c(
+                                     "Mturk Sample",
+                                     "Lab-in-the-Field Sample"),
+                                   covariate.labels = c('Rags-to-Riches TV Treatment'),
+                                   column.labels = c('All', 'Rep', 'Dem', 'Interaction Model','All', 'Rep', 'Dem', 'Interaction Model'), 
+                                   column.separate = c(1,1, 1, 1, 1, 1, 1,1),
+                                   dep.var.caption = "",
+                                   omit.stat=c("adj.rsq","LL","ser","f"),
+                                   omit = c('surveymode_n', 'date_n' ) , 
+                                   star.cutoffs = c(0.1, .05,.01,.001),
+                                   no.space=TRUE,
+                                   star.char = c("+", "*", "**", "***"), 
+                                   notes = c("+ p< 0.1, * p<0.05; ** p<0.01; *** p<0.001"), 
+                                   notes.append = F,
+                                   notes.align="l",
+                                   label = "experiment",
+                                   title = "The Casual Effect of Rags-to-Riches TV", 
+                                   digits=3,
+                                   align = TRUE, 
+                                   type="html") 
+})
+table <- gsub("\\begin{tabular}","\\resizebox{0.8\\textwidth}{!}{\\begin{tabular}", table,fixed=T)
+table <- gsub("\\end{tabular}","\\end{tabular}}", table,fixed=T)
+cat(table)  
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+The Casual Effect of Rags-to-Riches TV +
+
+ +Mturk Sample +
+ +All + +Rep + +Dem + +Interaction Model + +All + +Rep + +Dem + +Interaction Model +
+ +(1) + +(2) + +(3) + +(4) + +(5) + +(6) + +(7) + +(8) +
+
+Rags-to-Riches TV Treatment + +0.055*** + +0.150*** + +0.011 + +0.010 + +0.068** + +0.085+ + +0.061 + +0.066+ +
+ +(0.011) + +(0.020) + +(0.017) + +(0.016) + +(0.025) + +(0.047) + +(0.037) + +(0.035) +
+rep + +0.036* + + + + +0.047 + + + +
+ +(0.015) + + + + +(0.038) + + + +
+dem + +-0.015 + + + + +-0.057+ + + + +
+ +(0.012) + + + + +(0.034) + + + +
+rep1dem0new + + + + +-0.017 + + + + +0.075 +
+ + + + +(0.020) + + + + +(0.046) +
+optimism_index + +0.025*** + +0.032** + +0.020* + +0.024*** + +0.048** + +0.019 + +0.064* + +0.049* +
+ +(0.006) + +(0.012) + +(0.009) + +(0.007) + +(0.018) + +(0.030) + +(0.028) + +(0.021) +
+sjs_index + +0.090*** + +0.071*** + +0.092*** + +0.086*** + +0.101*** + +0.085** + +0.142*** + +0.121*** +
+ +(0.007) + +(0.013) + +(0.010) + +(0.008) + +(0.018) + +(0.031) + +(0.028) + +(0.022) +
+condition2:rep1dem0new + + + + +0.140*** + + + + +0.035 +
+ + + + +(0.028) + + + + +(0.063) +
+Constant + +0.187*** + +0.211*** + +0.203*** + +0.208*** + +0.193* + +0.403* + +-0.037 + +0.082 +
+ +(0.024) + +(0.051) + +(0.034) + +(0.028) + +(0.084) + +(0.152) + +(0.127) + +(0.099) +
+
+Observations + +763 + +161 + +348 + +509 + +203 + +50 + +109 + +159 +
+R2 + +0.326 + +0.443 + +0.250 + +0.364 + +0.311 + +0.274 + +0.333 + +0.348 +
+
+Note: + +
    +
  • p< 0.1, * p<0.05; ** p<0.01; *** p<0.001 +
+ +
# --------------------------------------------------------------------------------------------------------------------------------
+#  MAIN MANUSCRIPT TABLE 2 # 
+# --------------------------------------------------------------------------------------------------------------------------------
+
+
+load("ssi.rdata")
+
+m1 <- lm(mindex_rsc ~ occasionalviewer + frequentviewer + heavyviewer, data=ssi)
+
+
+m2 <- lm(mindex_rsc ~ occasionalviewer + frequentviewer + heavyviewer + othertv  + sportstv + rep + dem +
+           education_n + income_n + married + female + age + 
+           white + unemployed + polinterst + religion_attend +
+           protestant + optimismindex +insecurity + intergenmobility + parentsimmigrant +
+           +absolutemobility + gini + as.factor(state_n) , data=ssi) 
+
+m3 <- lm(internalatt_rsc ~ occasionalviewer + frequentviewer + heavyviewer, data=ssi)
+
+m4 <- lm(internalatt_rsc ~ occasionalviewer + frequentviewer + heavyviewer + othertv + sportstv + rep + dem +
+           education_n + income_n + married + female + age + 
+           white + unemployed + polinterst + religion_attend +
+           protestant + optimismindex + insecurity + intergenmobility + parentsimmigrant +
+           +absolutemobility + gini + as.factor(state_n), data=ssi)
+
+m5 <- lm(externalatt_rsc ~ occasionalviewer + frequentviewer + heavyviewer, data=ssi)
+
+m6 <- lm(externalatt_rsc ~ occasionalviewer + frequentviewer + heavyviewer + othertv + sportstv + rep + dem +
+           education_n + income_n + married + female + age + 
+           white + unemployed + polinterst + religion_attend +
+           protestant + optimismindex + insecurity + intergenmobility + parentsimmigrant +
+           +absolutemobility + gini + as.factor(state_n), data=ssi)
+
+
+stargazer(m1, m2, m3, m4, m5, m6, 
+                                   dep.var.caption = "",
+                                   omit.stat=c("adj.rsq","LL","ser","f"),
+                                   omit = c('state_n', "othertv", "sportstv", "rep", "dem", "education_n",
+                                            "income_n", "married", "female", "age", "white", "unemployed", 
+                                            "polinterst", "religion_attend", "protestant", "optimismindex",
+                                            "insecurity", "intergenmobility", "parentsimmigrant", "absolutemobility", "gini", "Constant") , 
+                                   star.cutoffs = c(0.1, .05,.01,.001),
+                                   no.space=TRUE,
+                                   star.char = c("+", "*", "**", "***"), 
+                                   notes = c("+ p< 0.1, * p<0.05; ** p<0.01; *** p<0.001"), 
+                                   notes.append = F,
+                                   notes.align="l",
+                                   digits=3,
+                                   align = TRUE, 
+                                   type= "html") 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +mindex_rsc + +internalatt_rsc + +externalatt_rsc +
+ +(1) + +(2) + +(3) + +(4) + +(5) + +(6) +
+
+occasionalviewer + +0.019 + +0.013 + +0.006 + +0.013 + +-0.004 + +-0.007 +
+ +(0.012) + +(0.011) + +(0.010) + +(0.010) + +(0.009) + +(0.009) +
+frequentviewer + +0.047*** + +0.032** + +0.008 + +0.017+ + +0.009 + +0.005 +
+ +(0.012) + +(0.011) + +(0.010) + +(0.010) + +(0.009) + +(0.010) +
+heavyviewer + +0.076*** + +0.040* + +0.052*** + +0.052*** + +0.039*** + +0.014 +
+ +(0.013) + +(0.016) + +(0.011) + +(0.014) + +(0.011) + +(0.013) +
+
+Observations + +3,004 + +2,998 + +3,004 + +2,998 + +3,004 + +2,998 +
+R2 + +0.013 + +0.239 + +0.008 + +0.143 + +0.006 + +0.110 +
+
+Note: + +
    +
  • p< 0.1, * p<0.05; ** p<0.01; *** p<0.001 +
+ +
# --------------------------------------------------------------------------------------------------------------------------------
+#  MAIN MANUSCRIPT FIGURE 3 # 
+# --------------------------------------------------------------------------------------------------------------------------------
+
+load("ssi.rdata")
+
+m2 <- lm(mindex_rsc ~ occasionalviewer + frequentviewer + heavyviewer + othertv  + sportstv + rep + dem +
+           education_n + income_n + married + female + age + 
+           white + unemployed + polinterst + religion_attend +
+           protestant + optimismindex +insecurity + intergenmobility + parentsimmigrant +
+           +absolutemobility + gini + as.factor(state_n) , data=ssi) 
+
+
+t1 <- coef(summary(m2))
+
+
+# Combined 
+
+c3 <- numeric(length = 16)
+
+c3[16] <- t1[7,1]*sd(ssi$rep)  
+c3[15] <- t1[21,1]*sd(ssi$intergenmobility) 
+c3[14] <- t1[13,1]*sd(ssi$age)
+c3[13] <- t1[22,1]*sd(ssi$parentsimmigrant, na.rm=T)
+c3[12] <-  t1[4,1]*sd(ssi$heavyviewer)       
+c3[11] <-  t1[3,1]*sd(ssi$frequentviewer)             
+c3[10] <-  t1[2,1]*sd(ssi$occasionalviewer) 
+c3[9] <- t1[14,1]*sd(ssi$white) 
+c3[8] <- t1[18,1]*sd(ssi$protestant)   
+c3[7] <- t1[23,1]*sd(ssi$absolutemobility, na.rm=T)
+c3[6] <-  t1[20,1]*sd(ssi$insecurity, na.rm=T) 
+c3[5] <-  t1[24,1]*sd(ssi$gini, na.rm=T)
+c3[4] <-  t1[8,1]*sd(ssi$dem)   
+c3[3] <-  t1[10,1]*sd(ssi$income_n)
+c3[2] <-  t1[15,1]*sd(ssi$unemployed)
+c3[1] <- t1[9,1]*sd(ssi$education_n)      
+
+c3 <-as.data.frame((c3))
+
+c3[1,c(2)] <- "#24345A"
+c3[2,c(2)] <-"#24345A"
+c3[3,c(2)] <- "#24345A"
+c3[4,c(2)] <- "#24345A"
+c3[5,c(2)] <- "#24345A"
+c3[6,c(2)] <- "#24345A"
+c3[7,c(2)] <- "#24345A"
+c3[8,c(2)] <-"#24345A"
+c3[9,c(2)] <- "#24345A"
+c3[10,c(2)] <- "#2B8D9C"
+c3[11,c(2)] <-"#2B8D9C"
+c3[12,c(2)] <- "#2B8D9C"
+c3[13,c(2)] <- "#24345A"
+c3[14,c(2)] <- "#24345A"
+c3[15,c(2)] <- "#24345A"
+c3[16,c(2)] <- "#24345A"
+
+
+s3 <- numeric(length = 16)
+
+
+s3[16] <- t1[7,2]*sd(ssi$rep)
+s3[15] <- t1[21,2]*sd(ssi$intergenmobility)  
+s3[14] <- t1[13,2]*sd(ssi$age)      
+s3[13] <- t1[22,2]*sd(ssi$parentsimmigrant, na.rm=T) 
+s3[12] <-  t1[4,2]*sd(ssi$heavyviewer)          
+s3[11] <- t1[3,2]*sd(ssi$frequentviewer)        
+s3[10] <- t1[2,2]*sd(ssi$occasionalviewer)      
+s3[9] <- t1[14,2]*sd(ssi$white)
+s3[8] <- t1[18,2]*sd(ssi$protestant)
+s3[7] <- t1[23,2]*sd(ssi$absolutemobility, na.rm=T)    
+s3[6] <- t1[20,2]*sd(ssi$insecurity, na.rm=T)    
+s3[5] <- t1[24,2]*sd(ssi$gini, na.rm=T)
+s3[4] <- t1[8,2]*sd(ssi$dem)
+s3[3] <- t1[10,2]*sd(ssi$income_n)
+s3[2] <- t1[15,2]*sd(ssi$unemployed)
+s3[1] <- t1[9,2]*sd(ssi$education_n)
+
+yloc <- c(1, 2,  3, 4,5,6,7, 8, 9, 10, 11, 12, 13, 14, 15, 16)
+
+
+
+# jpeg("SDfigure_AJPS.jpg", units="in", width=10, height=5, res=300)
+p <- recordPlot()
+plot.new()
+
+plot(c3$`(c3)`, yloc, pch = 23, col=c3$V2, bg=c3$V2,
+     xlim = c(-0.135, 0.14), ylim = c(0,16), xlab = "Impact of Standard Deviation Change", 
+     ylab = "", yaxt = "n",  xaxt = "n", axes=FALSE)
+abline(v = 0, col = "gray")
+grid()
+segments((c3$`(c3)` - (qnorm(0.975) * s3)), yloc, (c3$`(c3)` + (qnorm(0.975) * s3)), yloc,  col = c3$V2, 
+         lwd = 2)
+
+
+text(-0.05,16,'Republican' ,pos=2, cex=.8, col='grey30')
+text(-0.05,15,'Perceived Personal Mobility',pos=2, cex=.8, col='grey30')
+text(-0.05,14,'Age',pos=2, cex=.8, col='grey30')
+text(-0.05,13,'Have Immigrant Parents',pos=2, cex=.8, col='grey30')
+text(-0.05,12,'Rags-to-Riches TV: Heavy Viewer',pos=2, cex=.8, font=2)
+text(-0.05,11,'Rags-to-Riches TV: Frequent Viewer',pos=2, cex=.8, font=2)
+text(-0.05,10,'Rags-to-Riches TV: Occasional Viewer',pos=2, cex=.8, font=2)
+text(-0.05,9,'White',pos=2, cex=.8, col='grey30')
+text(-0.05,8,'Protestant',pos=2, cex=.8, col='grey30')
+text(-0.05,7,'County-level Intergenerational Mobility Rates' ,pos=2, cex=.8, col='grey30')
+text(-0.05,6,'Personal economic insecurity', ,pos=2, cex=.8, col='grey30')
+text(-0.05,5,'County-level Income Inequality (Gini)',pos=2, cex=.8, col='grey30')
+text(-0.05,4,'Democrat',pos=2, cex=.8, col='grey30')
+text(-0.05,3,'Income',pos=2, cex=.8, col='grey30')
+text(-0.05,2, 'Unemployed', cex=.8,pos=2, col='grey30')
+text(-0.05,1,'Education',cex=.8, pos=2, col='grey30')
+
+axis(1, at=c(-0.05, 0, 0.05, 0.1))
+

+ + + + +
+ + + + + + + + + + + + + + +