LA.8: Practice Data Analysis (10 points) Overview Video resources for data analysis with R: 1. Hypothesis testing: https://youtu.be/08uylSp-CuI 2. Analysis of variance (ANOVA) in R:...

1 answer below »

LA.8: Practice Data Analysis (10 points)


Overview


Video resources for data analysis with R:


1. Hypothesis testing: https://youtu.be/08uylSp-CuI


2. Analysis of variance (ANOVA) in R: https://youtu.be/2uQCUBtqCfM


3. Chi-square test of independence in R: https://youtu.be/Dnlp9vswwEk


4. Correlation: https://youtu.be/lf4HfHx2ASs


You will use the Ithaca.csv data set for this assignment. These data were collected by students in a research


methods course at Cornell University for teaching purposes.


A data frame with 465 observations on the following variables (Note: 99 = “Don’t know” unless otherwise


specified):


• tvinat: Attention to international news (0 = “Little attention,” 10 = “Very close attention”)


• tvnaat: Attention to national news (0 = “Little attention,” 10 = “Very close attention”)


• tvhardat: Attention to news about politics and economy (0 = “Little attention,” 10 = “Very close


attention”)


• tvsoftat: Attention to soft news (0 = “Little attention,” 10 = “Very close attention”)


• tvcrat: Attention to crime dramas (0 = “Little attention,” 10 = “Very close attention”)


• tvcomat: Attention to ctvomedies (0 = “Little attention,” 10 = “Very close attention”)


• educ: Highest year of school completed


• age: Age of respondent


• marit: Marital status (1 = “single,” 2 = “married,” 3 = “divorced/separated,” 4 = “widowed,” 5 =


“other,” 9 = “Don’t know/NA”)


• sex: 1 = 0 = “female,” 1 = “male”


Instructions


1. Familiarize yourself with the Ithaca.csv codebook above. Then, import/load the data set.


2. Conduct data management as necessary on these variables: tvnaat, tvhardat, tvsoftat, sex, marit.


E.g., you might have to remove missing data or recode “Don’t know” responses as NA.


3. Find the mean attention to national TV news for males and females.


a. What is the mean attention to national TV news for men and women?


4. Implement the appropriate statistical test to determine whether men spend significantly more time


watching national TV news compared to women.


a. What statistical test did you use?


b. What is the value of the test statistic and the p-value?


c. What conclusions can be drawn?


1


5. Implement the appropriate statistical test to determine whether there is a significant linear relationship


between attention to national TV news and attention to news about politics and economy.


a. What statistical test did you use?


b. What is the value of the test statistic and the p-value?


c. What conclusions can be drawn?


6. Implement the appropriate statistical test to determine whether attention to soft news varies significantly


depending on marital status.


a. What statistical test did you use?


b. What is the value of the test statistic and the p-value?


c. What conclusions can be drawn?


2

Answered Same DayOct 28, 2021

Answer To: LA.8: Practice Data Analysis (10 points) Overview Video resources for data analysis with R: 1....

Shubham answered on Oct 30 2021
142 Votes
tv_news_script.R
Practice Data Analysis Report
# importing the package 'mice' to handle missing values
library("mice")
## Warning: package 'mice' was built under R version 4.0.3
##
## Attaching package: 'mice'
## The following objects are masked from 'package:base':
##
## cbind, rbind
# 1. Importing the data set
df = read.csv("ithaca.csv")
head(df) #looking
at first few rows of the data
## ï..id tvinat tvnaat tvhardat tvedat tvsoftat tvcrat tvcomat educ age marit
## 1 1 0 0 0 0 0 0 0 15 22 1
## 2 2 0 0 0 0 0 0 0 19 26 1
## 3 3 7 9 6 6 6 8 9 18 34 2
## 4 4 7 7 2 1 1 8 1 18 56 2
## 5 5 8 9 5 5 3 9 6 19 24 1
## 6 6 1 2 3 3 8 2 8 12 37 2
## sex
## 1 1
## 2 1
## 3 1
## 4 0
## 5 0
## 6 0
str(df) #looking at the structure of data
## 'data.frame': 465 obs. of 12 variables:
## $ ï..id : int 1 2 3 4 5 6 7 8 9 10 ...
## $ tvinat : int 0 0 7 7 8 1 5 10 7 8 ...
## $ tvnaat : int 0 0 9 7 9 2 5 10 8 8 ...
## $ tvhardat: int 0 0 6 2 5 3 7 7 4 3 ...
## $ tvedat : int 0 0 6 1 5 3 9 6 3 1 ...
## $ tvsoftat: int 0 0 6 1 3 8 10 9 3 1 ...
## $ tvcrat : int 0 0 8 8 9 2 1 10 5 8 ...
## $ tvcomat : int 0 0 9 1 6 8 9 1 6 1 ...
## $ educ : int 15 19 18 18 19 12 14 12 16 15 ...
## $ age : int 22 26 34 56 24 37 70 71 22 46 ...
## $ marit : int 1 1 2 2 1 2 2 2 1 3 ...
## $ sex : int 1 1 1 0 0 0 0 0 1 1 ...
summary(df) #looking at the summary of data
## ï..id tvinat tvnaat tvhardat
## Min. : 1 Min. : 0.000 Min. : 0.000 Min. : 0.000
## 1st Qu.:117 1st Qu.: 2.000 1st Qu.: 2.000 1st Qu.: 1.000
## Median :233 Median : 5.000 Median : 6.000 Median : 5.000
## Mean :233 Mean : 6.691 Mean : 6.777 Mean : 7.928
## 3rd Qu.:349 3rd Qu.: 8.000 3rd Qu.: 8.000 3rd Qu.: 7.000
## Max. :465 Max. :99.000 Max. :99.000 Max. :99.000
## NA's :2 NA's :3 NA's :4
## tvedat tvsoftat tvcrat tvcomat
## Min. : 0.000 Min. : 0.000 Min. : 0.000 Min. : 0.000
## 1st Qu.: 1.000 1st Qu.: 1.000 1st Qu.: 1.000 1st Qu.: 1.000
## Median : 4.000 Median : 4.000 Median : 5.000 Median : 4.000
## Mean : 8.935 Mean : 9.305 Mean : 8.158 Mean : 7.508
## 3rd Qu.: 7.000 3rd Qu.: 7.000 3rd Qu.: 8.000 3rd Qu.: 7.000
## Max. :99.000 Max. :99.000 Max. :99.000 Max. :99.000
## NA's :3 NA's :3 NA's :2 NA's :2
## educ age marit sex
## Min. : 2.00 Min. :18.0 Min. :1.000 Min. :0.0000
## 1st Qu.:12.00 1st Qu.:26.0 1st Qu.:1.000 1st Qu.:0.0000
## Median :15.00 Median :44.5 Median :2.000 Median :0.0000
## Mean :18.62 Mean :44.3 Mean :1.931 Mean :0.5293
## 3rd Qu.:17.50 3rd Qu.:56.0 3rd Qu.:2.000 3rd Qu.:1.0000
## Max. :99.00 Max. :99.0 Max. :9.000 Max. :9.0000
## NA's :10 NA's :3 NA's :2 NA's :4
# 2. Dealing with missing values and don’t know responses
# Calculating the no. of missing values in each column
colSums(is.na(df))
## ï..id tvinat tvnaat tvhardat tvedat tvsoftat tvcrat tvcomat
## 0 2 3 4 3 3 2 2
## educ age marit sex
## 10 ...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here