You are on page 1of 7

INTRODUCTION TO QUANTITATIVE ANALYSIS.

LEONARDO D. VILLAMIL.
HW5
11/11/2016
THE SET UP
Set the working directory.
setwd("E:/leonardo/education/gsu/introQuantitativeAnalysis/hw/hw5")
df = read.csv("1980 ANES.csv")
!!File is up!!
install.packages("psych") # work !!
library('psych')
# work !!
install.packages("Rmisc") #CI
library('Rmisc')
install.packages("ca")
library(ca)
FIRST SUMMARY
(whole data set)

Splitting the data Set into republicans and democrats.


df1=split(df,df$party)
dfd = df1$'0' #democrats
dfr = df1$'1' #republicans
Summary per party.
Republicans

Democrats

95% Confident Interval for the variable Reagan. Regardless of party.

95% CI for Republicans

95% CI for Democrats

The alternative will be that mean of the Democratic Party will be less than the mean of
the Republicans Party because Reagan was a republican.

Reject Ho.
Reagan whole group.

Reagan for Democrats.

Reagan for Republicans

Skewed!! Not a surprise.


2.
df = read.csv("war.csv")
Categorical Variables:
dfc = df$major_powers
dfw = df$war
table(dfc,dfw)
Asumptions:
There is not relationship between war and countries.

t=table(dfc,dfw)
In terms of proportions:
Are the variables independent?
X-squared = 52.9127, df = 1,
p-value = 3.487e-13
No. They are not.

There are other test that can be performed: Test of independence and associations.
For independence we have chiSquare, Fisher, prop chi square.

3..

P1: Females Believe in afterlife P2: Males Believe in afterlife.


Ho: P1 = P2, Ha: P1 (not = ) P2.
p1 = 0.747 and p2 = 0.737
p = 810/1091 = 0.742.
se0 = 0.027
z = 0.40 therefore p-value = 0.69. Fail to reject Ho. Males and Females believe in
afterlives. Since I fail to reject the Ho if it is false a type II error is possible.

4.

Ho: There is not influence from compulsory voting in level of interest in a campaign.
Ha: There is influence from compulsory voting in the level of interest in a campaign.
(The mean of the population distributions are different)
Ha1: Mean of distribution of compulsive voting is greater than the mean of the normal
participants.

se = 0.04214. t = -2.13574. Since we know the sds and we have large sample sizes
then t = z = 1.960. Therefore, our p-value = 0.0250/2 = 0.0125 which is smaller than our
confidence level. We should reject Ho and conclude that there is an influence of
compulsory voting in the interest for a campaign. The tendency is probable to be in the
direction of Ha1.

5.

The p-value for this z-score is significant.


Ho: Population proportions are equal. (There is not effect w.r.t. gender)
Ha: Population proportions are different. (There is an effect of gender in the elections)
For this p-value I favor Ha.

You might also like