Question

using R (1) Regress the return of General Motor on the returns of Citigroup with intercept...

using R

(1) Regress the return of General Motor on the returns of Citigroup with intercept and without intercept, respectively. Report the estimated coefficients.

(2) Generate an ANOVA table to conclude if regression effects are significant.

(3) Compute the correlation of General Motor and Citigroup, and test if their correlation is

zero.

(4) Test if the proportion of returns of Citigroup greater than Pfizer is 0.6.

Homework Answers

Answer #1

The R code is pasted below.

# SETTING UP THE DATA

data = read.table("C:\\Users\\LAPTOP\\Desktop\\w_logret_3stocks.txt",header=T)
data
names(data)
attach(data)

# QUESTION 1, REPORTING THE REGRESSION COEFFICIENTS
# WITH INTERCEPT
model1 = lm(GM ~ Citi,data)
model1
# WITHOUT INTERCEPT
model2 = lm(GM ~ Citi - 1,data)
model2

# QUESTION 2, ANOVA TABLE TO CONCLUDE IF REGRESSION EFFECTS ARE SIGNIFICANT
summary(model1)
summary(model2)

# QUESTION 3, COMPUTING CORRELATION AND PERFORMING CORRELATION TEST
cor(GM,Citi)
cor.test(GM,Citi,alternative="two.sided")

# QUESTION 4, ONE SAMPLE PROPORTION TEST
prop.array = ifelse(Citi > PFE,1,0)
prop = sum(prop.array)
n = length(prop.array)
prop.test(prop,n,p=0.6,alternative="greater")

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions