12.stockPortfolio_intro

12.stockPortfolio_intro - University of California, Los...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
University of California, Los Angeles Department of Statistics Statistics C183/C283 Instructor: Nicolas Christou Introduction to the package stockPortfolio As short introduction of the package stockPortfolio . ######################### #===> ((((( 1 ))))) <===# #===> quick example <===# ######################### # load package library(stockPortfolio) # select stocks #IBM: International Business Machines Copr. #LUV: Southwest Airlines Co. #AMR: AMR Corporation ticker <- c("IBM", "WFC", "JPM", "LUV", "AMR") #Get stock data gr <- getReturns(ticker, start="2005-03-31", end="2010-03-31") #gr is a "list" object and we find what it contains by typing the following: names(gr) #We can access each component of gr by typing: gr$R gr$ticker etc. #Obtain the variance-covariance matrix of the returns: cov(gr$R) IBM WFC JPM LUV AMR IBM 0.004032997 0.001119602 0.001909833 0.001835828 0.002888327 WFC 0.001119602 0.014004525 0.009073188 0.004552771 0.012378982 JPM 0.001909833 0.009073188 0.008714023 0.004077969 0.009667494 LUV 0.001835828 0.004552771 0.004077969 0.008271521 0.011399779 AMR 0.002888327 0.012378982 0.009667494 0.011399779 0.047216958
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/02/2011 for the course STATS 183 taught by Professor Nicolas during the Spring '11 term at UCLA.

Page1 / 4

12.stockPortfolio_intro - University of California, Los...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online