Stat 107 Spring 2012 HW #5 Solutions
1 (a) The following weights are obtained from Excel Solver (note: since we are dealing with minimizing an absolute value, there is NOT ONE UNIQUE SOLUTION, and the weights you get may vary slightly): Description FMAGS
#
#
# Section 2 Code:
# Playing with R and quantmod
#
#
#1) for loop example
total=0
for(i in 1:100)cfw_
if(i%2 = 0)cfw_
total=total+i
total
#2) function example
sum.evens = function(end, start=1)cfw_
total=0
for(i in start:end)cfw_
if(i%2 = 0)cf
Stat 107
Section #3
February 15 & 16, 2012
Logistics
Kevin Rader, krader@hsph.harvard.edu. Sections: Wed 1-2pm (SC-B10), Thurs 12-1pm (SC-216).
Office Hours (SC-602): Wed 2-2:30pm, Thurs 1-1:30, Fri 2-3pm
Homework #2 is due on Friday night, Feb 17th, be
Stat 107
Section #1
February 1 & 2, 2012
Logistics
Kevin Rader, krader@hsph.harvard.edu. Office hours (SC-602): Wed 2-3pm, Fri 1-2pm (TBD in future)
Course website: my.harvard.edu/k85336.
All section material will be posted under 'Sections Kevin's Sect
Stat 107: Introduction to Business and Financial Statistics
Class 4: Statistics Review, Part II
1
As January goes so does the year
http:/blog.stocktradersalmanac.com/post/As-January-Goes-so-Goes-the-Year 2
The Data
3
Review of Basic Statistics (cont)
Rand
Stat 107
Section #2
February 10, 2012
Logistics
Bambo Sosina,sosina@fas.harvard.edu. Office hours (SC-600): Fri 1-3pm
Course website: my.harvard.edu/k85336.
All section material will be posted under 'Sections Bambo's Sections' on the course website:
ht
Stat 107: Introduction to Business and Financial Statistics
Class 6: Simulation (cont) and
Portfolios, part 1
1
Simulating Two Assets
In the previous examples, we assumed we
were simply investing in one asset, the
market index.
But that was purely for eas
Stat 107: Introduction to Business and Financial Statistics
Class 1: Introduction
1
Where Am I?
Michael Parzen: Sci 300b
Office Phone: 617-495-8711
Google Voice: 617-942-0621
Email: mparzen@stat.harvard.edu
2
Who Am I?
3
Warning
This is the first second(!
Stat 107: Introduction to Business and Financial Statistics
Class 3: Statistics Review, Part I
1
Homework Discussion
Due Midnight Friday night via email
stat107spring2012@gmail.com
Idea of Momentumpapers on website
etfreplay.com
200 day moving average (mo
#1 a for loop to do confidence intervals from a normal distribution to see if they cover the true mean
#b)
n=20
zstar=qnorm(0.975)
tstar=qt(0.975,df=n-1)
zstar
tstar
#f)
set.seed(02138)
n=20
x=rnorm(n)
hist(x)
xbar=mean(x)
s=sd(x)
zlb=xbar-zstar*1/sqrt(n)
Stat 107: Introduction to Business and Financial Statistics
Class 4: Monte Carlo Simulation
1
Historical Note
The name Monte Carlo simulation comes
from the computer simulations performed
during the 1930s and 1940s to estimate the
probability that the cha
Stat 107: Introduction to Business and Financial Statistics
Class 9: Portfolios, part 2
1
Return on a portfolio
Assume we have n stocks of interest
Let Ri be a random variable denoting the
return of stock
Hence the return on a portfolio is given by
the
th
STATE STREET ASSOCIATES
Outline
Systemic risk:
Applications for investors and policymakers
The absorption ratio as a measure of implied systemic risk
The absorption ratio and the pricing of risky assets
Mark Kritzman
Windham Capital Management
MIT Sloan S
Stat 107: Introduction to Business and Financial Statistics
Class 13: The Single Index Model
1
The World is Complicated
2
Systemic Risk
Financial Stability Board: a risk of disruption to financial
services that is caused by an impairment of all or parts o
Stat 107: Introduction to Business and Financial Statistics
Class 15: Single Index Models, part 2
1
Oh that Wayne.
2
Whats in the works
Dear Prof. Parzen,
I hope that you enjoyed the spring break. The IOP, Harvard Dems,
Libertarians, and I have been talki
Stat 107: Introduction to Business and Financial Statistics
Class 16: Pontificating about the Project and Beta
1
The Class Project
Important Dates
April 10th: project proposal
May 1st: project due
There are least two directions one can take
for the final
Stat 107: Introduction to Business and Financial Statistics
Class 17: Performance Analytics, part 1
1
2
Pairs Trading Redux
We have you backtest a pairs trading
strategy on this weeks homework.
Based on an idea presented in a Brazilian
paper
paper on the
Stat 107: Introduction to Business and Financial Statistics
Class 18: Performance Analytics, part 2
1
Style Analytics
Is a forthcoming package in R that will allow
one to do style analysis; in particular rolling
style analysis.
Recall, we assume the style
Stat 107: Introduction to Business and Financial Statistics
Class 19: Value at Risk
1
Playing with PerformanceAnalytics
Some R Code
getSymbols("AAPL",from="2009-01-01")
getSymbols("JNJ",from="2009-01-01")
getSymbols("SPY",from="2009-01-01")
aaplret=monthl
Stat 107: Introduction to Business and Financial Statistics
Class 21: VaR and Resampling
1
Value at Risk
Simply put, assume you have a $1,000,000
portfolio (very cool! )
You ask: What is the probability that I'd lose
$X (OR MORE) over the next M months?
M
Stat 107: Introduction to Business and Financial Statistics
Class 22: A brief time on time series analysis
1
Time-Series Data and Dependence
Time-series data are simply a collection of
observations gathered over time.
All the finance data weve looked at h
Stat 107: Introduction to Business and Financial Statistics
Class 23: Technical Analysis
1
Introduction
Technical analysis is the attempt to forecast
stock prices on the basis of market-derived
data.
Technicians (also known as quantitative
analysts or cha
Stat 107: Introduction to Business and Financial Statistics
Class 25: Behavioral Finance and Wrap Up
1
Cognitive Biases
Fundamental Limitations In
Human Mental Processes
Simple Rules Of Thumb Leading
To Faulty Judgments
Similar To Optical Illusions
Physic
Stat 107
Section #2
February 7-9, 2012
Logistics
Kevin Rader, krader@hsph.harvard.edu. Sections: Wed 1-2pm (SC-B10), Thurs 12-1pm (SC-216).
Office Hours (SC-602): Wed 2-3pm, Fri 2-3pm
Course website: my.harvard.edu/k85336.
All section material will be
Stat 107
Section #4
February 22 & 23, 2012
Logistics
Kevin Rader, krader@hsph.harvard.edu. Sections: Wed 1-2pm (SC-B10), Thurs 12-1pm (SC-216).
Office Hours (SC-602): Wed 2-3pm, Thurs 1-2pm, Fri 2-3pm
Homework #3 is due next Friday night, Mar 2, before
Stat 107
Section #5
February 29 & March 1, 2012
Logistics
Kevin Rader, krader@hsph.harvard.edu. Sections: Wed 1-2pm (SC-B10), Thurs 12-1pm (SC-216).
Office Hours (SC-602): Wed 2-3pm, Thurs 1-2pm, Fri 2-3pm
Homework #3 is due Friday night before midnight