Section 3 - TFs

# Section 3 - TFs - Stat 107 Spring 2012 Section#3 Topics for...

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

Stat 107 – Spring 2012 Section #3 Topics for Section - Expectations and Variances (of discrete RV’s) - Linear Combination of Random Variables - Continuous Distributions - Monte Carlo Sampling of Yearly Returns - R Practice Problems: 1) Sampling from Specified Distribution Let’s do a simulation similar to what Prof Parzen did in lecture on Tueday. Let’s imagine we built a portfolio comprised of 50% Coca-Cola (KO) and 50% McDonalds (MCD) (two of the largest companies in the market). Let’s start by downloading their stock prices for the last ~25 years (we will be assuming the last 25 years is a good reflection of future returns on the companies). In fact, the start date will be Jan 28, 1986 (what happened on that date?) > library(quantmod) >library(logspline) > getSymbols("KO", from = "1986-01-28", to = "2012-02- 01") > getSymbols("MCD", from = "1986-01-28", to = "2012-02- 01") > rets=0.5*yearlyReturn(KO)+0.5*yearlyReturn(MCD) > hist(rets, col="thistle") a) What is this a histogram of? Does the histogram look normally distributed? Let’s look at 3 different ways to sample from this historical data: 1) From the empirical distribution (the actual observations) 2) From a Normal Distribution with the same mean and variance 3) From a continuous Distribution that is somehow best fit over the actual histogram > x1=sample(rets,1000,replace=T) > x2=rnorm(1000,mean=mean(rets),sd=sqrt(var(rets)))

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 4

Section 3 - TFs - Stat 107 Spring 2012 Section#3 Topics for...

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

View Full Document
Ask a homework question - tutors are online