Packages/Libraries
library(descr)
## Warning: package 'descr' was built under R version 3.6.2
library(dplyr)
## Warning: package 'dplyr' was built under R version 3.6.2
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 3.6.2
Set Working Directory
setwd("C:/Users/ramin/Desktop/2020 winter/Data Analysis/Computer Assignment 4/Dataset")
Data
load("gss98.RData")
Crosstable
CrossTable(gss98$CAPPUN, gss98$SEX, prop.r = T, prop.c = T, prop.t = T, prop.chisq = F, format = "SPSS")
## Cell Contents
## |-------------------------|
## | Count |
## | Row Percent |
## | Column Percent |
## | Total Percent |
## |-------------------------|
##
## ======================================
## gss98$SEX
## gss98$CAPPUN female male Total
## --------------------------------------
## Favor 348 309 657
## 53.0% 47.0% 71.6%
## 67.1% 77.4%
## 37.9% 33.7%
## --------------------------------------
## Oppose 171 90 261
## 65.5% 34.5% 28.4%
## 32.9% 22.6%
## 18.6% 9.8%
## --------------------------------------
## Total 519 399 918
## 56.5% 43.5%
## ======================================
Questions
Calculate the row, column, and total percentages for the first row, checking your answers against the computer output.
female to male respectively. Row % = 348/657 = 53%, 309/657 = 47%, total % = 657/918 = 71.6% Column % = 348/519 = 67.1%, 309/399 = 77.44% Total % = 348/918 = 37.9%, 309/918 = 33.7%
Give brief explanations of the nine percentages in the first row (e.g., 53.0 percent of the ________ are _______).
53% of the total people who favor capital punishment are females. 47% of the total people who favor capital punishment are males. 71.6% of the total males and females favor capital punishment. 67.1% of the total number of females favor capital punishment. 77.4% of the total number of males favor capital punishment. 37.9% of the total number of people in the survey are females and favor capital punishment 33.7% of the total number of people in the survey are males and favor capital punishment.
What percentage of the men oppose capital punishment for murder?
22.6% of the men oppose capital punishment for murder.
What percentage of the women oppose capital punishment for murder?
32.9% of the women oppose capital punishment for murder.
What percentage of those who oppose capital punishment for murder are men?
34.5% of those who oppose capital punishment for murder are men.
What percentage of those who oppose capital punishment for murder are women?
65.5% of those who oppose capital punishment for murder are women.
What percentage of the entire group are men?
43.5% of the entire group are men.
What percentage of the entire group oppose capital punishment for murder?
28.4% of the entire group oppose capital punishment for murder.
What percentage of the entire group are men who oppose capital punishment for murder?
9.8% of the entire group are men who oppose capital punishment for murder.