Question
Create RTNS by reading RTNS.cvs file using R or R Studio. The RTNS includes monthly log stock returns of 4 firms from January 2006 to
Create RTNS by reading RTNS.cvs file using R or R Studio. The RTNS includes monthly log stock returns of 4 firms from January 2006 to December 2016. Use the packages as follows: install.packages("tseries") install.packages("xts") library(tseries) library(xts)
Convert RTNS to xts object and assign the name rtns to the new object as follows:
rtns <- as.xts(RTNS[, -1], order.by = as.Date(RTNS$Date, "%m/%d/%Y"))
Using rtns , find mean-variance efficient portfolio with target return 0.5%, and answer the following questions #1 and #2.
1) What is the standard deviation of the mean-variance portfolio?
2) What are the weights of the mean-variance efficient portfolio?
Date | AAPL | BA | IBM | MSFT |
1/31/2006 | 0.05035466 | -0.027477229 | -0.010948827 | 0.076481848 |
2/28/2006 | -0.092967797 | 0.068600054 | -0.010559962 | -0.042236151 |
3/31/2006 | -0.084245858 | 0.072086913 | 0.027791668 | 0.012653479 |
4/30/2006 | 0.12228963 | 0.07083275 | -0.001576388 | -0.112458643 |
5/31/2006 | -0.150873826 | 0.001016347 | -0.026124977 | -0.058454549 |
6/30/2006 | -0.041826858 | -0.016096053 | -0.038548207 | 0.028697558 |
7/31/2006 | 0.186659582 | -0.054816327 | 0.007680331 | 0.032618026 |
8/31/2006 | -0.001618618 | -0.028821576 | 0.05016056 | 0.072096445 |
9/30/2006 | 0.134561532 | 0.052736932 | 0.011979752 | 0.06420235 |
10/31/2006 | 0.053260615 | 0.012809166 | 0.126800085 | 0.04972572 |
11/30/2006 | 0.130488423 | 0.112498449 | -0.001210044 | 0.026136449 |
12/31/2006 | -0.074405446 | 0.003501601 | 0.056897331 | 0.017029974 |
1/31/2007 | 0.010490367 | 0.008104479 | 0.020586722 | 0.03348962 |
2/28/2007 | -0.013064246 | -0.021918393 | -0.059807537 | -0.084002722 |
3/31/2007 | 0.098097031 | 0.018909018 | 0.014202714 | -0.010649612 |
4/30/2007 | 0.074157836 | 0.046001541 | 0.084341146 | 0.074273412 |
5/31/2007 | 0.214328642 | 0.085646158 | 0.04701053 | 0.028370694 |
6/30/2007 | 0.007013861 | -0.044040088 | -0.012664154 | -0.039752402 |
7/31/2007 | 0.079645944 | 0.075603126 | 0.051306425 | -0.016287772 |
8/31/2007 | 0.051001896 | -0.061887293 | 0.058315335 | -0.005494917 |
9/30/2007 | 0.108246615 | 0.085729071 | 0.009512391 | 0.025408948 |
10/31/2007 | 0.237701173 | -0.060958192 | -0.014261464 | 0.24949091 |
11/30/2007 | -0.040694874 | -0.057990518 | -0.091000025 | -0.084186728 |
12/31/2007 | 0.087037572 | -0.054895194 | 0.02776191 | 0.059523818 |
1/31/2008 | -0.316639713 | -0.048936646 | -0.009158162 | -0.084269639 |
2/29/2008 | -0.076388878 | 0.000208909 | 0.067083566 | -0.162402148 |
3/31/2008 | 0.147816303 | -0.101703077 | 0.01124187 | 0.043382299 |
4/30/2008 | 0.212195158 | 0.141051465 | 0.048289022 | 0.004933096 |
5/31/2008 | 0.085081861 | -0.020079002 | 0.076711356 | -0.00335712 |
6/30/2008 | -0.112900612 | -0.205992458 | -0.084215366 | -0.028601704 |
7/31/2008 | -0.050704684 | -0.070146087 | 0.0797267 | -0.065067247 |
8/31/2008 | 0.066561722 | 0.079441839 | -0.045131007 | 0.065273905 |
9/30/2008 | -0.329558176 | -0.125228785 | -0.039185114 | -0.021986067 |
10/31/2008 | -0.053404911 | -0.085963401 | -0.205112839 | -0.163357064 |
11/30/2008 | -0.13867459 | -0.180648473 | -0.117390866 | -0.088357519 |
12/31/2008 | -0.078989982 | 0.000938255 | 0.031372626 | -0.038575606 |
1/31/2009 | 0.056004716 | -0.008436773 | 0.088997114 | -0.120370418 |
2/28/2009 | -0.009097991 | -0.249423566 | 0.009608836 | -0.049079933 |
3/31/2009 | 0.177023871 | 0.131679447 | 0.052808878 | 0.137461408 |
4/30/2009 | 0.197012917 | 0.125632291 | 0.065228607 | 0.102885061 |
5/31/2009 | 0.079313378 | 0.130857413 | 0.035123743 | 0.037643969 |
6/30/2009 | 0.048744577 | -0.052396857 | -0.017500952 | 0.137865084 |
7/31/2009 | 0.147160013 | 0.009647058 | 0.129381372 | -0.010517461 |
8/31/2009 | 0.029499987 | 0.168653886 | 0.005686444 | 0.053937093 |
9/30/2009 | 0.101896403 | 0.090195364 | 0.013214713 | 0.04340769 |
10/31/2009 | 0.016994908 | -0.117266884 | 0.008360513 | 0.078149341 |
11/30/2009 | 0.060530481 | 0.106101773 | 0.052292951 | 0.065272296 |
12/31/2009 | 0.054124377 | 0.032818181 | 0.03601104 | 0.036382151 |
1/31/2010 | -0.088596802 | 0.119527015 | -0.065011422 | -0.075459299 |
2/28/2010 | 0.0653962 | 0.04935973 | 0.043620765 | 0.022145787 |
3/31/2010 | 0.148470432 | 0.149620018 | 0.008571855 | 0.021625418 |
4/30/2010 | 0.111021236 | -0.002478987 | 0.005847952 | 0.042676699 |
5/31/2010 | -0.016124692 | -0.108760623 | -0.024015071 | -0.151394375 |
6/30/2010 | -0.02082688 | -0.022281088 | -0.014210434 | -0.108139494 |
7/31/2010 | 0.022740819 | 0.085896404 | 0.039844431 | 0.121686211 |
8/31/2010 | -0.05500482 | -0.097425153 | -0.036291882 | -0.085811757 |
9/30/2010 | 0.167215077 | 0.088499912 | 0.089417705 | 0.043459748 |
10/31/2010 | 0.060722478 | 0.06161704 | 0.070523382 | 0.089015952 |
11/30/2010 | 0.03378966 | -0.0917872 | -0.010524941 | -0.0470488 |
12/31/2010 | 0.036670426 | 0.023365239 | 0.037466331 | 0.104908941 |
1/31/2011 | 0.051959268 | 0.064664433 | 0.103843053 | -0.006449333 |
2/28/2011 | 0.040934839 | 0.042434823 | 0.003215704 | -0.035805821 |
3/31/2011 | -0.013306536 | 0.026662938 | 0.007351138 | -0.044770529 |
4/30/2011 | 0.004648327 | 0.079128897 | 0.046053808 | 0.020874363 |
5/31/2011 | -0.006569 | -0.016770149 | -0.005244188 | -0.028783478 |
6/30/2011 | -0.034959556 | -0.052543874 | 0.015509445 | 0.03958417 |
7/31/2011 | 0.163285319 | -0.046801016 | 0.060040822 | 0.053846124 |
8/31/2011 | -0.014469326 | -0.044792 | -0.050543842 | -0.023069687 |
9/30/2011 | -0.009120937 | -0.094974606 | 0.017218264 | -0.064285744 |
10/31/2011 | 0.061523129 | 0.087258354 | 0.055812944 | 0.069907609 |
11/30/2011 | -0.055783399 | 0.050736954 | 0.022345982 | -0.032195981 |
12/31/2011 | 0.05965467 | 0.067840951 | -0.021914866 | 0.014855309 |
1/31/2012 | 0.127111049 | 0.011315634 | 0.047422236 | 0.137519345 |
2/29/2012 | 0.18831065 | 0.016326706 | 0.025420946 | 0.081915037 |
3/31/2012 | 0.105283507 | -0.007738413 | 0.060590651 | 0.016383072 |
4/30/2012 | -0.025969512 | 0.032674475 | -0.007524524 | -0.00743948 |
5/31/2012 | -0.010702377 | -0.088299543 | -0.064573599 | -0.082400512 |
6/30/2012 | 0.010852815 | 0.067375404 | 0.013893251 | 0.047961604 |
7/31/2012 | 0.045821877 | -0.005248984 | 0.002045166 | -0.036613296 |
8/31/2012 | 0.093876854 | -0.028166927 | -0.001520774 | 0.052737551 |
9/30/2012 | 0.00279601 | -0.025210127 | 0.064665076 | -0.034393252 |
10/31/2012 | -0.10760008 | 0.012069024 | -0.062280062 | -0.040994602 |
11/30/2012 | -0.012374561 | 0.060996513 | -0.018650877 | -0.059609605 |
12/31/2012 | -0.090742889 | 0.014539606 | 0.007786582 | 0.00338084 |
1/31/2013 | -0.144089281 | -0.01977173 | 0.060140977 | 0.027705014 |
2/28/2013 | -0.025285985 | 0.047704895 | -0.00686796 | 0.02113536 |
3/31/2013 | 0.002854561 | 0.116384874 | 0.062092321 | 0.029136743 |
4/30/2013 | 0.000271036 | 0.064764185 | -0.050445426 | 0.15693803 |
5/31/2013 | 0.022419293 | 0.088822244 | 0.031870423 | 0.061774321 |
6/30/2013 | -0.118293232 | 0.034538541 | -0.081290274 | -0.010315202 |
7/31/2013 | 0.141225068 | 0.02596638 | 0.02056403 | -0.078170267 |
8/31/2013 | 0.083766761 | -0.006726887 | -0.060802034 | 0.056386826 |
9/30/2013 | -0.021489336 | 0.13067747 | 0.015965262 | -0.003592884 |
10/31/2013 | 0.096381741 | 0.110638295 | -0.032238827 | 0.06400242 |
11/30/2013 | 0.070052711 | 0.032484657 | 0.008006885 | 0.084981038 |
12/31/2013 | 0.008901793 | 0.016685327 | 0.043911485 | -0.01888281 |
1/31/2014 | -0.107696739 | -0.08227711 | -0.058058401 | 0.011494267 |
2/28/2014 | 0.05751083 | 0.035024099 | 0.053798581 | 0.020012505 |
3/31/2014 | 0.019952875 | -0.02660565 | 0.039531282 | 0.069955642 |
4/30/2014 | 0.099396369 | 0.028129788 | 0.020676376 | -0.014393748 |
5/31/2014 | 0.078709291 | 0.05416904 | -0.056174558 | 0.020515239 |
6/30/2014 | 0.0276619 | -0.059297568 | -0.016760664 | 0.018563806 |
7/31/2014 | 0.028731292 | -0.053053524 | 0.057372943 | 0.035011976 |
8/31/2014 | 0.077508844 | 0.058830588 | 0.009220405 | 0.059169284 |
9/30/2014 | -0.017073171 | 0.00457408 | -0.012844521 | 0.020471057 |
10/31/2014 | 0.071960302 | -0.019390747 | -0.133962009 | 0.01272649 |
11/30/2014 | 0.105978719 | 0.081930723 | -0.006813085 | 0.024740135 |
12/31/2014 | -0.071891052 | -0.032599025 | -0.010667793 | -0.028445934 |
1/31/2015 | 0.061424232 | 0.118402828 | -0.044440318 | -0.130247558 |
2/28/2015 | 0.100776612 | 0.044115187 | 0.063700889 | 0.09312029 |
3/31/2015 | -0.031371685 | -0.005104436 | -0.008892196 | -0.072747967 |
4/30/2015 | 0.005786394 | -0.044909417 | 0.067227372 | 0.196261656 |
5/31/2015 | 0.045339013 | -0.013391102 | -0.002079009 | -0.030334235 |
6/30/2015 | -0.037227501 | -0.012809585 | -0.04120242 | -0.057831828 |
7/31/2015 | -0.032926713 | 0.039287756 | -0.004119012 | 0.057757633 |
8/31/2015 | -0.066196163 | -0.087786955 | -0.079463642 | -0.061948911 |
9/30/2015 | -0.02181624 | 0.002066143 | -0.019744391 | 0.017003615 |
10/31/2015 | 0.083408853 | 0.130737004 | -0.033731112 | 0.189335785 |
11/30/2015 | -0.005804233 | -0.011620913 | 0.0046244 | 0.039444073 |
12/31/2015 | -0.110228234 | -0.005912687 | -0.012910653 | 0.020791177 |
1/31/2016 | 0.060722478 | 0.06161704 | 0.070523382 | 0.089015952 |
2/29/2016 | 0.03378966 | -0.0917872 | -0.010524941 | -0.0470488 |
3/31/2016 | 0.036670426 | 0.023365239 | 0.037466331 | 0.104908941 |
4/30/2016 | 0.051959268 | 0.064664433 | 0.103843053 | -0.006449333 |
5/31/2016 | 0.040934839 | 0.042434823 | 0.003215704 | -0.035805821 |
6/30/2016 | -0.013306536 | 0.026662938 | 0.007351138 | -0.044770529 |
7/31/2016 | 0.004648327 | 0.079128897 | 0.046053808 | 0.020874363 |
8/31/2016 | -0.006569 | -0.016770149 | -0.005244188 | -0.028783478 |
9/30/2016 | -0.034959556 | -0.052543874 | 0.015509445 | 0.03958417 |
10/31/2016 | 0.163285319 | -0.046801016 | 0.060040822 | 0.053846124 |
11/30/2016 | -0.014469326 | -0.044792 | -0.050543842 | -0.023069687 |
12/31/2016 | -0.009120937 | -0.094974606 | 0.017218264 | -0.064285744 |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started