Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The data for this homework first appear in Gentzkow and Shapiro ( 2 0 1 0 ) and summarize the first year of the 1

The data for this homework first appear in Gentzkow and Shapiro (2010) and summarize the first year of the 109th Congressional Record (2005) containing all speech in that year for members of the US house and senate. It is stored in the textir package in R in two separate datasets. Use the following 2 lines of code to load the data.
library(textir)
data(congress109)
The text is already tokenized into bigrams (two-word phrases) after stop-word removal and stemming (using a Porter stemmer). The matrix congress109Counts contains the number of times each phrase in a list of 1000 common bigram and trigrams was used in the 109th Congress by each of the 529 members of the House and Senate.
> congress109Counts[c("Barack Obama", "John Boehner"),995:998]
2\times 4 sparse Matrix of class "dgCMatrix"
stem.cel natural.ga hurricane.katrina trade.agreement
Barack Obama .1207
John Boehner ..14.
The data also contain information about each member of Congress.
> congress109Ideology[1:4,]
name party state chamber repshare cs1 cs2
Chris Cannon Chris Cannon R UT H 0.79006210.5340.124
Michael Conaway Michael Conaway R TX H 0.78360280.4840.051
Spencer Bachus Spencer Bachus R AL H 0.78129330.3690.013
Mac Thornberry Mac Thornberry R TX H 0.77765200.4930.002
We will be considering the variable repshare which is the proportion of the two party vote by the members constituents (districts for members of the house, state for senators) that was captured by the republican candidate (GW Bush) in the 2004 presidential election.
Use the following line of code to create a matrix with an indicator for whether each bigram was used or not.
x <- congress109Counts>0
Then, set the seed to 20, load the text2vec library, and fit a 10 topic LDA model.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

How To Build A Million Dollar Database

Authors: Michelle Bergquist

1st Edition

0615246842, 978-0615246840

More Books

Students also viewed these Databases questions

Question

LO 2-3 Compare socialism and communism.

Answered: 1 week ago

Question

What are the objectives of Human resource planning ?

Answered: 1 week ago

Question

Explain the process of Human Resource Planning.

Answered: 1 week ago

Question

2. What are your challenges in the creative process?

Answered: 1 week ago