Investment Modeling Spring 2019, Practice Set # 3
1. Using table df, create table df2 with just the fruit and price columns.
2. Using table df, rename the columns ’year’, ’fruit’, ’price’ and ’qty’ to ’y’, ’f’, ’p’, and ’q’.
3. Using table df, convert it to a data.table dt.
4. Create a new column, oprice, that will be the price 2 rows before, so that df looks like this:
5. Create a new column, oprice, that will be the previous year’s price for each particular fruit, given the table below:
6. Create a new column, oprice, that will be the previous year’s price for each particular
fruit, and a column, oqty, that will be the qty from 2 years ago for each particular fruit given the table below:
7. Using the table from question # 6, create a column total, that is price * qty.
8. Using the table from question # 6, create a table dfs that will be just the years from 2016 and 2017 and just for the fruits; apple, plum, and melon.
9. Using the table from question # 6, merge it with the table below, dt, using the fruit col- umn:
10. Using table dft from question # 6, what is the result of the code below:
dft[fruit== ’orange ’ & qty==40]
|
11. Using table dft from question # 6, what is the result of the code below:
dft[fruit== ’orange ’,qty]
|
12. Using table dft from question # 6, what is the result of the code below:
dft[fruit== ’orange ’, . (qty)]
|
13. Using table dft from question # 6, what is the result of the code below:
dft[fruit== ’orange ’, . (price ,qty)]
|
14. Using table dft from question # 6, what is the result of the code below:
dft[fruit== ’orange ’,sum (price)]
|
15. Using table dft from question # 6, what is the result of the code below:
dft[year==2017, sum(price),by=fruit]
|
16. You invest $100 into a investment that you sell for $80 after 5 years. What is the 5 year return?
17. You invest $100 into a investment that you sell for $80 after 5 years. What is the annual compound return?
18. You invest in an asset for 5 years. The 1st year return was 5%, the 2nd year was -3%, the 3rd year return was 7%, the 4th year return was -2%, and the 5th year return was 1% . What is the annual compound return for the asset?
19. What is the meaning of the EY ratio?
20. What does the TEV value mean?
21. Given the table below, what is the TEV?
22. Given the table below, what is the EY ratio?
23. A real estate investment costs $450,000, that gives a monthly rent of $2500 a month. If
this investment has the same risk profile as the asset in question # 22, what should be the price of the stock so that the EY is comparable?
24. Fix the code below:
df = datadf[,c ( ’Date ’, ’PRIME ’, ’Shares Outstanding (Eop) ’, ’Cash And Cash
Equivalents ’, ’Operating Income ’, ’Total Debt Per Share ’, ’Preferred Stock
’, ’Minority Interest ’)]
names (df)=c ( ’Date ’, ’ticker ’, ’so ’, ’cash ’, ’oi ’, ’tds ’, ’ps ’, ’mi ’)
setDT(pricedf)
setDT(df)
df [, c ( ’oi2 ’, ’oi3 ’, ’oi4 ’)= shift(oi, n = 1:3),by= . (ticker)]
df [, oiavg=(oi+oi2+oi3+oi4)/4]
df2=df [Date in c (201506 ,201606 ,201706)]
pricedf=pricedf[ order (Ticker ,Date)]
pricedf[,Year=format (Date , ’%Y ’)]
df2[,Year= substr (Date , 1, 4)]
df2[pricedf , Price = Price , on = c (Year= "Year " , ticker= "Ticker " )]
df2[,td=(so*tds)]
df2[,ey=(oiavg/(so*Price+td-cash+ps+mi))]
|