Project 3 ※ Using the R script, answer the following questions. Please show all works for full credit. 1. Please use the following instructions. 1) Find 17 stocks you want to research. You can find...

1 answer below »
Need help with R Homework. Need to see completed answers to learn and recreate


Project 3 ※ Using the R script, answer the following questions. Please show all works for full credit. 1. Please use the following instructions. 1) Find 17 stocks you want to research. You can find ticker symbols from Google, Yahoo! Finance, MSN money, and so on (i.e. The ticker symbol of Apple Inc. is “AAPL”). 2) Run the following steps. i. Use the following libraries: library(quantmod) library(tseries) library(xts) ii. From Yahoo! Finance, download daily prices of stocks (from Jan. 1, 2012 to Dec. 31, 2018) you selected to research. i.e. Suppose that you want to download daily stock prices of Apple Inc. whose ticker symbol is “AAPL”. Then, run as follows: getSymbols("AAPL", src="yahoo", from='2012-01-01', to='2018-12-31') iii. Obtain monthly log stock returns for each stock. For example, if you downloaded daily stock prices of Apple, Inc. and Microsoft Corporation, then you will need to run the following: AAPL.rtn <- monthlyreturn(aapl$aapl.adjusted,="" subset="NULL," type='log' ,="" leading="TRUE)" msft.rtn=""><- monthlyreturn(msft$msft.adjusted,="" subset="NULL," type='log' ,="" leading="TRUE)" iv.="" prepare="" your="" data="" containing="" all="" monthly="" log="" stock="" returns="" of="" 17="" stocks,="" and="" assign="" the="" name="" 'myportfolio'="" (please="" refer="" to="" p.="" 11="" on="" ch="" 6="" course="" material="" to="" see="" how="" 'myportfolio'="" should="" look="" like.)="" 3)="" using="" 'myportfolio'="" containing="" monthly="" log="" stock="" returns="" of="" 17="" stocks,="" a)="" [5="" points]="" find="" the="" weights="" of="" mean-variance="" efficient="" portfolio="" (you="" can="" set="" your="" own="" target="" return.).="" b)="" [10="" points]="" find="" (plot)="" efficient="" frontier.="" ※="" the="" plot="" of="" efficient="" frontier="" should="" be="" legible="" (as="" fancy="" as="" possible).="" ※="" extra="" credit="" (5="" points:="" no="" partial="" credits)="" –="" by="" your="" own="" research="" suppose="" you="" want="" to="" invest="" in="" 17="" stocks="" you="" selected="" above.="" then,="" you="" obtained="" the="" weights="" of="" mean-variance="" efficient="" portfolio="" in="" 3)="" for="" your="" portfolio.="" if="" you="" construct="" your="" portfolio="" in="" 2019="" according="" to="" those="" weights,="" how="" your="" investment="" performance="" would="" be="" in="" 2019?="" 2.="" a="" bond="" price="" is="" the="" present="" value="" of="" all="" future="" cash="" flows="" (coupon="" interest="" every="" year="" and="" par="" value="" at="" time="" to="" maturity)="" as="" shown="" in="" ch="" 7="" course="" material.="" that="" is,="" bond="" price="∑" ×="" _????="" (1="" +="" )="" =1="" +="" (1="" +="" )="" ,="" where="" :="" par="" value="" of="" the="" bond="" _????:="" annual="" coupon="" rate="" :="" time="" to="" maturity="" :="" bond="" yield="" a="" function="" to="" calculate="" a="" bond="" price="" is="" presented="" on="" p.="" 5="" in="" ch="" 7="" course="" material.="" as="" you="" can="" see,="" the="" function="" exactly="" illustrates="" the="" equation="" above.="" 1)="" suppose="" you="" have="" to="" find="" coupon="" rate="" when="" you="" know="" all="" other="" variables,="" such="" as="" the="" bond="" price,="" par="" value,="" time="" to="" maturity,="" and="" yield.="" to="" find="" coupon="" rate="" instead="" of="" bond="" price,="" you="" can="" use="" the="" following="" formula="" (if="" you="" solve="" the="" equation="" above="" for="" c_rate,="" you="" can="" easily="" obtain="" this="" formula.).="" c_rate="????" −="" (1="" +="" )="" ∑="" (1="" +="" )="" =1="" therefore,="" if="" you="" invest="" in="" a="" bond="" that="" has="" $1,157.449="" of="" current="" bond="" price,="" $1,200="" of="" par="" value,="" 4="" years="" to="" maturity,="" and="" 5%="" of="" yield,="" you="" can="" calculate="" coupon="" rate="" as="" follows:="" #="" create="" time="" t="" t=""><- seq(1,="" 4,="" 1)="" #="" create="" present="" value="" factor="" pv_factor=""><- 1="" (1="" +="" 0.05)^t="" #="" current="" bond="" price="" bond_value=""><- 1157.449="" #="" par="" value="" c_rate=""><- (1157.449="" –="" 1200="" (1+0.05)^4)="" (1200*sum(pv_factor))="" c_rate="" [1]="" 0.0400001="" a)="" [8="" points]="" referring="" to="" the="" codes="" above,="" create="" your="" own="" function="" to="" calculate="" coupon="" rate.="" that="" is,="" you="" have="" to="" complete="" the="" body="" of="" the="" following="" function="" (bond_value:="" current="" bond="" price,="" par:="" par="" value,="" ttm:="" time="" to="" maturity,="" and="" y:="" yield).="" c_rate=""><- function="" (bond_value,="" par,="" ttm,="" y)="" {="" complete="" this="" part="" }="" b)="" [2="" points]="" using="" your="" own="" function="" created="" in="" part="" a),="" calculate="" coupon="" rate="" of="" the="" bond="" with="" bond_value="$1,172.61" par="$1,000" ttm="10" years="" y="6%" 2)="" suppose="" you="" have="" to="" find="" par="" value="" when="" you="" know="" all="" other="" variables,="" such="" as="" the="" bond="" price,="" coupon="" rate,="" time="" to="" maturity,="" and="" yield.="" to="" find="" par="" value="" instead="" of="" bond="" price,="" you="" can="" use="" the="" following="" formula="" (if="" you="" solve="" the="" equation="" above="" for="" par,="" you="" can="" easily="" obtain="" this="" formula.).="" par="Bond" price="" ×="" 1="" ∑="" (1="" +="" )="" +="" 1="" (1="" +="" )="" =1="" therefore,="" if="" you="" invest="" in="" a="" bond="" that="" has="" $1,070.919="" of="" current="" bond="" price,="" 7%="" of="" annual="" coupon="" rate,="" 4="" years="" to="" maturity,="" and="" 5%="" of="" yield,="" you="" can="" calculate="" par="" value="" as="" follows:="" #="" create="" time="" t="" t=""><- seq(1,="" 4,="" 1)="" #="" create="" present="" value="" factor="" pv_factor=""><- 1="" (1="" +="" 0.05)^t="" #="" coupon="" rate="" times="" pv_factor="" c_pv_factor=""><- 0.07="" *="" pv_factor="" #="" current="" bond="" price="" bond_value=""><- 1070.919="" #="" par="" value="" par=""><- bond_value="" (sum(c_pv_factor)="" +="" (1="" (1+0.05)^4))="" par="" [1]="" 1000="" a)="" [8="" points]="" referring="" to="" the="" codes="" above,="" create="" your="" own="" function="" to="" calculate="" par="" value.="" that="" is,="" you="" have="" to="" complete="" the="" body="" of="" the="" following="" function="" (bond_value:="" current="" bond="" price,="" c_rate:="" coupon="" rate,="" ttm:="" time="" to="" maturity,="" and="" y:="" yield).="" par=""><- function="" (bond_value,="" c_rate,="" ttm,="" y)="" {="" complete="" this="" part="" }="" b)="" [2="" points]="" using="" your="" own="" function="" created="" in="" part="" a),="" calculate="" par="" value="" of="" the="" bond="" with="" bond_value="$1,319.8278" c_rate="5%" ttm="13" years="" y="4%" ※="" extra="" credit="" (10="" points:="" no="" partial="" credits)="" –="" by="" your="" own="" research="" create="" your="" own="" function="" to="" approximately="" obtain="" yield.="" that="" is,="" complete="" the="" body="" of="" the="" following="" function:="" y=""><- function="" (bond_value,="" par,="" c_rate,="" ttm)="" {="" complete="" this="" part="" }="" note.="" you="" can="" obtain="" approximate="" yield.="" you="" would="" be="" able="" to="" see="" whether="" your="" function="" is="" correct="" or="" not,="" using="" the="" answers="" of="" part="" b)="" in="" 1)="" as="" well="" as="" part="" b)="" in="" 2).="" 3.="" in="" chapter="" 8,="" you="" can="" find="" how="" to="" calculate="" call="" and="" put="" option="" price="" by="" using="" black-scholes="" option="" pricing="" model.="" a)="" [12="" points]="" create="" your="" own="" function="" to="" calculate="" put="" option="" price.="" that="" is,="" you="" have="" to="" complete="" the="" body="" of="" the="" following="" function="" (s0:="" current="" stock="" price,="" k:="" strike="" price,="" r:="" risk-free="" rate,="" t:="" remaining="" time="" to="" maturity,="" and="" sigma:="" standard="" deviation="" of="" underlying="" stock="" price).="" put=""><- function="" (s0,="" k,="" r,="" t,="" sigma)="" {="" complete="" this="" part="" }="" b)="" [3="" points]="" using="" your="" own="" function="" created="" in="" part="" a),="" calculate="" put="" option="" price="" with="" s0="$1,000" k="$850" r="3%" t="3" years="" sigma="23%" ※="" extra="" credit="" (10="" points:="" no="" partial="" credits)="" –="" by="" your="" own="" research="" create="" your="" own="" function="" to="" approximately="" obtain="" sigma.="" that="" is,="" complete="" the="" body="" of="" the="" following="" function:="" sigma=""><- function (put, s0, k, r, t) { complete this part } note. you can obtain approximate sigma. you would be able to see whether your function is correct or not, using the answer of part b). 001.jpg 002.jpg function="" (put,="" s0,="" k,="" r,="" t)="" {="" complete="" this="" part="" }="" note.="" you="" can="" obtain="" approximate="" sigma.="" you="" would="" be="" able="" to="" see="" whether="" your="" function="" is="" correct="" or="" not,="" using="" the="" answer="" of="" part="" b).="" 001.jpg="">
Answered Same DayApr 21, 2021

Answer To: Project 3 ※ Using the R script, answer the following questions. Please show all works for full...

Sanchi answered on Apr 22 2021
134 Votes
# solution1
library(quantmod)
library(tseries)
library(xts)
tick <- c('A','AAPL','BRK','C','GOOG','HOG','HPQ','INTC','KO','LUV','MMM','MSFT','T','TGT','TXN','XOM','WMT')
for (i in
tick)
{
getSymbols(i, src="yahoo", from='2012-01-01', to='2018-12-31')
}
A.rtn <- monthlyReturn(A$A.Adjusted, subset=NULL, type='log', leading=TRUE)
AAPL.rtn <- monthlyReturn(AAPL$AAPL.Adjusted, subset=NULL, type='log', leading=TRUE)
BRK.rtn <- monthlyReturn(BRK$BRK.Adjusted, subset=NULL, type='log', leading=TRUE)
C.rtn <- monthlyReturn(C$C.Adjusted, subset=NULL, type='log', leading=TRUE)
GOOG.rtn <- monthlyReturn(GOOG$GOOG.Adjusted, subset=NULL, type='log', leading=TRUE)
HOG.rtn <- monthlyReturn(HOG$HOG.Adjusted, subset=NULL, type='log', leading=TRUE)
HPQ.rtn <- monthlyReturn(HPQ$HPQ.Adjusted, subset=NULL, type='log', leading=TRUE)
INTC.rtn <- monthlyReturn(INTC$INTC.Adjusted, subset=NULL, type='log', leading=TRUE)
KO.rtn <- monthlyReturn(KO$KO.Adjusted, subset=NULL, type='log', leading=TRUE)
LUV.rtn <- monthlyReturn(LUV$LUV.Adjusted, subset=NULL, type='log', leading=TRUE)
MMM.rtn <- monthlyReturn(MMM$MMM.Adjusted, subset=NULL, type='log', leading=TRUE)
MSFT.rtn <- monthlyReturn(MSFT$MSFT.Adjusted, subset=NULL, type='log', leading=TRUE)
T.rtn <- monthlyReturn(T$T.Adjusted, subset=NULL, type='log', leading=TRUE)
TGT.rtn <- monthlyReturn(TGT$TGT.Adjusted, subset=NULL, type='log', leading=TRUE)
TXN.rtn <- monthlyReturn(TXN$TXN.Adjusted, subset=NULL, type='log', leading=TRUE)
XOM.rtn <- monthlyReturn(XOM$XOM.Adjusted, subset=NULL, type='log', leading=TRUE)
WMT.rtn <- monthlyReturn(WMT$WMT.Adjusted, subset=NULL, type='log', leading=TRUE)
myportfolio <- merge(A.rtn,AAPL.rtn,BRK.rtn,C.rtn,GOOG.rtn,HOG.rtn,HPQ.rtn,INTC.rtn,KO.rtn,LUV.rtn,MMM.rtn,MSFT.rtn,T.rtn,TGT.rtn,TXN.rtn,XOM.rtn,WMT.rtn)
colnames(myportfolio) <- tick
myportfolio <-...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here