|
|
|
|
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| |
| |
| |
|
|
| |
|
|
|
|
| library(foreign) |
| library(ggplot2) |
| library(readstata13) |
| library(dplyr) |
| library(haven) |
| library(xtable) |
| library(stargazer) |
| library(tidytext) |
| library(stringr) |
| library(tidyr) |
| library(wordcloud) |
| library(scales) |
| library(tables) |
| library(ggpubr) |
| library(lubridate) |
| library(scales) |
| library(DescTools) |
| library(ggeffects) |
| library(tidyverse) |
| library(egg) |
|
|
|
|
| |
|
|
| |
|
|
| |
|
|
|
|
| load("contentanalysis.rdata") |
|
|
| ca$ordinary <- as.factor(ca$ordinary) |
| ca$economicbenefit <- as.factor(ca$economicbenefit) |
| ca$hardwork <- as.factor(ca$hardwork) |
|
|
| ca$ordinary <- factor(ca$ordinary, |
| levels = c(0,1,2), |
| labels = c("Celebrity", "Professional", "Everyman")) |
|
|
|
|
| ca$economicbenefit <- factor(ca$economicbenefit, |
| levels = c(0,1,2), |
| labels = c("None/trivial", "Modest", "Significant")) |
|
|
| ca$hardwork <- factor(ca$hardwork, |
| levels = c(0,1,2), |
| labels = c("Not much effort", "Some effort", "A lot of effort")) |
|
|
|
|
| ordinary.pct = ca %>% group_by(ordinary) %>% |
| dplyr::summarise(count = n()) %>% |
| mutate(pct=count/sum(count)) |
|
|
| econ.pct = ca %>% group_by(economicbenefit) %>% |
| dplyr::summarise(count = n()) %>% |
| mutate(pct=count/sum(count)) |
| hardwork.pct = ca %>% group_by(hardwork) %>% |
| dplyr::summarise(count = n()) %>% |
| mutate(pct=count/sum(count)) |
|
|
| ordinary.pct$ordinary <- factor(ordinary.pct$ordinary , levels=c("Celebrity", "Professional", "Everyman")) |
|
|
|
|
| p1 <- ggplot(ordinary.pct, aes(x=ordinary, y=pct*100, fill=ordinary)) + |
| geom_bar(stat="identity", width = 0.4, position=position_dodge(0.1)) + |
| theme(aspect.ratio = 1) + |
| scale_fill_manual(values = c("Celebrity" = "#214D72", "Professional" = "#2C7695", "Everyman"="#50BFC3")) + |
| scale_y_continuous(limits=c(0,100)) + |
| geom_text(data=ordinary.pct, aes(label=paste0(round(pct*100,1),"%"), y=pct*100+3), size=4) + |
| ylab("Percent") + xlab("") + |
| ggtitle("Type of People") + theme_minimal() + theme(legend.position="none") + |
| theme(legend.title = element_blank()) + |
| theme(axis.title.x = element_text(color="black", size=14, face="bold"), |
| axis.text.y = element_text(color= "black", size=12), |
| axis.text.x = element_text(color= "black", size=12), |
| axis.title.y = element_text(color="black", size=14, face="bold"), |
| plot.title = element_text(size = 14, face="bold")) |
|
|
| ordinary.pct$ordinary <- factor(ordinary.pct$ordinary , levels=c("Celebrity", "Professional", "Everyman")) |
|
|
| econ.pct$economicbenefit <- factor(econ.pct$economicbenefit, levels=c("None/trivial", "Modest", "Significant")) |
|
|
| p2 <- ggplot(econ.pct, aes(x=economicbenefit, y=pct*100, fill=economicbenefit)) + |
| geom_bar(stat="identity", width = 0.4, position=position_dodge(0.1)) + theme(aspect.ratio = 1) + |
| scale_fill_manual(values = c("None/trivial" = "#214D72", "Modest" = "#2C7695", "Significant"="#50BFC3" )) + |
| scale_y_continuous(limits=c(0,100)) + |
| geom_text(data=econ.pct, aes(label=paste0(round(pct*100,1),"%"), y=pct*100+3), size=4) + |
| ylab("") + xlab("") + |
| ggtitle("Degree of Economic Benefit") + theme_minimal() + theme(legend.position="none") + |
| theme(legend.title = element_blank()) + |
| theme(axis.title.x = element_text(color="black", size=14, face="bold"), |
| axis.text.y = element_blank(), |
| axis.text.x = element_text(color= "black", size=12), |
| axis.title.y = element_text(color="black", size=14, face="bold"), |
| plot.title = element_text(size = 14, face="bold")) |
|
|
| hardwork.pct$hardwork <- factor(hardwork.pct$hardwork, levels=c("Not much effort", "Some effort", "A lot of effort")) |
|
|
| p3 <- ggplot(hardwork.pct, aes(x=hardwork, y=pct*100, fill=hardwork)) + |
| geom_bar(stat="identity", width = 0.4, position=position_dodge(0.1)) + theme(aspect.ratio = 1) + |
| scale_fill_manual(values = c("Not much effort" = "#214D72", "Some effort" = "#2C7695", "A lot of effort"="#50BFC3")) + |
| scale_y_continuous(limits=c(0,100)) + |
| geom_text(data=hardwork.pct, aes(label=paste0(round(pct*100,1),"%"), y=pct*100+3), size=4) + |
| ylab("") + xlab("") + |
| ggtitle("Amount of Hard Work/Effort") + theme_minimal() + theme(legend.position="none") + |
| theme(legend.title = element_blank()) + |
| theme(axis.title.x = element_text(color="black", size=14, face="bold"), |
| axis.text.y = element_blank(), |
| axis.text.x = element_text(color= "black", size=12), |
| axis.title.y = element_text(color="black", size=14, face="bold"), |
| plot.title = element_text(size = 14, face="bold")) |
|
|
| |
|
|
| egg::ggarrange(p1, p2, p3,nrow = 1) |
|
|
| |
|
|
|
|
|
|
| |
|
|
| load("tvcoding.rdata") |
|
|
| first <- CohenKappa(tvcoding$ordinary1, tvcoding$ordinary2, weights = c("Unweighted")) |
| second <- CohenKappa(tvcoding$benefit1, tvcoding$benefit2, weights = c("Unweighted")) |
| third <- CohenKappa(tvcoding$hardwork1, tvcoding$hardwork2, weights = c("Unweighted")) |
| |
| |
| round(first, digits=3) |
| |
| |
| round(second, digits=3) |
|
|
| |
| round(third, digits=3) |
|
|
| |
| |
|
|
| |
|
|
| load("imdb.rdata") |
|
|
| p <- ggplot(imdb, aes(x = year, y = value,fill = variable), |
| scale_fill_manual(breaks = c("news", "realitygame"), values =c("#24345A", "#2B8D9C"))) + |
| scale_x_continuous(breaks=seq(1960,2018,4)) + |
| scale_y_continuous(breaks=seq(0,0.7,0.05)) + |
| xlab("Year") + ylab("% of TV Shows by Genre") + |
| geom_jitter(size=2, aes(colour=variable), alpha=1) + |
| scale_color_manual(breaks = c("news", "realitygame"), values =c("#24345A", "#2B8D9C")) + |
| geom_smooth(aes(x=year, y=value, color=as.factor(variable))) + |
| scale_fill_manual(breaks = c("news", "realitygame"), values =c("#24345A", "#2B8D9C")) + |
| theme_minimal() + |
| theme(legend.title = element_blank(), legend.position = "none") + |
| theme(axis.title.x = element_text(color="black", size=14, face="bold"), |
| axis.text.y = element_text(color= "black", size=12), |
| axis.text.x = element_text(color= "black", size=12), |
| axis.title.y = element_text(color="black", size=14, face="bold"), |
| plot.title = element_text(size = 14, face="bold")) |
|
|
| p <- p + theme(legend.position = "none") + |
| ggplot2::annotate("text", x = 1995, y = 0.13, fontface=2, size=4, |
| label = "REALITY/GAME", color="#2B8D9C") + |
| ggplot2::annotate("text", x = 2012, y = 0.05, fontface=2, size=4, |
| label = "NEWS", color= "#24345A") + |
| theme(panel.grid.minor = element_blank(), |
| panel.grid.major = element_line(color = "gray50", size = 0.1), |
| panel.grid.major.x = element_blank(), |
| panel.background = element_blank(), |
| axis.line.x = element_line(size = 0.1, linetype = "solid", colour = "gray50")) |
|
|
|
|
|
|
| |
|
|
| p |
|
|
| |
|
|
| |
|
|
| |
|
|
| |
|
|
|
|
| load("ssi.rdata") |
|
|
| tv <- ssi %>% |
| dplyr::summarise( tv1=mean(tv_americagottalent)*100, |
| tv2=mean(tv_nflcbs)*100, |
| tv3=mean(tv_sundayfootball)*100, |
| tv4=mean(tv_foxnfl)*100, |
| tv5=mean(tv_sharktank)*100, |
| tv6 = mean(tv_hellkitchen)*100, |
| tv7 = mean(tv_voice)*100, |
| tv8 = mean(tv_idol)*100, |
| tv9 = mean(tv_ninja)*100, |
| tv10 = mean(tv_masterchef)*100, |
| tv11 = mean(tv_celebrityfamily)*100, |
| tv12 = mean(tv_survivor)*100, |
| tv13 = mean(tv_mlbfox)*100, |
| tv14 = mean(tv_collegefootball)*100, |
| tv15 = mean(tv_youcandance)*100, |
| tv16 = mean(tv_amazingrace)*100, |
| tv17 = mean(tv_collegebasketball)*100, |
| tv18 = mean(tv_nbaprimetime)*100, |
| tv19 = mean(tv_kardashians)*100, |
| tv20 = mean(tv_nascar)*100, |
| tv21 = mean(tv_bachelor)*100, |
| tv22 = mean(tv_bachelorette)*100, |
| tv23 = mean(tv_jerseyshore)*100, |
| tv24 = mean(tv_housewives)*100, |
| tv25 = mean(tv_ufc)*100, |
| tv26 = mean(tv_worldofdance)*100, |
| tv27 = mean(tv_lovehiphop)*100, |
| tv28 = mean(tv_cbssports)*100, |
| tv29 = mean(tv_battlebots)*100, |
| tv30 = mean(tv_loveconnection)*100 ) |
|
|
| m <- as.data.frame(t(tv)) |
|
|
| colnames(m) <- c('prop') |
|
|
| m$prop<- round(m$prop, digits=1) |
| m$tv <- c("America's Got Talent", "NFL on CBS", "Sunday Night Football", |
| "Fox NFL Sunday", "Shark Tank", "Hell's Kichen", "Voice", "American Idol", |
| "American Ninja Warrior", "MasterChef", "Celebrity Family Feud", "Survivor", |
| "MLB on Fox", "Colege Football Today", "So You Think You Can Dance", "Amazing Race", |
| "College Bastketball on CBS", "NBA Saturday Primetime", "Keeping Up with Kardashians", |
| "NASCAR on Fox", "Bachelor", "Bachelorette", "Jersey Shore", "The Real Housewives", "UFC Fight Night", |
| "World of Dance", "Love and Hip Hop: Hollywood", "CBS Sports Spectaular", "BattleBots", "Love Connection") |
|
|
| m |
|
|
|
|
| |
|
|
| |
|
|
| |
|
|
| 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) |
|
|
|
|
| table <- capture.output({stargazer(m1, m2, m3, m4, m5, m6, |
| dep.var.caption = "", |
| omit.stat=c("adj.rsq","LL","ser","f"), |
| omit = c('state_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", |
| digits=3, |
| align = TRUE, |
| type= "text") |
| }) |
| table <- gsub("\\begin{tabular}","\\resizebox{1\\textwidth}{!}{\\begin{tabular}", table,fixed=T) |
| table <- gsub("\\end{tabular}","\\end{tabular}}", table,fixed=T) |
| cat(table) |
|
|
|
|
| |
|
|
| m2_conti <- lm(mindex_rsc ~ realitytv + 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) |
|
|
| table <- capture.output({stargazer(m2_conti, |
| dep.var.caption = "", |
| omit.stat=c("adj.rsq","LL","ser","f"), |
| omit = c('state_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", |
| digits=3, |
| align = TRUE, |
| type= "text") |
| }) |
| table <- gsub("\\begin{tabular}","\\resizebox{1\\textwidth}{!}{\\begin{tabular}", table,fixed=T) |
| table <- gsub("\\end{tabular}","\\end{tabular}}", table,fixed=T) |
| cat(table) |
|
|
|
|
| |
|
|
| load("ssi.rdata") |
|
|
| plow <- lm(mindex_rsc ~ occasionalviewer + frequentviewer+ heavyviewer + othertv + sportstv + rep + dem + |
| education_n + income_n + married + female + age + |
| white + unemployed + religion_attend + |
| protestant + optimismindex + insecurity + intergenmobility + parentsimmigrant + |
| absolutemobility + gini + as.factor(state_n), data=ssi[ssi$polinterest_high==0,]) |
|
|
|
|
| phigh <- lm(mindex_rsc ~ occasionalviewer + frequentviewer+ heavyviewer + othertv + sportstv + rep + dem + |
| education_n + income_n + married + female + age + |
| white + unemployed + religion_attend + |
| protestant + optimismindex + insecurity + intergenmobility + parentsimmigrant + |
| absolutemobility + gini + as.factor(state_n), data=ssi[ssi$polinterest_high==1,]) |
|
|
|
|
| plow_i <- lm(internalatt_rsc~ occasionalviewer + frequentviewer+ heavyviewer + othertv + sportstv + rep + dem + |
| education_n + income_n + married + female + age + |
| white + unemployed + religion_attend + |
| protestant + optimismindex + insecurity + intergenmobility + parentsimmigrant + |
| absolutemobility + gini + as.factor(state_n), data=ssi[ssi$polinterest_high==0,]) |
|
|
|
|
| phigh_i <- lm(internalatt_rsc ~ occasionalviewer + frequentviewer+ heavyviewer + othertv + sportstv + rep + dem + |
| education_n + income_n + married + female + age + |
| white + unemployed + religion_attend + |
| protestant + optimismindex + insecurity + intergenmobility + parentsimmigrant + |
| absolutemobility + gini + as.factor(state_n), data=ssi[ssi$polinterest_high==1,]) |
|
|
| plow_e <- lm(externalatt_rsc~ occasionalviewer + frequentviewer+ heavyviewer + othertv + sportstv + rep + dem + |
| education_n + income_n + married + female + age + |
| white + unemployed + religion_attend + |
| protestant + optimismindex + insecurity + intergenmobility + parentsimmigrant + |
| absolutemobility + gini + as.factor(state_n), data=ssi[ssi$polinterest_high==0,]) |
|
|
|
|
| phigh_e <- lm(externalatt_rsc ~ occasionalviewer + frequentviewer+ heavyviewer + othertv + sportstv + rep + dem + |
| education_n + income_n + married + female + age + |
| white + unemployed + religion_attend + |
| protestant + optimismindex + insecurity + intergenmobility + parentsimmigrant + |
| absolutemobility + gini + as.factor(state_n), data=ssi[ssi$polinterest_high==1,]) |
|
|
|
|
| table <- capture.output({stargazer(plow, phigh, plow_i, phigh_i, plow_e, phigh_e, |
| dep.var.caption = "", |
| omit.stat=c("adj.rsq","LL","ser","f"), |
| omit = c('state_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", |
| digits=3, |
| align = TRUE, |
| type= "text") |
| }) |
| table <- gsub("\\begin{tabular}","\\resizebox{1\\textwidth}{!}{\\begin{tabular}", table,fixed=T) |
| table <- gsub("\\end{tabular}","\\end{tabular}}", table,fixed=T) |
| cat(table) |
|
|
| |
| |
|
|
|
|
| |
|
|
|
|
| load("anes2016.rdata") |
|
|
| |
|
|
| aw <- lm(mobilityindex_rsc ~ realitynew + rep + dem + ideo_conserv + white + educat3 + |
| female + income + agecat13 + married + bornagain + outofwork + |
| wrongdirection + econbetterthanlastyear + unemployment_worse + incomegap_larger , |
| data=anes2016, weights=V160102) |
|
|
| awr <- lm(mobilityindex_rsc ~ realitynew + ideo_conserv + white + educat3 + |
| female + income + agecat13 + married + bornagain + outofwork + |
| wrongdirection + econbetterthanlastyear + unemployment_worse + incomegap_larger, |
| data=anes2016[anes2016$rep==1,], weights=V160102) |
|
|
| awd <- lm(mobilityindex_rsc ~ realitynew + ideo_conserv + white + educat3 + |
| female + income + agecat13 + married + bornagain + outofwork + |
| wrongdirection + econbetterthanlastyear + unemployment_worse + incomegap_larger, |
| data=anes2016[anes2016$dem==1,], weights=V160102) |
|
|
|
|
| table <- capture.output({stargazer(aw, awr, awd, |
| column.labels = c('All', 'Rep','Dem'), |
| column.separate = c(1, 1, 1), |
| dep.var.caption = "", |
| omit.stat=c("adj.rsq","LL","ser","f"), |
| omit = c('PPSTATEN_11', 'ideo_conserv', "white", "educat3", "female", "income", "agecat13", |
| "married", "bornagain", "outofwork", "wrongdirection", "econbetterthanlastyear", |
| "unemployment_worse", "incomegap_larger", "rep", "dem", "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="text") |
| }) |
| |
| |
| cat(table) |
|
|
| |
|
|
| |
|
|
| load("iscap.rdata") |
|
|
| ia <- lm(mobility_rsc ~ combined + |
| newscount_w8_new + |
| rep_11 + dem_11 + |
| ideo_11_rsc + age + |
| female_11 + income + |
| married_11 + white_11 + |
| educ_11 + protestant + |
| unemployed_11 + socio_11_rsc + |
| PPMSACAT_11 + sjs_mean_rsc, |
| data=iscap, weights=weight1_11) |
|
|
|
|
|
|
| iar <- lm(mobility_rsc ~ combined + newscount_w8_new + |
| rep_11 + dem_11 + ideo_11_rsc + age + female_11 + income + married_11 + white_11 + |
| educ_11 + protestant + unemployed_11 + socio_11_rsc + PPMSACAT_11 + sjs_mean_rsc, data=iscap[iscap$rep_11==1,], weights=weight1_11) |
|
|
|
|
| iad <- lm(mobility_rsc ~ combined + newscount_w8_new + |
| rep_11 + dem_11 + ideo_11_rsc + age + female_11 + income + married_11 + white_11 + |
| educ_11 + protestant + unemployed_11 + socio_11_rsc + PPMSACAT_11 + sjs_mean_rsc, data=iscap[iscap$dem_11==1,], weights=weight1_11) |
|
|
|
|
| table <- capture.output({stargazer( ia, iar, iad, |
| column.labels = c( 'All', 'Rep','Dem'), |
| column.separate = c( 1, 1, 1), |
| dep.var.caption = "", |
| omit.stat=c("adj.rsq","LL","ser","f"), |
| omit = c('newscount_w8_new', 'rep_11', "dem_11", "ideo_11_rsc", "age", |
| 'female_11', "income", "married_11", "white_11", |
| 'educ_11', "protestant", "unemployed_11", "socio_11_rsc", |
| "PPMSACAT_11", "sjs_mean_rsc", "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="text") |
| }) |
| table <- gsub("\\begin{tabular}","\\resizebox{0.8\\textwidth}{!}{\\begin{tabular}", table,fixed=T) |
| table <- gsub("\\end{tabular}","\\end{tabular}}", table,fixed=T) |
| cat(table) |
|
|
| |
| |
|
|
| |
|
|
| load("anes2016.rdata") |
|
|
|
|
| aw <- lm(mobilityindex_rsc ~ realitynew + rep + dem + ideo_conserv + white + educat3 + |
| female + income + agecat13 + married + bornagain + outofwork + |
| wrongdirection + econbetterthanlastyear + unemployment_worse + incomegap_larger , |
| data=anes2016, weights=V160102) |
|
|
| awr <- lm(mobilityindex_rsc ~ realitynew + ideo_conserv + white + educat3 + |
| female + income + agecat13 + married + bornagain + outofwork + |
| wrongdirection + econbetterthanlastyear + unemployment_worse + incomegap_larger, |
| data=anes2016[anes2016$rep==1,], weights=V160102) |
|
|
| awd <- lm(mobilityindex_rsc ~ realitynew + ideo_conserv + white + educat3 + |
| female + income + agecat13 + married + bornagain + outofwork + |
| wrongdirection + econbetterthanlastyear + unemployment_worse + incomegap_larger, |
| data=anes2016[anes2016$dem==1,], weights=V160102) |
|
|
|
|
| awi <- lm(mobilityindex_rsc ~ realitynew + ideo_conserv + white + educat3 + |
| female + income + agecat13 + married + bornagain + outofwork + |
| wrongdirection + econbetterthanlastyear + unemployment_worse + incomegap_larger, |
| data=anes2016[anes2016$ind==1,], weights=V160102) |
|
|
| table <- capture.output({stargazer(aw, awr, awd, awi, |
| column.labels = c('All', 'Rep','Dem', "Ind"), |
| column.separate = c(1, 1, 1, 1), |
| dep.var.caption = "", |
| omit.stat=c("adj.rsq","LL","ser","f"), |
| omit = c('PPSTATEN_11', 'ideo_conserv', "white", "educat3", "female", "income", "agecat13", |
| "married", "bornagain", "outofwork", "wrongdirection", "econbetterthanlastyear", |
| "unemployment_worse", "incomegap_larger", "rep", "dem", "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="text") |
| }) |
| |
| |
| cat(table) |
|
|
| |
|
|
|
|
| load("iscap.rdata") |
|
|
|
|
| ia <- lm(mobility_rsc ~ combined + newscount_w8_new + |
| rep_11 + dem_11 + ideo_11_rsc + age + female_11 + income + married_11 + white_11 + |
| educ_11 + protestant + unemployed_11 + socio_11_rsc + PPMSACAT_11 + sjs_mean_rsc, |
| data=iscap, weights=weight1_11) |
|
|
| iar <- lm(mobility_rsc ~ combined + newscount_w8_new + |
| rep_11 + dem_11 + ideo_11_rsc + age + female_11 + income + married_11 + white_11 + |
| educ_11 + protestant + unemployed_11 + socio_11_rsc + PPMSACAT_11 + sjs_mean_rsc, data=iscap[iscap$rep_11==1,], weights=weight1_11) |
|
|
|
|
| iad <- lm(mobility_rsc ~ combined + newscount_w8_new + |
| rep_11 + dem_11 + ideo_11_rsc + age + female_11 + income + married_11 + white_11 + |
| educ_11 + protestant + unemployed_11 + socio_11_rsc + PPMSACAT_11 + sjs_mean_rsc, data=iscap[iscap$dem_11==1,], weights=weight1_11) |
|
|
|
|
| iai <- lm(mobility_rsc ~ combined + newscount_w8_new + |
| ideo_11_rsc + age + female_11 + income + married_11 + white_11 + |
| educ_11 + protestant + unemployed_11 + socio_11_rsc + PPMSACAT_11 + sjs_mean_rsc, data=iscap[iscap$ind_11==1,], weights=weight1_11) |
|
|
|
|
| table <- capture.output({stargazer( ia, iar, iad, iai, |
| column.labels = c( 'All', 'Rep','Dem', "Ind"), |
| column.separate = c( 1, 1, 1), |
| dep.var.caption = "", |
| omit.stat=c("adj.rsq","LL","ser","f"), |
| omit = c('newscount_w8_new', 'rep_11', "dem_11", "ideo_11_rsc", "age", |
| 'female_11', "income", "married_11", "white_11", |
| 'educ_11', "protestant", "unemployed_11", "socio_11_rsc", |
| "PPMSACAT_11", "sjs_mean_rsc", "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="text") |
| }) |
| table <- gsub("\\begin{tabular}","\\resizebox{0.8\\textwidth}{!}{\\begin{tabular}", table,fixed=T) |
| table <- gsub("\\end{tabular}","\\end{tabular}}", table,fixed=T) |
| cat(table) |
|
|
|
|
|
|
|
|
|
|
| |
|
|
| 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) |
|
|
|
|
| m2r <- lm(mindex_rsc ~ occasionalviewer + frequentviewer + heavyviewer + othertv + sportstv + |
| 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[ssi$rep==1,]) |
|
|
| m2d <- lm(mindex_rsc ~ occasionalviewer + frequentviewer + heavyviewer + othertv + sportstv + |
| 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[ssi$dem==1,]) |
|
|
|
|
| m2i <- lm(mindex_rsc ~ occasionalviewer + frequentviewer + heavyviewer + othertv + sportstv + |
| 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[ssi$ind==1,]) |
|
|
|
|
|
|
| table <- capture.output({stargazer(m2, m2r, m2d, m2i, |
| column.labels = c('All', 'Rep','Dem', 'Ind'), |
| column.separate = c(1, 1, 1, 1), |
| dep.var.caption = "", |
| omit.stat=c("adj.rsq","LL","ser","f"), |
| omit = c('state_n', "othertv", "sportstv", "education_n", "income_n", "married", "female", "age", |
| "white", "unemployed", "polinterst", "religion_attend", "protestant", "optimismindex", "insecurity", |
| "intergenmobility", "parentsimmigrant", "absolutemobility", "gini", "Constant", "rep", "dem") , |
| 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 = "ssi2018", |
| title = "ssi2018", |
| digits=3, |
| align = TRUE, |
| type="text") |
| }) |
| table <- gsub("\\begin{tabular}","\\resizebox{1\\textwidth}{!}{\\begin{tabular}", table,fixed=T) |
| table <- gsub("\\end{tabular}","\\end{tabular}}", table,fixed=T) |
| cat(table) |
|
|
| |
| |
|
|
|
|
| load("combined.rdata") |
|
|
| |
|
|
| |
| t.test(combined$m1_rsc ~ combined$condition2) |
| |
| t.test(combined$m2_rsc ~ combined$condition2) |
| |
| t.test(combined$m3_rsc ~ combined$condition2) |
| |
| t.test(combined$m4_rsc ~ combined$condition2) |
| |
| t.test(combined$like ~ combined$condition2) |
| |
| t.test(combined$entertaining ~ combined$condition2) |
|
|
|
|
| |
|
|
|
|
| j <- lm(mperception_combined ~ condition2*sjs_high + pid + optimism_index + date + as.factor(surveymode_n), |
| data=combined) |
|
|
| table <- capture.output({stargazer(j, |
| covariate.labels = c('Rags-to-Riches TV Treatment', "System Justification Scale - High", "Party ID", |
| "Optimism Index", "Treatment x System Justification Scale"), |
| omit.stat=c("adj.rsq","LL","ser","f"), |
| omit = c('surveymode_n', 'date') , |
| 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 = "Heterogeneous Treatment Effects by SJS", |
| digits=3, |
| align = TRUE, |
| type="text") |
| }) |
| table <- gsub("\\begin{tabular}","\\resizebox{0.8\\textwidth}{!}{\\begin{tabular}", table,fixed=T) |
| table <- gsub("\\end{tabular}","\\end{tabular}}", table,fixed=T) |
| cat(table) |
|
|
|
|
| |
| |
|
|
| |
|
|
| load("merit.rdata") |
|
|
| m1 <- lm( dv3_rich_rcd ~ condition2 + rep + dem + as.factor(surveymode_n) + as.factor(date_n) + durationinseconds,data=merit) |
| m2 <- lm( dv3_poor_rcd ~ condition2 + rep + dem + as.factor(surveymode_n) + as.factor(date_n) + durationinseconds,data=merit) |
| m3 <- lm( dv4_inequality_rsc ~ condition2 + rep + dem + as.factor(surveymode_n) + as.factor(date_n) + durationinseconds,data=merit) |
| m4 <- lm( antigov2 ~ condition2 + rep + dem + as.factor(surveymode_n) + as.factor(date_n) + durationinseconds,data=merit) |
|
|
| table <- capture.output({stargazer(m1, m2, m3, m4, |
| dep.var.labels= c('The rich works hard', |
| 'The poor lacks efforts', |
| 'Inequality is desirable', |
| 'Anti-redistribution'), |
| covariate.labels = c('Meritocracy Treatment'), |
| dep.var.caption = "", |
| omit.stat=c("adj.rsq","LL","ser","f"), |
| omit = c('surveymode_n', 'date_n', 'durationinseconds', 'rep', 'dem', '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", |
| label = "main", |
| title = "The Casual Effect of Merit-Based Rags-to-Riches TV", |
| digits=3, |
| align = TRUE, |
| type = "text") |
| }) |
|
|
| |
| |
| cat(table) |
|
|
| |
| |
| |
|
|
| load("gss.rdata") |
|
|
|
|
| fit <- lm(getahead_new~ tv_dummy*as.factor(year) + news + polviews + pid3 + |
| age + income + as.factor(race) + educ + sex, data = gss, weights=gss$wtssall) |
|
|
| dat <- ggpredict(fit, terms = c("year", "tv_dummy")) |
| dat$year <- as.Date(as.character(dat$x), format = "%Y") |
| dat$year <- year(dat$year) |
|
|
|
|
| p1 <- ggplot(dat, aes(x=year, y=predicted, color=group, shape=group)) + |
| geom_smooth(span=1.2, se=T, alpha=0.2, aes(fill=group)) + scale_fill_manual(name='group', values=c("black", "#00A7A3"))+ geom_point() + scale_shape_manual(values = c(4, 11)) + |
| theme_minimal() + theme(legend.position="top") + guides(shape = FALSE, fill=F) + |
| xlab("Year") + |
| ylab("people can get ahead by working hard") + scale_x_continuous(breaks=seq(1970,2020,4)) + |
| scale_y_continuous(breaks=scales::pretty_breaks(n=4)) + |
| scale_color_manual(values=c("#214455", "#00A7A3", "grey40"), name="Overall TV Consumption", labels=c("Low", "High")) + |
| theme(axis.text.x = element_text(colour = "black", size=15), |
| axis.title.x = element_text(size=15), |
| axis.text.y=element_text(colour = "black", size=15), |
| legend.text=element_text(size=16, face="bold"), legend.title=element_text(size=16, face="bold"), |
| axis.title.y = element_text(size=18), panel.grid.minor.x = element_blank(), panel.grid.minor.y=element_blank()) |
| p1 |
|
|
| |
| |
| |
|
|
|
|