STA302/1001 - Methods of Data Analysis I
(Week 01 - Lecture A)
Wei (Becky) Lin
May 15-19, 2017
1/50
About me
Wei(Becky) Lin
PhD and MSc degrees in statistics and a BSEc degree in computer science.
Now an assistant professor, in teaching stream at UTSG.
Re
STA302/1001 - Methods of Data Analysis I
(Week 01 - lecture B)
Wei (Becky) Lin
May 15-19, 2017
1/41
From last lecture (Week 1- Lect A)
Notes about syllabus.
A functional relationship vs a statistical relationship.
Simple linear regression: Yi = 0 + 1 Xi +
STA302H1F - Methods of Data Analysis I
Wei(Becky) Lin
Summer 2017
Course description
The main objectives of this course are to gain a solid understanding of the theory and application of linear
regression analysis and practical skills for developing linea
STA302H1F - Methods of Data Analysis II
(How to set up R and Rstudio?)
Wei (Becky) Lin
May 10, 2017
1/11
Main goal - Set up R and R studio
Please follow the instruction in these slides to set up R and
Rmarkdown (R notebook is came with the latest R studi
Assignment 1
Last name: Chan
First name: Tsun Yan
Student ID: 1001756744
Course section: STA302H1F-Summer 2017
Due Date: May 25, 2017, 23:00
Q1 (4 pts) - Typing mathematical notations.
Q1-a: Show that
Proof:
qn
i
=0
(Xi X)
n
i=1
=
(Xi X)
=
=
n
i=1
n
i=1
Assignment 1
Last name: Chan
First name: Tsun Yan
Student ID: 1001756744
Course section: STA302H1F-Summer 2017
Due Date: May 25, 2017, 23:00
Q1 (4 pts) - Typing mathematical notations.
Q1-a: Show that
Pn
i
=0
(Xi X)
Proof:
n
n
n
X
X
X
=
X
(Xi X)
Xi
i=1
Office hour schedule of STA302
Summer, 2017
Date
TA and Time
Week 1
(Wed, May 17)
Week 2
(Wed, May 24)
Week 3
(Wed, May 31)
Week 3: OH for Midterm
(Fri, June 2)
Week 4: OH for MT
(Monday, June 5)
Week 4
(Wed, June 7)
Week 5
(June 21)
O
ACTB40
Fundamentals of
Investment & Credit
Lecture 20
1
Example
Assume
term structure (normal):
Maturity
yr
1yr
1 yr
2yr
Spot Rate
8%
9%
10%
11%
Find prices of 2-yr bonds with coupon rates of 5%
& 10% (all rates nominal, comp. semi-annually)
2
Example
ACTB40
Fundamentals of
Investment & Credit
Lecture 14
1
Bonds
Bond:
Debt certificates paying principal
amount at some future date (maturity), and
periodic payments (coupons)
F : face value (aka par value) of bond
n : number of coupon periods until maturi
ACTB40
Fundamentals of
Investment & Credit
Lecture 15
1
Amortization of Bonds
For
taxation & other accounting purposes, it
is necessary to determine the amount of
interest received and principal returned in
bond coupons / redemption payment
E.g. When buy
ACTB40
Fundamentals of
Investment & Credit
Lecture 19
3/12/17
1
Term Structure of Interest
Rates (Chapter 6)
When
a borrower arranges a loan, there are
a number of factors that the lender will
consider in setting the interest rate on the
loan, for exampl
ACTB40
Fundamentals of
Investment & Credit
Lecture 9
1
Arithmetic Progression
Increasing Payments
Consider
annuity where payments grow by
constant amount (arithmetic growth)
payment:
0
1
2
3
n1
n
1
2
3
n1
n time
Present Value at 20 (annuity-imm):
3
n
(
ACTB40
Fundamentals of
Investment & Credit
Lecture 18
1
Internal Rate of Return
For
the 3 examples without a unique,
valid IRR, we had: C 1.33 (A)
2
C0 1, C1 2.3, & C2 1.32 (B)
C 1.2825 (C)
2
Even
though we cannot compare IRRs, one
of these transaction
ACTB40
Fundamentals of
Investment & Credit
Lecture 12
1
Prospective Form of
Outstanding Balance
0
K1
1
Kt
t
vKt+1
v2Kt+2
vn1tKn1
vntKn
Kt+1
Kt+2
t+1
t+2
Kn1
Kn
n1
n
time
Kt+1
Kt+2
(L)
Kn1
Kn
Outstanding
Balance at time t = present
value at time t of fut
ACTB40
Fundamentals of
Investment & Credit
Lecture 13
1
Bonds
Bond
is interest-bearing certificate of public
(governments) or private (corporate) debt
Governments / corporations issue & sell bonds to
collect capital for their investments or expenses
Bon
ACTB40
Fundamentals of
Investment & Credit
Lecture 21
1
Arbitrage
Arbitrage
is a transaction that has only
positive cashflows (requires no money)
E.g.
0
1
2
3
Arbitrage
cashflows:
0
0
+C
+C
0
0
0
+C
0
0
+C
0
Arbitrage
OR
OR
(C>0)
are the equivalent of a
ACTB40
Fundamentals of
Investment & Credit
Lecture 22
1
Cashflow duration
Economist
Frederick Macaulay (Some
Theoretical Problems Suggested by
Movements of Interest Rates(1938)
commented that only short term loans can
be absolutely secure.
The idea of l
ACTB40
Fundamentals of
Investment & Credit
Lecture 10
1
Loan Repayment
Consider
loan of amount L, to be repaid by #n
end-of-period payments of amounts K1,Kn
Loan:
L
Payments:
0
K1
K2
K3
1
2
3
Kn1
n1
Kn
n time
If
loans effective interest rate is i per pa
ACTB40
Fundamentals of
Investment & Credit
Lecture 11
1
Amortization of Loan with
Level Payments
Consider
loan with level periodic payments of
K throughout and level interest rate i.
For simplicity, assume K 1 L an i
(L)
1
0
1
From
1
2
1
1
1
t
n1
n
pros
ACTB40
Fundamentals of
Investment & Credit
Lecture 17
1
Comparing Investments
Consider
an investment, represented by a
stream of (+ve or ve) cashflows C0,C1,Cn
Cashflow:
C0
0
C1
1
C2
2
Cn1
n1
Cn
n
time
Investment
appraisal (Capital Budgeting) :
process
ACTB40
Fundamentals of
Investment & Credit
Lecture 4
1
Nominal Rates
In
practice, many interest rates are quoted in
a format different than compound rates
E.g. Credit cards typically quote their APR (Annual
Percentage Rate) or Annual Interest Rate , whic
ACTB40
Fundamentals of
Investment & Credit
Lecture 7
1
Annuity Due
Another
standard form of annuity is one
where payments occur at the beginning of
each period. This is called an annuity-due:
1
1
1
1
1
1
1
0
1
2
n1
1
Annuity-Immediate
Annuity-Due
n
time
ACTB40 Fundamentals of Investment & Credit
Mahinda Samarakoon
September 7, 2016
Mahinda Samarakoon
ACTB40 Fundamentals of Investment & Credit
1 / 21
Accumulation Factor Function
Accumulation Factor Function a(t) is the accumulated value
at time t of an in
ACTB40
Fundamentals of
Investment & Credit
Lecture 5
1
Last Hour
2
Last Hour
3
Inflation Rate
General
increase in price of products &
services measured by annual inflation rate (r)
Calculated as annual rate of change of Consumer
Price Index (CPI), a spec
ACTB40
Fundamentals of
Investment & Credit
Lecture 8
1
Perpetuity Due
A perpetuity-due is an infinite stream of
payments at the beginning of each period
1
1
Perpetuity-Immediate
1
1
1
Perpetuity-Due
0
1
2
Imm
Due
PV: a i
1
1
1 v v
1 v d
1 1
(1 i )a i (
ACTB40 Fundamentals of Investment & Credit
Mahinda Samarakoon
September 7, 2016
Mahinda Samarakoon
ACTB40 Fundamentals of Investment & Credit
1/7
Equation of Value: Exercise
An account has balance B at t = 0. At t = 2, 4, & 6, amounts
B/3 are withdrawn. I
UNIVERSITY OF TORONTO SCARBOROUGH
Department of Computer and Mathematical Sciences
Midterm Test, October 2016
ACTB40 Fundamentals of Investment and Credit
Duration: One hour and forty five minutes
First Name:
Last Name:
Student number:
Tutorial (e.g. TUT0
Statistical Inference
R packages used in this chapter
library(ggplot2)
library(dplyr)
#
# Attaching package:
dplyr
# The following objects are masked from package:stats:
#
#
filter, lag
# The following objects are masked from package:base:
#
#
intersect,
A data analysis example
Before we start, a diversion
I
R comes with various addins called packages. We will (in this
chapter) be using the packages ggplot2 and dplyr. (These are for
making nice graphs and for data manipulation, respectively.)
I
To use a p
History, installation and connection
The men behind our software
Jim Goodnight, CEO SAS Inc
Ross Ihaka
Robert Gentleman
(Duncan Temple Lang)
originators of R
2 / 75
History
SAS
From late 1960s, North Carolina
State.
Then: punched cards, submit
job, get ou