Package FinCal. R topics documented: February 19, 2015



Similar documents
UNIVERSITY OF WAH Department of Management Sciences

Finance 3130 Corporate Finiance Sample Final Exam Spring 2012

( ) ( )( ) ( ) 2 ( ) 3. n n = = =

Return on Equity has three ratio components. The three ratios that make up Return on Equity are:

Unit Return computation with cash purchase vs. margin purchase

Chapter 4. The Time Value of Money

CHAPTER 2 ACCOUNTING STATEMENTS, TAXES, AND CASH FLOW

Quantitative Methods for Finance

1. If you wish to accumulate $140,000 in 13 years, how much must you deposit today in an account that pays an annual interest rate of 14%?

Computing Liquidity Ratios Current Ratio = CA / CL 708 / 540 = 1.31 times Quick Ratio = (CA Inventory) / CL ( ) / 540 =.53 times Cash Ratio =

FSA Note: Summary of Financial Ratio Calculations

FINC 3630: Advanced Business Finance Additional Practice Problems

TYPES OF FINANCIAL RATIOS

CHAPTER 8 STOCK VALUATION

TOPIC LEARNING OBJECTIVE

Course 1: Evaluating Financial Performance

PowerPoint. to accompany. Chapter 5. Interest Rates

CALCULATOR TUTORIAL. Because most students that use Understanding Healthcare Financial Management will be conducting time

] (3.3) ] (1 + r)t (3.4)

KEY EQUATIONS APPENDIX CHAPTER 2 CHAPTER 3

Chapter 17: Financial Statement Analysis

Financial Reporting & Analysis Inventories and Long-Lived Assets

Spring True/False Indicate whether the statement is true or false.

Often stock is split to lower the price per share so it is more accessible to investors. The stock split is not taxable.

You just paid $350,000 for a policy that will pay you and your heirs $12,000 a year forever. What rate of return are you earning on this policy?

ISS Governance Services Proxy Research. Company Financials Compustat Data Definitions

CHAPTER 14 COST OF CAPITAL

BF 6701 : Financial Management Comprehensive Examination Guideline

Stock valuation. Price of a First period's dividends Second period's dividends Third period's dividends = share of stock

FNCE 3010 (Durham). HW2 (Financial ratios)

Overview of Financial 1-1. Statement Analysis

CHAPTER 5 HOW TO VALUE STOCKS AND BONDS

CHAPTER 9 Time Value Analysis

1. What are the three types of business organizations? Define them

Chapter. How Well Am I Doing? Financial Statement Analysis

Chapter 8 Accounting for Receivables

MBA Financial Management and Markets Exam 1 Spring 2009

Click Here to Buy the Tutorial

TVM Applications Chapter

Assuming office supplies are charged to the Office Supplies inventory account when purchased:

SAMPLE FACT EXAM (You must score 70% to successfully clear FACT)

Gordon Guides For the MT Exam. Financial Math

MGT201 Solved MCQs(500) By

CHAPTER 2 FINANCIAL STATEMENTS AND CASH FLOW

MCQ on Financial Management

Bond Valuation. What is a bond?

CHAPTER 4. The Time Value of Money. Chapter Synopsis

Key Concepts and Skills. Standardized Financial. Chapter Outline. Ratio Analysis. Categories of Financial Ratios 1-1. Chapter 3

EMERSON AND SUBSIDIARIES CONSOLIDATED OPERATING RESULTS (AMOUNTS IN MILLIONS EXCEPT PER SHARE, UNAUDITED)

Exam 1 Morning Session

Practice Questions for Midterm II

Chapter Financial Planning Handbook PDP

Advanced Placement (AP) Accounting Course & Exam Pilot Program Course Outline, Learning Objectives and Student Outcomes

Financial ratio analysis

Package jrvfinance. R topics documented: October 6, 2015

Long Island University C.W. Post GBA 521. Final Exam - review

Problem Set: Annuities and Perpetuities (Solutions Below)

ANSWERS TO STUDY QUESTIONS

The Time Value of Money

3. If an individual investor buys or sells a currently owned stock through a broker, this is a primary market transaction.

HHIF Lecture Series: Financial Statement Analysis

Discounted Cash Flow Valuation

Advanced Placement (AP) Accounting Course and Exam Pilot Program Course Outline, Learning Objectives and Student Outcomes

CHAPTER 2 INTRODUCTION TO CORPORATE FINANCE

Intermediate Accounting II, ACCT 3322 Solutions Review Questions, Chapters 19 and 20

CHAPTER 12 RISK, COST OF CAPITAL, AND CAPITAL BUDGETING

ILLUSTRATION 5-1 BALANCE SHEET CLASSIFICATIONS

Finance 3130 Sample Exam 1B Spring 2012

ILLUSTRATION 17-1 CONVERTIBLE SECURITIES CONVERTIBLE BONDS

Accounting Pilot & Bridge Project Course Outline, Learning Objectives and Student Outcomes

1. This exam contains 12 pages. Please make sure your copy is not missing any pages.

CHAPTER 3 LONG-TERM FINANCIAL PLANNING AND GROWTH

How to calculate present values

CHAPTER 8 INTEREST RATES AND BOND VALUATION

How To Get A Profit From A Machine

MHSA Healthcare Financial Management Time Value of Money Analysis

Bus 300 Lemke Midterm Exam September 22, 2004

How To Calculate Financial Leverage Ratio

TYLER JUNIOR COLLEGE School of Continuing Studies 1530 SSW Loop 323 Tyler, TX

ACC 120 PRINCIPLES OF FINANCIAL ACCOUNTING

Examination: Financial Accounting Summer Term 2008 Examiner: Prof. Dr. Barbara Schöndube-Pirchegger Examination questions: 3

Real Estate. Refinancing

Advanced Placement (AP) Accounting Course & Exam Pilot Program Course Outline, Learning Objectives and Student Outcomes

Multiple Choice Questions (45%)

Integrated Case First National Bank Time Value of Money Analysis

Report Description. Business Counts. Top 10 States (by Business Counts) Page 1 of 16

Understanding Financial Information for Bankruptcy Lawyers Understanding Financial Statements

BUSINESS FINANCE (FIN 312) Spring 2008

Chapter 9 The Cost of Capital ANSWERS TO SELEECTED END-OF-CHAPTER QUESTIONS

Equity Analysis and Capital Structure. A New Venture s Perspective

NPV calculation. Academic Resource Center

Income Measurement and Profitability Analysis

CHAPTER 3 LONG-TERM FINANCIAL PLANNING AND GROWTH

ACCOUNTING COMPETENCY EXAM SAMPLE EXAM. 2. The financial statement or statements that pertain to a stated period of time is (are) the:

Accounting. Charles T. Horngren. Stanford University. Walter Harrison Jr. Baylor University. IVL Suzanne Oliver. Northwest Florida State College

Review Solutions FV = 4000*(1+.08/4) 5 = $

Chapter 2 Present Value

Discounted Cash Flow Valuation

How To Read The Book \"Financial Planning\"

Transcription:

Package FinCal February 19, 2015 Title Time Value of Money, time series analysis and Computational Finance Package for time value of money calculation, time series analysis and computational finance Version 0.6 Date 2014-02-24 Author Felix Yanhui Fan <nolanfyh@gmail.com> Imports ggplot2, reshape2, scales, RCurl Maintainer Felix Yanhui Fan <nolanfyh@gmail.com> License GPL (>= 2) URL http://felixfan.github.io/fincal/, http://rpubs.com/felix/7120 NeedsCompilation no Repository CRAN Date/Publication 2014-02-24 07:40:10 R topics documented: bdy............................................. 3 bdy2mmy.......................................... 3 candlestickchart...................................... 4 cash.ratio.......................................... 5 coefficient.variation..................................... 5 cogs............................................. 6 current.ratio......................................... 7 date.breaks......................................... 7 ddb............................................. 8 debt.ratio.......................................... 8 diluted.eps......................................... 9 discount.rate......................................... 10 ear.............................................. 11 ear.continuous........................................ 11 ear2bey........................................... 12 1

2 R topics documented: ear2hpr........................................... 12 EIR............................................. 13 EPS............................................. 14 financial.leverage...................................... 15 fv.............................................. 15 fv.annuity.......................................... 16 fv.simple........................................... 17 fv.uneven.......................................... 17 geometric.mean....................................... 18 get.ohlc.google....................................... 18 get.ohlc.yahoo........................................ 19 get.ohlcs.google....................................... 20 get.ohlcs.yahoo....................................... 20 gpm............................................. 21 harmonic.mean....................................... 22 hpr.............................................. 22 hpr2bey........................................... 23 hpr2ear........................................... 23 hpr2mmy.......................................... 24 irr.............................................. 24 iss.............................................. 25 linechart.......................................... 26 linechartmult........................................ 26 lt.d2e............................................ 27 mmy2hpr.......................................... 28 n.period........................................... 28 npm............................................. 29 npv............................................. 30 pmt............................................. 30 pv.............................................. 31 pv.annuity.......................................... 32 pv.perpetuity........................................ 33 pv.simple.......................................... 33 pv.uneven.......................................... 34 quick.ratio.......................................... 35 r.continuous......................................... 35 r.norminal.......................................... 36 r.perpetuity......................................... 37 sampling.error........................................ 37 SFRatio........................................... 38 Sharpe.ratio......................................... 38 slde............................................. 39 total.d2e........................................... 39 twrr............................................. 40 volumechart........................................ 41 was............................................. 41 wpr............................................. 42 Index 43

bdy 3 bdy Computing bank discount yield (BDY) for a T-bill Computing bank discount yield (BDY) for a T-bill bdy(d, f, t) d f t the dollar discount, which is equal to the difference between the face value of the bill and the purchase price the face value (par value) of the bill number of days remaining until maturity bdy2mmy bdy(d=1500,f=100000,t=120) bdy2mmy Computing money market yield (MMY) for a T-bill Computing money market yield (MMY) for a T-bill bdy2mmy(bdy, t) bdy t bank discount yield number of days remaining until maturity bdy

4 candlestickchart bdy2mmy(bdy=0.045,t=120) candlestickchart Technical analysts - Candlestick chart: show prices for each period as a continuous line. The box is clear if the closing price is higher than the opening price, or filled red if the closing is lower than the opening price. Technical analysts - Candlestick chart: show prices for each period as a continuous line. The box is clear if the closing price is higher than the opening price, or filled red if the closing is lower than the opening price. candlestickchart(ohlc, start = NULL, end = NULL, main = "",...) ohlc output from get.ohlc.yahoo or get.ohlc.google start start date to plot, if not specified, all date in ohlc will be included end end date to plot main an overall title for the plot... to be passed to methods get.ohlc.yahoo get.ohlc.google # google <- get.ohlc.yahoo("goog",start="2013-07-01",end="2013-08-01"); candlestickchart(google) # apple <- get.ohlc.google("aapl",start="2013-07-01",end="2013-08-01"); candlestickchart(apple)

cash.ratio 5 cash.ratio cash ratio Liquidity ratios measure the firm s ability to satisfy its short-term obligations as they come due. cash ratio Liquidity ratios measure the firm s ability to satisfy its short-term obligations as they come due. cash.ratio(cash, ms, cl) cash ms cl cash marketable securities current liabilities current.ratio quick.ratio cash.ratio(cash=3000,ms=2000,cl=2000) coefficient.variation Computing Coefficient of variation Computing Coefficient of variation coefficient.variation(sd, avg) sd avg standard deviation average value

6 cogs Sharpe.ratio coefficient.variation(sd=0.15,avg=0.39) cogs Cost of goods sold and ending inventory under three methods (FIFO,LIFO,Weighted average) Cost of goods sold and ending inventory under three methods (FIFO,LIFO,Weighted average) cogs(uinv, pinv, units, price, sinv, method = "FIFO") uinv pinv units price sinv method units of beginning inventory prince of beginning inventory nx1 vector of inventory units. inventory purchased ordered by time (from first to last) nx1 vector of inventory price. same order as units units of sold inventory inventory methods: FIFO (first in first out, permitted under both US and IFRS), LIFO (late in first out, US only), WAC (weighted average cost,us and IFRS) cogs(uinv=2,pinv=2,units=c(3,5),price=c(3,5),sinv=7,method="fifo") cogs(uinv=2,pinv=2,units=c(3,5),price=c(3,5),sinv=7,method="lifo") cogs(uinv=2,pinv=2,units=c(3,5),price=c(3,5),sinv=7,method="wac")

current.ratio 7 current.ratio current ratio Liquidity ratios measure the firm s ability to satisfy its short-term obligations as they come due. current ratio Liquidity ratios measure the firm s ability to satisfy its short-term obligations as they come due. current.ratio(ca, cl) ca cl current assets current liabilities cash.ratio quick.ratio current.ratio(ca=8000,cl=2000) date.breaks Deciding width (days or weeks) for date_breaks in plotting Deciding width (days or weeks) for date_breaks in plotting date.breaks(ohlc) ohlc output from get.ohlc.yahoo or get.ohlc.google google <- get.ohlc.yahoo("goog"); date.breaks(google)

8 debt.ratio ddb Depreciation Expense Recognition double-declining balance (DDB), the most common declining balance method, which applies two times the straight-line rate to the declining balance. Depreciation Expense Recognition double-declining balance (DDB), the most common declining balance method, which applies two times the straight-line rate to the declining balance. ddb(cost, rv, t) cost rv t cost of long-lived assets residual value of the long-lived assets at the end of its useful life. DDB does not explicitly use the asset s residual value in the calculations, but depreciation ends once the estimated residual value has been reached. If the asset is expected to have no residual value, the DB method will never fully depreciate it, so the DB method is typically changed to straight-line at some point in the asset s life. length of the useful life slde ddb(cost=1200,rv=200,t=5) debt.ratio debt ratio Solvency ratios measure the firm s ability to satisfy its long-term obligations. debt ratio Solvency ratios measure the firm s ability to satisfy its long-term obligations. debt.ratio(td, ta)

diluted.eps 9 td ta total debt total assets total.d2e lt.d2e financial.leverage debt.ratio(td=6000,ta=20000) diluted.eps diluted Earnings Per Share diluted Earnings Per Share diluted.eps(ni, pd, cpd = 0, cdi = 0, tax = 0, w, cps = 0, cds = 0, iss = 0) ni pd cpd cdi tax w cps cds iss net income preferred dividends dividends on convertible preferred stock interest on convertible debt tax rate weighted average number of common shares outstanding shares from conversion of convertible preferred stock shares from conversion of convertible debt shares issuable from stock options EPS iss was

10 discount.rate diluted.eps(ni=115600,pd=10000,cdi=42000,tax=0.4,w=200000,cds=60000) diluted.eps(ni=115600,pd=10000,cpd=10000,w=200000,cps=40000) diluted.eps(ni=115600,pd=10000,w=200000,iss=2500) diluted.eps(ni=115600,pd=10000,cpd=10000,cdi=42000,tax=0.4,w=200000,cps=40000,cds=60000,iss=2500) discount.rate Computing the rate of return for each period Computing the rate of return for each period discount.rate(n, pv, fv, pmt, type = 0) n pv fv pmt type number of periods present value future value payment per period payments occur at the end of each period (type=0); payments occur at the beginning of each period (type=1) fv.simple fv.annuity fv pv pmt n.period discount.rate(n=5,pv=0,fv=600,pmt=-100,type=0)

ear 11 ear Convert stated annual rate to the effective annual rate Convert stated annual rate to the effective annual rate ear(r, m) r m stated annual rate number of compounding periods per year ear.continuous hpr2ear ear2bey ear2hpr ear(r=0.12,m=12) ear(0.04,365) ear.continuous Convert stated annual rate to the effective annual rate with continuous compounding Convert stated annual rate to the effective annual rate with continuous compounding ear.continuous(r) r stated annual rate

12 ear2hpr ear r.norminal ear.continuous(r=0.1) ear.continuous(0.03) ear2bey bond-equivalent yield (BEY), 2 x the semiannual discount rate bond-equivalent yield (BEY), 2 x the semiannual discount rate ear2bey(ear) ear effective annual rate ear ear2bey(ear=0.08) ear2hpr Computing HPR, the holding period return Computing HPR, the holding period return ear2hpr(ear, t)

EIR 13 ear t effective annual rate number of days remaining until maturity hpr2ear ear hpr ear2hpr(ear=0.05039,t=150) EIR Equivalent/proportional Interest Rates An interest rate to be applied n times p.a. can be converted to an equivalent rate to be applied p times p.a. EIR(r, n = 1, p = 12, type = c("e", "p")) r n p type interest rate to be applied n times per year (r is annual rate!) times that the interest rate r were compounded per year times that the equivalent rate were compounded per year equivalent interest rates ( e,default) or proportional interest rates ( p ) # monthly interest rat equivalent to 5% compounded per year EIR(r=0.05,n=1,p=12) # monthly interest rat equivalent to 5% compounded per half year EIR(r=0.05,n=2,p=12) # monthly interest rat equivalent to 5% compounded per quarter EIR(r=0.05,n=4,p=12) # annual interest rate equivalent to 5% compounded per month EIR(r=0.05,n=12,p=1)

14 EPS # this is equivalent to ear(r=0.05,m=12) # quarter interest rate equivalent to 5% compounded per year EIR(r=0.05,n=1,p=4) # quarter interest rate equivalent to 5% compounded per month EIR(r=0.05,n=12,p=4) # monthly proportional interest rate which is equivalent to a simple annual interest EIR(r=0.05,p=12,type= p ) EPS Basic Earnings Per Share Basic Earnings Per Share EPS(ni, pd, w) ni pd w net income preferred dividends weighted average number of common shares outstanding diluted.eps was EPS(ni=10000,pd=1000,w=11000)

financial.leverage 15 financial.leverage financial leverage Solvency ratios measure the firm s ability to satisfy its long-term obligations. financial leverage Solvency ratios measure the firm s ability to satisfy its long-term obligations. financial.leverage(te, ta) te ta total equity total assets total.d2e lt.d2e debt.ratio financial.leverage(te=16000,ta=20000) fv Estimate future value (fv) Estimate future value (fv) fv(r, n, pv = 0, pmt = 0, type = 0) r n pv pmt type discount rate, or the interest rate at which the amount will be compounded each period number of periods present value payment per period payments occur at the end of each period (type=0); payments occur at the beginning of each period (type=1)

16 fv.annuity fv.simple fv.annuity pv pmt n.period discount.rate fv(0.07,10,1000,10) fv.annuity Estimate future value of an annuity Estimate future value of an annuity fv.annuity(r, n, pmt, type = 0) r n pmt type discount rate, or the interest rate at which the amount will be compounded each period number of periods payment per period payments occur at the end of each period (type=0); payments occur at the beginning of each period (type=1) fv fv.annuity(0.03,12,-1000) fv.annuity(r=0.03,n=12,pmt=-1000,type=1)

fv.simple 17 fv.simple Estimate future value (fv) of a single sum Estimate future value (fv) of a single sum fv.simple(r, n, pv) r n pv discount rate, or the interest rate at which the amount will be compounded each period number of periods present value fv fv.simple(0.08,10,-300) fv.simple(r=0.04,n=20,pv=-50000) fv.uneven Computing the future value of an uneven cash flow series Computing the future value of an uneven cash flow series fv.uneven(r, cf) r cf stated annual rate uneven cash flow

18 get.ohlc.google fv.simple fv.uneven(r=0.1, cf=c(-1000, -500, 0, 4000, 3500, 2000)) geometric.mean Geometric mean return Geometric mean return geometric.mean(r) r returns over multiple periods geometric.mean(r=c(-0.0934, 0.2345, 0.0892)) get.ohlc.google Download stock prices from Google Finance (open, high, low, close, volume) Download stock prices from Google Finance (open, high, low, close, volume) get.ohlc.google(symbol, start = "2013-01-01", end = "today") symbol symbol of stock, e.g. AAPL, GOOG, SPX start start date, e.g., 2013-07-31 end end date, e.g., 2013-08-06

get.ohlc.yahoo 19 get.ohlc.yahoo get.ohlcs.google # get.ohlc.google(symbol="aapl") # get.ohlc.google(symbol="aapl",start="2013-08-01") # get.ohlc.google(symbol="aapl",start="2013-07-01",end="2013-08-01") get.ohlc.yahoo Download stock prices from Yahoo Finance (open, high, low, close, volume, adjusted) Download stock prices from Yahoo Finance (open, high, low, close, volume, adjusted) get.ohlc.yahoo(symbol, start = "firstday", end = "today", freq = "d") symbol symbol of stock, e.g. AAPL, GOOG, SPX start start date, e.g., 2013-07-31 end end date, e.g., 2013-08-06 freq time interval, e.g., d:daily, w:weekly, m:monthly get.ohlcs.yahoo get.ohlc.google # get.ohlc.yahoo(symbol="aapl") # get.ohlc.yahoo(symbol="aapl",start="2013-08-01",freq="d") # get.ohlc.yahoo(symbol="aapl",start="2013-07-01",end="2013-08-01",freq="w")

20 get.ohlcs.yahoo get.ohlcs.google Batch download stock prices from Google Finance (open, high, low, close, volume) Batch download stock prices from Google Finance (open, high, low, close, volume) get.ohlcs.google(symbols, start = "2013-01-01", end = "today") symbols symbols of stock, e.g. AAPL, GOOG, SPX start start date, e.g., 2013-07-31 end end date, e.g., 2013-08-06 get.ohlc.google get.ohlcs.yahoo # get.ohlcs.google(symbols=c("aapl","goog","spy")) # get.ohlcs.google(symbols=c("aapl","goog","spy"),start="2013-01-01") # get.ohlcs.google(symbols=c("aapl","goog","spy"),start="2013-01-01",end="2013-07-31") get.ohlcs.yahoo Batch download stock prices from Yahoo Finance (open, high, low, close, volume, adjusted) Batch download stock prices from Yahoo Finance (open, high, low, close, volume, adjusted) get.ohlcs.yahoo(symbols, start = "firstday", end = "today", freq = "d")

gpm 21 symbols symbols of stock, e.g. AAPL, GOOG, SPX start start date, e.g., 2013-07-31 end end date, e.g., 2013-08-06 freq time interval, e.g., d:daily, w:weekly, m:monthly get.ohlc.yahoo get.ohlcs.google # get.ohlcs.yahoo(symbols=c("aapl","goog","spy"),freq="d") # get.ohlcs.yahoo(symbols=c("aapl","goog","spy"),start="2013-01-01",freq="m") gpm gross profit margin Evaluate a company s financial performance gross profit margin Evaluate a company s financial performance gpm(gp, rv) gp rv gross profit, equal to revenue minus cost of goods sold (cogs) revenue (sales) npm gpm(gp=1000,rv=20000)

22 hpr harmonic.mean harmonic mean, average price harmonic mean, average price harmonic.mean(p) p price over multiple periods harmonic.mean(p=c(8,9,10)) hpr Computing HPR, the holding period return Computing HPR, the holding period return hpr(ev, bv, cfr = 0) ev bv cfr ending value beginning value cash flow received twrr hpr2ear hpr2mmy hpr(ev=33,bv=30,cfr=0.5)

hpr2bey 23 hpr2bey bond-equivalent yield (BEY), 2 x the semiannual discount rate bond-equivalent yield (BEY), 2 x the semiannual discount rate hpr2bey(hpr, t) hpr t holding period return number of month remaining until maturity hpr hpr2bey(hpr=0.02,t=3) hpr2ear Convert holding period return to the effective annual rate Convert holding period return to the effective annual rate hpr2ear(hpr, t) hpr t holding period return number of days remaining until maturity ear hpr ear2hpr

24 irr hpr2ear(hpr=0.015228,t=120) hpr2mmy Computing money market yield (MMY) for a T-bill Computing money market yield (MMY) for a T-bill hpr2mmy(hpr, t) hpr t holding period return number of days remaining until maturity hpr mmy2hpr hpr2mmy(hpr=0.01523,t=120) irr Computing IRR, the internal rate of return Computing IRR, the internal rate of return irr(cf) cf cash flow,the first cash flow is the initial outlay

iss 25 pv.uneven npv # irr(cf=c(-5, 1.6, 2.4, 2.8)) iss calculate the net increase in common shares from the potential exercise of stock options or warrants calculate the net increase in common shares from the potential exercise of stock options or warrants iss(amp, ep, n) amp ep n average market price over the year exercise price of the options or warrants number of common shares that the options and warrants can be convened into diluted.eps iss(amp=20,ep=15,n=10000)

26 linechartmult linechart Technical analysts - Line charts: show prices for each period as a continuous line Technical analysts - Line charts: show prices for each period as a continuous line linechart(ohlc, y = "close", main = "",...) ohlc output from get.ohlc.yahoo or get.ohlc.google y y coordinates: close, open, high, low or adjusted main an overall title for the plot... to be passed to methods get.ohlc.yahoo get.ohlc.google # google <- get.ohlc.yahoo("goog"); linechart(google) # apple <- get.ohlc.google("aapl"); linechart(apple) linechartmult Technical analysts - Line charts: show prices for each period as a continuous line for multiple stocks Technical analysts - Line charts: show prices for each period as a continuous line for multiple stocks linechartmult(ohlcs, y = "close", main = "",...)

lt.d2e 27 ohlcs y main output from get.ohlc.yahoo.mult or get.ohlc.google.mult y coordinates: close, open, high, low or adjusted an overall title for the plot... to be passed to methods get.ohlcs.yahoo get.ohlcs.google linechart # googapple <- get.ohlcs.yahoo(c("goog","aapl"),start="2013-01-01"); # linechartmult(googapple) # googapple <- get.ohlcs.google(c("goog","aapl"),start="2013-01-01"); # linechartmult(googapple) lt.d2e long-term debt-to-equity Solvency ratios measure the firm s ability to satisfy its long-term obligations. long-term debt-to-equity Solvency ratios measure the firm s ability to satisfy its long-term obligations. lt.d2e(ltd, te) ltd te long-term debt total equity total.d2e debt.ratio financial.leverage lt.d2e(ltd=8000,te=20000)

28 n.period mmy2hpr Computing HPR, the holding period return Computing HPR, the holding period return mmy2hpr(mmy, t) mmy t money market yield number of days remaining until maturity bdy2mmy hpr2mmy hpr mmy2hpr(mmy=0.04898,t=150) n.period Estimate the number of periods Estimate the number of periods n.period(r, pv, fv, pmt, type = 0) r pv fv pmt type discount rate, or the interest rate at which the amount will be compounded each period present value future value payment per period payments occur at the end of each period (type=0); payments occur at the beginning of each period (type=1)

npm 29 pv fv pmt discount.rate n.period(0.1,-10000,60000000,-50000,0) n.period(r=0.1,pv=-10000,fv=60000000,pmt=-50000,type=1) npm net profit margin Evaluate a company s financial performance net profit margin Evaluate a company s financial performance npm(ni, rv) ni rv net income revenue (sales) gpm npm(ni=8000,rv=20000)

30 pmt npv Computing NPV, the PV of the cash flows less the initial (time = 0) outlay Computing NPV, the PV of the cash flows less the initial (time = 0) outlay npv(r, cf) r cf discount rate, or the interest rate at which the amount will be compounded each period cash flow,the first cash flow is the initial outlay pv.simple pv.uneven irr npv(r=0.12, cf=c(-5, 1.6, 2.4, 2.8)) pmt Estimate period payment Estimate period payment pmt(r, n, pv, fv, type = 0)

pv 31 r n pv fv type discount rate, or the interest rate at which the amount will be compounded each period number of periods present value future value payments occur at the end of each period (type=0); payments occur at the beginning of each period (type=1) pv fv n.period pmt(0.08,10,-1000,10) pmt(r=0.08,n=10,pv=-1000,fv=0) pmt(0.08,10,-1000,10,1) pv Estimate present value (pv) Estimate present value (pv) pv(r, n, fv = 0, pmt = 0, type = 0) r n fv pmt type discount rate, or the interest rate at which the amount will be compounded each period number of periods future value payment per period payments occur at the end of each period (type=0); payments occur at the beginning of each period (type=1)

32 pv.annuity pv.simple pv.annuity fv pmt n.period discount.rate pv(0.07,10,1000,10) pv(r=0.05,n=20,fv=1000,pmt=10,type=1) pv.annuity Estimate present value (pv) of an annuity Estimate present value (pv) of an annuity pv.annuity(r, n, pmt, type = 0) r n pmt type discount rate, or the interest rate at which the amount will be compounded each period number of periods payment per period payments occur at the end of each period (type=0); payments occur at the beginning of each period (type=1) pv pv.annuity(0.03,12,1000) pv.annuity(r=0.0425,n=3,pmt=30000)

pv.perpetuity 33 pv.perpetuity Estimate present value of a perpetuity Estimate present value of a perpetuity pv.perpetuity(r, pmt, g = 0, type = 0) r g pmt type discount rate, or the interest rate at which the amount will be compounded each period growth rate of perpetuity payment per period payments occur at the end of each period (type=0); payments occur at the beginning of each period (type=1) r.perpetuity pv.perpetuity(r=0.1,pmt=1000,g=0.02) pv.perpetuity(r=0.1,pmt=1000,type=1) pv.perpetuity(r=0.1,pmt=1000) pv.simple Estimate present value (pv) of a single sum Estimate present value (pv) of a single sum pv.simple(r, n, fv)

34 pv.uneven r n fv discount rate, or the interest rate at which the amount will be compounded each period number of periods future value pv pv.simple(0.07,10,100) pv.simple(r=0.03,n=3,fv=1000) pv.uneven Computing the present value of an uneven cash flow series Computing the present value of an uneven cash flow series pv.uneven(r, cf) r cf discount rate, or the interest rate at which the amount will be compounded each period uneven cash flow pv.simple npv pv.uneven(r=0.1, cf=c(-1000, -500, 0, 4000, 3500, 2000))

quick.ratio 35 quick.ratio quick ratio Liquidity ratios measure the firm s ability to satisfy its short-term obligations as they come due. quick ratio Liquidity ratios measure the firm s ability to satisfy its short-term obligations as they come due. quick.ratio(cash, ms, rc, cl) cash ms rc cl cash marketable securities receivables current liabilities current.ratio cash.ratio quick.ratio(cash=3000,ms=2000,rc=1000,cl=2000) r.continuous Convert a given norminal rate to a continuous compounded rate Convert a given norminal rate to a continuous compounded rate r.continuous(r, m) r m norminal rate number of times compounded each year

36 r.norminal r.norminal r.continuous(0.03,4) r.norminal Convert a given continuous compounded rate to a norminal rate Convert a given continuous compounded rate to a norminal rate r.norminal(rc, m) rc m continuous compounded rate number of desired times compounded each year r.continuous ear.continuous r.norminal(0.03,1) r.norminal(0.03,4)

r.perpetuity 37 r.perpetuity Rate of return for a perpetuity Rate of return for a perpetuity r.perpetuity(pmt, pv) pmt pv payment per period present value pv.perpetuity r.perpetuity(pmt=4.5,pv=-75) sampling.error Computing Sampling error Computing Sampling error sampling.error(sm, mu) sm mu sample mean population mean sampling.error(sm=0.45, mu=0.5)

38 Sharpe.ratio SFRatio Computing Roy s safety-first ratio Computing Roy s safety-first ratio SFRatio(rp, rl, sd) rp rl sd portfolio return threshold level return standard deviation of portfolio retwns Sharpe.ratio SFRatio(rp=0.09,rl=0.03,sd=0.12) Sharpe.ratio Computing Sharpe Ratio Computing Sharpe Ratio Sharpe.ratio(rp, rf, sd) rp rf sd portfolio return risk-free return standard deviation of portfolio retwns coefficient.variation SFRatio

slde 39 Sharpe.ratio(rp=0.038,rf=0.015,sd=0.07) slde Depreciation Expense Recognition Straight-line depreciation (SL) allocates an equal amount of depreciation each year over the asset s useful life Depreciation Expense Recognition Straight-line depreciation (SL) allocates an equal amount of depreciation each year over the asset s useful life slde(cost, rv, t) cost rv t cost of long-lived assets residual value of the long-lived assets at the end of its useful life length of the useful life ddb slde(cost=1200,rv=200,t=5) total.d2e total debt-to-equity Solvency ratios measure the firm s ability to satisfy its long-term obligations. total debt-to-equity Solvency ratios measure the firm s ability to satisfy its long-term obligations. total.d2e(td, te)

40 twrr td te total debt total equity total.d2e debt.ratio financial.leverage total.d2e(td=6000,te=20000) twrr Computing TWRR, the time-weighted rate of return Computing TWRR, the time-weighted rate of return twrr(ev, bv, cfr) ev bv cfr ordered ending value list ordered beginning value list ordered cash flow received list hpr twrr(ev=c(120,260),bv=c(100,240),cfr=c(2,4))

volumechart 41 volumechart Technical analysts - Volume charts: show each period s volume as a vertical line Technical analysts - Volume charts: show each period s volume as a vertical line volumechart(ohlc, main = "",...) ohlc main output from get.ohlc.yahoo or get.ohlc.google an overall title for the plot... to be passed to methods get.ohlc.yahoo get.ohlc.google # google <- get.ohlc.yahoo("goog"); # volumechart(google) # apple <- get.ohlc.google("aapl"); # volumechart(apple) was calculate weighted average shares weighted average number of common shares calculate weighted average shares weighted average number of common shares was(ns, nm) ns nm n x 1 vector vector of number of shares n x 1 vector vector of number of months relate to ns

42 wpr EPS diluted.eps s=c(10000,2000);m=c(12,6);was(ns=s,nm=m) s=c(11000,4400,-3000);m=c(12,9,4);was(ns=s,nm=m) wpr Weighted mean as a portfolio return Weighted mean as a portfolio return wpr(r, w) r w returns of the individual assets in the portfolio corresponding weights associated with each of the individual assets wpr(r=c(0.12, 0.07, 0.03),w=c(0.5,0.4,0.1))

Index bdy, 3, 3 bdy2mmy, 3, 3, 28 candlestickchart, 4 cash.ratio, 5, 7, 35 coefficient.variation, 5, 38 cogs, 6 current.ratio, 5, 7, 35 date.breaks, 7 ddb, 8, 39 debt.ratio, 8, 15, 27, 40 diluted.eps, 9, 14, 25, 42 discount.rate, 10, 16, 29, 32 ear, 11, 12, 13, 23 ear.continuous, 11, 11, 36 ear2bey, 11, 12 ear2hpr, 11, 12, 23 EIR, 13 EPS, 9, 14, 42 financial.leverage, 9, 15, 27, 40 fv, 10, 15, 16, 17, 29, 31, 32 fv.annuity, 10, 16, 16 fv.simple, 10, 16, 17, 18 fv.uneven, 17 geometric.mean, 18 get.ohlc.google, 4, 18, 19, 20, 26, 41 get.ohlc.yahoo, 4, 19, 19, 21, 26, 41 get.ohlcs.google, 19, 20, 21, 27 get.ohlcs.yahoo, 19, 20, 20, 27 gpm, 21, 29 harmonic.mean, 22 hpr, 13, 22, 23, 24, 28, 40 hpr2bey, 23 hpr2ear, 11, 13, 22, 23 hpr2mmy, 22, 24, 28 irr, 24, 30 iss, 9, 25 linechart, 26, 27 linechartmult, 26 lt.d2e, 9, 15, 27 mmy2hpr, 24, 28 n.period, 10, 16, 28, 31, 32 npm, 21, 29 npv, 25, 30, 34 pmt, 10, 16, 29, 30, 32 pv, 10, 16, 29, 31, 31, 32, 34 pv.annuity, 32, 32 pv.perpetuity, 33, 37 pv.simple, 30, 32, 33, 34 pv.uneven, 25, 30, 34 quick.ratio, 5, 7, 35 r.continuous, 35, 36 r.norminal, 12, 36, 36 r.perpetuity, 33, 37 sampling.error, 37 SFRatio, 38, 38 Sharpe.ratio, 6, 38, 38 slde, 8, 39 total.d2e, 9, 15, 27, 39, 40 twrr, 22, 40 volumechart, 41 was, 9, 14, 41 wpr, 42 43