In: Statistics and Probability
Use the “d_logret_6stocks” dataset to answer the questions. (General Motor: GenMotor)(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.
dataset below
Date Pfizer Intel
Citigroup AmerExp Exxon
GenMotor
1-Aug-00 -0.001438612
0.049981263 0.044275101
0.017410003 0.010224894 0.093294017
1-Sep-00 0.017489274
-0.255619266 -0.033536503
0.012656982 0.03798902 -0.032209239
2-Oct-00 -0.017046116
0.034546736 -0.011645582
-0.004897625 0.000330555 -0.019602167
1-Nov-00 0.012012934
-0.072550667 -0.022674793
-0.03827587 -0.00365002 -0.0948916
1-Dec-00 0.016278701
-0.102497868 0.010708311 0
-0.005252049 0.012461253
2-Jan-01 -0.008063083
0.090223122 0.03990062
-0.066129678 -0.014169243 0.022971579
1-Feb-01 -0.00042298
-0.11219423 -0.055096146
-0.030733152 -0.014046895 0.000824088
1-Mar-01 -0.040906294
-0.035702138 -0.038726816
-0.026380545 -0.000240008
-0.012105099
2-Apr-01 0.024190228
0.069994483 0.038511978
0.011868735 0.038897488 0.024082196
1-May-01 -0.002978787
-0.05826061 0.019333184
-0.002446047 0.002844256 0.020148775
1-Jun-01 -0.029781389
0.03463487 0.013258067
-0.03564197 -0.006813464 0.053440295
2-Jul-01 0.012504432
0.008168789 -0.022187219
0.017739418 -0.019481402 -0.005100405
1-Aug-01 -0.0306632
-0.027529477 -0.038475736
-0.044368019 -0.01460743 -0.061635162
4-Sep-01 0.01981548
-0.135934121 -0.053479798
-0.098043942 -0.008224146
-0.105946472
1-Oct-01 0.019063731
0.077211653 0.050835509
0.006689711 0.00061005 -0.016274333
1-Nov-01 0.015543895
0.126580684 0.02356606
0.048543672 -0.020726234 0.08521096
3-Dec-01 -0.036145791
-0.016421934 0.022871285
0.035242521 0.021578866 -0.009657415
2-Jan-02 0.019356687
0.046876533 -0.025940517
0.002871379 -0.002807817 0.022139216
1-Feb-02 -0.006050198
-0.088680731 -0.020151007
0.007237226 0.026948074 0.01967222
1-Mar-02 -0.013187975
0.027384065 0.039197815
0.050683167 0.025807264 0.057331233
1-Apr-02 -0.038640426
-0.026448085 -0.058277811
0.00137534 -0.037828005 0.025768635
1-May-02 -0.020012226
-0.014900615 0.000481346
0.015691714 -0.000118352 -0.010495544
3-Jun-02 0.00498962
-0.179572434 -0.046948457
-0.068454444 0.010640133 -0.065487824
1-Jul-02 -0.034159152
0.01226155 -0.062746165
-0.01186007 -0.0465282 -0.060041503
1-Aug-02 0.011452067
-0.051537916 0.022330581
0.009740522 -0.013050696 0.016998701
3-Sep-02 -0.056822917
-0.079127863 -0.043102044
-0.063162423 -0.045786933
-0.090010126
1-Oct-02 0.039382501 0.09536996
0.097624046 0.067951966
0.023357105 -0.068058029
1-Nov-02 -0.001620779
0.082000518 0.022127194
0.029514688 0.017231827 0.083238291
2-Dec-02 -0.013493147
-0.127500953 -0.043258124
-0.040869439 0.001739589 -0.032155007
2-Jan-03 -0.000914625
0.002562217 -0.008110182
0.002151752 -0.009860009 -0.006417575
3-Feb-03 -0.007697729
0.042681011 -0.012956568
-0.024428147 0.001227785 -0.025617995
3-Mar-03 0.01899439
-0.025156666 0.014203546
-0.004565156 0.011692992 -0.001942487
1-Apr-03 -0.005686915
0.053056729 0.056727624
0.057647618 0.003171011 0.030362391
1-May-03 0.005686915
0.054144721 0.021322255
0.041490099 0.01767084 -0.00280191
2-Jun-03 0.041784483
-0.000213046 0.018444872
0.001579917 -0.005981586 0.008214181
1-Jul-03 -0.010109859
0.077829522 0.023189447
0.024870758 -0.003990877 0.016906014
1-Aug-03 -0.045266311
0.06043443 -0.01419843
0.008620388 0.028166116 0.046380496
2-Sep-03 0.006546894
-0.016587184 0.021075597
0.000112293 -0.01291723 -0.001791893
1-Oct-03 0.017184425
0.078321576 0.020888904
0.018572284 -0.00024981 0.018169063
3-Nov-03 0.028255616
0.007861351 -0.003462108
-0.01144524 -0.001501884 0.006155458
1-Dec-03 0.022153888
-0.019719492 0.013782077
0.024270976 0.054151115 0.096343714
2-Jan-04 0.015748075
-0.021237664 0.011862818
0.03132587 -0.00221919 -0.031390331
2-Feb-04 0.002115176
-0.018679024 0.006780909
0.01301928 0.01712318 -0.009458693
1-Mar-04 -0.01928823
-0.030753805 0.012267738
-0.012145545 -0.006030469
-0.007941261
1-Apr-04 0.008607804
-0.024068646 -0.027843588
-0.024949111 0.009863444 0.001620126
3-May-04 -0.003063819
0.045791862 -0.015263851
0.015239967 0.00995531 -0.014176433
1-Jun-04 -0.013135825
-0.01478726 0.000692103
0.006594513 0.011450989 0.011337234
1-Jul-04 -0.030491723
-0.053760665 -0.019188415
-0.009580051 0.018083807 -0.03339934
2-Aug-04 0.011876253
-0.058250748 0.023904782
-0.002001822 0.000773627 -0.013614662
1-Sep-04 -0.02833205
-0.02581149 -0.023595125
0.012265109 0.020475586 0.012073829
1-Oct-04 -0.024200939
0.045251691 0.006452318
0.01438828 0.007945468 -0.042109935
1-Nov-04 -0.015356644
0.003157084 0.003644451
0.021085951 0.019898881 0.006031965
1-Dec-04 -0.01408469
0.019040089 0.032148678
0.005093112 8.64354E-05 0.016341604
3-Jan-05 -0.046516472
-0.017862074 0.00770161
-0.022982941 0.002842759 -0.036824626
1-Feb-05 0.039975516
0.030472706 -0.008076244
0.006507102 0.090927282 -0.00798521
1-Mar-05 -0.000338104
-0.013929818 -0.02606549
-0.02185412 -0.026194026 -0.083992068
1-Apr-05 0.014633051 0.00525287
0.023245386 0.011111802
-0.019130346 -0.042013994
2-May-05 0.014630589
0.060803225 0.001318328
0.009356124 -0.004194614 0.079608491
1-Jun-05 -0.005088825
-0.015344193 -0.008162243
-0.004091884 0.009725145 0.03275369
1-Jul-05 -0.017295755
0.018252426 -0.022110024
0.014246467 0.009586797 0.034619924
1-Aug-05 -0.014040733
-0.02213234 0.002713407
0.001894712 0.010547196 -0.02599387
1-Sep-05 -0.008682706
-0.01834345 0.016994806
0.016950229 0.025608232 -0.047977476
3-Oct-05 -0.060303366
-0.020818266 0.002497608
-0.003389887 -0.053831314
-0.048092196
1-Nov-05 0.002411637
0.058709923 0.03829912
0.024183203 0.031923551 -0.070676054
The R code is pasted below. Please store the data set that you
have provided here in a file named "w_logret_3stocks.txt" and then
only run the R program. Also, don't forget to change the path name
of the .txt file in the first line of the R program to the path
name of the .txt file where you have stored the data
# SETTING UP THE DATA
data =
read.table("C:\\Users\\LAPTOP\\Desktop\\w_logret_3stocks.txt",header=T)
names(data)
attach(data)
# QUESTION 1, REPORTING THE REGRESSION
COEFFICIENTS
# WITH INTERCEPT
model1 = lm(GenMotor ~ Citigroup,data)
model1
# WITHOUT INTERCEPT
model2 = lm(GenMotor ~ Citigroup - 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(GenMotor,Citigroup)
cor.test(GenMotor,Citigroup,alternative="two.sided")
# QUESTION 4, ONE SAMPLE PROPORTION TEST
prop.array = ifelse(Citigroup > Pfizer,1,0)
prop = sum(prop.array)
n = length(prop.array)
prop.test(prop,n,p=0.6,alternative="greater")