Midterm Flashcards

1
Q

What is Supervised Regression Learning?

A

“Supervised” - provide example X,Y
“Regression” - numerical prediction (as opposed to classifications)
“Learning” - train with data

Examples: Linear Regression (parametric learning), KNN (instance based - keep data and consult it), Decision Trees, Decision Forests

03-01

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is Backtesting?

A

Rollback time and test your system. Let system only look at a subset of data and then use that to predict the “future” aka data we have, but haven’t let our system look at.

03-01

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are some problems with regression?

A
  • It’s Noisy and Uncertain
  • It’s challenging to Estimate Confidence
  • Holding time, allocation

Some issues can be addressed using Reinforcement Learning (learn policy, which tells us whether to buy/sell)

03-01

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is Linear Regression?

A

Parametric Learning

y = mx + b

03-02

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is K Nearest Neighbor?

A

Instance-based approached where we keep the data and use it when we make a query.

If k = 3, we find the 3 nearest historical data points and take mean of those 3 when querying. Some cons is that at the beginning/ends of the data, we’ll have horizontal lines due to there being no more data points.

Another similar method is called Kernel Regression.

03-02

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is Kernel Regression?

A

Kernel Regression weights the contributions of data points based on how close they are vs. KNN, where each gets an equal weight.

03-02

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the difference between Parametric and Instance based learning?

A

Parametric uses the data to train on and then discards it.

Instance based keeps the data and uses it during query time.

03-02

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

When to use Parametric vs. Non-Parametric models?

A

When something is biased (we have a guess), we should use a parametric model.

If we don’t have a guess, a non-parametric model would probably fit our data better (we keep the data to query on).

03-02

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

KNN: As K increases, what happens to the data?

A

If K = size of data, it’s a straight line, since we use the total number of elements and just take the mean of that. If K = 1, we just find the nearest data point, which will match the data.

Therefore, as we decrease K, we are more likely to OVERFIT the data.

03-03

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Parametric: As D (degree) increases, what happens to the data?

A

d = 1, y = mx = b
d = 2, y = m2x^2 +mx + b
etc.

Therefore, as D increases, we are more likely to OVERFIT the data.

03-03

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which would you expect to be larger? In Sample Error (training set) or Out of Sample Error (test set)?

A

Out of Sample

03-03

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are two ways to visualize or evaluate the accuracy of an algorithm?

A

RMSE and Correlation (Ytest vs. YPredict)

03-03

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

As RMSE error increase, correlation does what? (increases, decreases, not sure)

A

In most cases, as RMSE increases, correlation decreases, but there are some cases where the opposite happens so …

We can’t be sure.

03-03

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is overfitting?

A

Error on Y, Degrees of Freedom on X

As D increases, Y decreases (due to fitting the data more - until we reach the amount of data points).

As we increase D, in-sample error decreases, but out of sample error increases. This area is where overfitting occurs.

03-03

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Linear Regression vs. KNN: which is better for saving space?

A

Linear Regression (don’t need to store all the data)

03-03

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Linear Regression vs. KNN: which is better for train time?

A

KNN (no time to train)

03-03

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Linear Regression vs. KNN: which is better for query time?

A

Linear Regression (plug in numbers)

03-03

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Linear Regression vs. KNN: which is better for adding new data?

A

KNN (can add more data without recomputing factors)

03-03

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Why do we use Ensemble Learners?

A
  • Lower error than any individual method by itself
  • Less overfitting (because each learner has its own bias)

03-04

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What is Bootstrap Aggregating (bagging)?

A

Same learning algorithm, but train each learner on a different set of the data (sampling with replacement).

Developed by Bremen in late 80s.

03-04

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What is Boosting (Ada(ptive) Boost)?

A

In sebsequent creation of bags, each data instances is weighted based on previous error (points that were not predicted well). Significant error points are more likely to get picked in the next creation of a bag.

03-04

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Which is more likely to overfit as M (bags) increases? Simple Bagging or Ada Boost?

A

Ada Boost because as m increases, Ada Boost tries to assign more and more specific data points to subsequent learners, trying to model all the difficult exaples.

03-04

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What are Exchange-Traded Funds?

A
  • Buy/sell like stocks
  • Baskets of stocks
  • Transparent
  • Liquid (easy to trade, lots of dollar value trading each day)

Basket of equities allocated in such a way that the overall portfolio tracks the performance of a stock exchange index

02-01

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What are Mutual Funds?

A
  • Buy/sell at end of day
  • Quarterly disclosure (stated goals and you know what they’re trying to achieve)
  • Less transparent

02-01

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What are Hedge Funds?

A
  • Buy/sell agreement (hard to exit)
  • No disclosure
  • Not transparent

02-01

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

What are Assets Under Management (AUM)?

A

Total amount of money being managed by the fund.

02-01

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

How are fund managers compensated for ETFs, Mutual Funds, and Hedge Funds?

A

ETFs - expense ratio of AUM (0.01% - 1%)
Mutual Funds - expense ratio of AUM (0.5% - 3%)

Hedge Funds - “Two and Twenty”
2% of AUM + 20% of profits

02-01

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

Two and Twenty with $100M w. 15% Return. What is your compensation?

A

“Two” - $100M * 0.02 = $2M
“Twenty” - $15M * 0.2 = $3M

Total = $5M compensation

02-01

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

What are the 3 major types of investors in Hedge Funds? And Why?

A
  1. Individuals (rich fucks, usually 100 of them)
  2. Institutions (large retirement funds, university foundations, non-profit institutions)
  3. Funds of funds

Why would they invest in you?

  • track record (5 years)
  • simulation + story (reason why method works)
  • good portfolio fit (why your strat works with their portfolio)

02-01

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

What are the goals and metrics Hedge Funds go after?

A

Goals

  • Beat a benchmark e.g. SP500, but benchmark you choose should depend on your expertise
  • Absolute return (make slow gradual, positive returns no matter what - Long/Short)

Metrics

  • Cumulative Return = ((last val / first val) - 1)
  • Volatility = daily_return.std()
  • Risk/Reward = Sharpe Ratio

02-01

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

What is a Dark Pool?

A

Acts as an intermediary between Brokers and Exchanges. It looks at order books of exchanges and pays brokers the privilege to look at orders before going to exchanges. IF they see an advantageous trade, they take it.

80-90% of retail traders, never make it to exchanges because they’re done internally at a brokerage or filled in a dark pool.

Both OK with it because they don’t have to pay exchange fees.

02-02

32
Q

What are the different order types and who executes them?

A

Exchanges: buy/sell, market limit

Brokers: stop loss (when price reaches a lower limit, sell it), stop gain (when price reaches upper limit, sell it), trailing stop (combo for stop loss), sell short (negative position on stock)

02-02

33
Q

What is short selling?

A

Borrow 100 shares from Joe
Sell 100 shares to Lisa at $100 each for $10K
We have $10K, but owe Joe 100 shares

We need to buy 100 shares to give back to Joe. If price went down, we can buy them cheaper and keep the difference.

IF stock went up, we lose money (and there is no limit to how high a stock can go).

02-02

34
Q

What is the difference between interest rate and discount rate?

A

Interest Rate is used with a given Present Value, to figure out what the Future Value would be.

Discount Rate is used when we have a known or desired Future Value, and want to compute the corresponding Present Value.

02-03

35
Q
  1. What is Intrinsic Value of company? Dividends of company?
A

PV = FV / DR

$1 dividend each year at 5% interest
= $1 / 0.05 = $20

02-03

36
Q
  1. What is Book Value?
A

Total assets minus intangible assets and liabilities.

aka

Total assets - liabilities (we don’t count intangible assets)

02-03

37
Q
  1. What is Market Capitalization?
A

Market Cap = # of share * price

AKA you can buy the entire company for the computation above

02-03

38
Q

Looking at Intrinsic Value, Book Value, and Market Capitalization, would you buy the stock?

A

If Market Cap < Book Value, you can turn it around for Book Value - Market Cap.

If stocks go below Book Value, people will buy whole company, so it’s rare that happens.

  • If intrinsic value drops significantly while stock price (market cap) is high, it might be worthwhile to short stock.
  • If intrinsic value goes up while market cap is low, it might be worth it to buy stock
  • Book value provides “lowest price”

02-03

39
Q

What’s the return?

StockA = +1%
StockB = -2%
wA = 75%
wB = -25%
A

.01(.75) + -.02(-.25) = 1.25%

02-04

40
Q

What is “Cap Weighted”?

A

Take sum of Market Cap for stock and divide it by sum of all Market Caps of all Stocks.

AAPL and AMZ have about 5% of SP500 (large weights).

02-04

41
Q

What is the CAPM Equation?

A

Ri(t) = Bi*Rm + Ai(t)

  • significant proportion of return from stock is due to the market (Bi*Rm)
  • many stocks have Bi = 1 (if market goes up 1%, stock goes up 1%)
  • Ai = residual -> CAPM says Ai = 0

02-04

42
Q

What is Passive vs. Active investment?

A

Both passive and active manager agree with Bi*Rm part of equation; essentially that how stock moves is with market and strongly related to Beta.

CAPM says Ai(t) is random and its expected value is 0.
vs.
Active managers believe they can predict Ai(t).

02-04

43
Q

In upwards markets, what kind of Beta do you want? In downwards markets?

A

Larger B in upwards; Smaller B in downwards according to CAPM. A doesn’t matter according to CAPM.

02-04

44
Q

What are the implications of CAPM?

A

Expected A = 0; therefore, the only way to beat markets is with B.

Choose high B in upwards; Low B in downwards. BUT Efficient Market Hypothesis says you can’t predict the market (so choosing high B/low B is not an option).

02-04

45
Q

What is Arbitrage Pricing Theory?

A

Stephen Ross 1976

Compute for each stock, B in each sector. By breaking out B in each sector, we can get a better forecast of returns.

02-04

46
Q

Can you still lose with perfect A and perfect B?

A

Yes. How can we fix this? Using CAPM.

02-05

47
Q

How can Hedge Funds use CAPM?

A

Assuming we have actionable info to convert to forecast (Ai) and Bi in regard to market, we can …

  • minimize market risk by finding B for portfolio = 0, by finding appropriate weights for each stock

02-05

48
Q

What are characteristics of Technical Analysis?

A
  • Looks only at price and volume (vs. fundamental which looks at earnings, dividends, book flow, cash flow, etc.)
  • Looks back at price/volume to computer statistics called indicators
  • Indicators are heuristics that hint at buy/sell opportunity

Why it might work:

  • info in price
  • heuristics work in other domains of AI

02-06

49
Q

When is Technical Analysis Effective?

A
  • Individual indicators are weak
  • Combinations are stronger
  • Look for contrasts (stocks vs. market)
  • Shorter time periods

02-06

50
Q

When do Technical and Fundamental Analysis have value?

A

Technical: Milliseconds
Fundamental: Later on, years

Decision Speed: Technical
Decision Complexity: Fundamental

02-06

51
Q

What are some indicators in Technical Analysis?

A

Momentum: Over X days, how much has the price changed (pos/neg momentum)
moment(t) = (price(t) / price(t - n)) - 1
n = days ago

Range: -0.5 to 0.5

Simple Moving Average: Average over n-day window

Bollinger Bands: Use Simple Moving Average and use 2std above and below; measure for how strong of a deviation we want to see before we respond to it
BB(t) = [price(t) - SMA(t)] / 2*std(t)

02-06

52
Q

How are Simple Moving Averages used as indicators?

A

Places where current price cross through Simple Moving Average.

Combined w. momentum (strong momentum and price crosses through SMA), can be a signal.

Proxy for underlying value (arbitrage opportunity)

Range: -0.5 to 0.5

02-06

53
Q

How do you use Bollinger Bands?

A

Look for cross from outside to inside.

SELL: if moving from outside top band to inside
BUY: if moving from outside lower band to inside

Range: -1 to 1 (-1 on lower band, 1 on top band)

02-06

54
Q

How to normalize all Technical indicators?

A

Normalize!

normed = values for indicator - mean() / std()

Range: -1 to 1, mean 0

02-06

55
Q

np.shape returns what?

A

A tuple of (rows, cols)

56
Q

np.size returns what?

A

Total number of elements e.g. if shape is (5,4), size = 20

57
Q
np.sum([
[1,2],
[3,4].
[5,6]
])
A

21

Adds all of them up regardless of dimension.

58
Q

np axis=0 refers to rows or cols?

A

cols

59
Q

np axis=1 refers to rows or cols?

A

rows

60
Q
np.sum([
[1,2],
[3,4].
[5,6]
], axis=0)
A

[9, 12]

summing down rows

61
Q
np.sum([
[1,2],
[3,4].
[5,6]
], axis=1)
A

[3, 7, 11]

summing across cols

62
Q
np.max([
[1,2],
[3,4].
[5,6]
], axis=0)
A

[5, 6]

63
Q
np.min([
[1,2],
[3,4].
[5,6]
], axis=1)
A

[1, 3, 5]

64
Q

argmax() returns what?

A

Index of maximum value in 1d array

65
Q

What does a[ : , 0:3:2] return?

A

Selects columns 0, 2 for every row

66
Q

What do we do with missing data?

A

Fill forward; then fill back

df. fillna(method=”ffill”, inplace=True)

df. fillna(method=”bfill”, inplace=True)

67
Q

What is Kurtosis?

A

Positive value = fatter tails or more occurrences than Normal Distribution

Negative value = fewer occurrences than Normal Distribution

68
Q

How to calculate value of portfolio day by day?

A
normed = prices/prices[0]
alloced = normed * allocs

position_vals = alloced * start_val
- at each day how much the position is worth

portfolio_val = position_vals.sum(axis=1)
- sum across each day (each col in a row)

69
Q

What are key portfolio statistics?

A
daily returns (daily_rets)
daily_rets[1:]
cumulative returns (cum_ret)
(port_val[-1] / port_val[0]) - 1

avg daily returns (avg_daily_ret)
daily_rets.mean()

std daily returns (std_daily_ret)
daily_rets.std()

sharpe ratio (sharpe_ratio)

01-07

70
Q

What is Sharpe Ratio (definition)?

A

Risk adjusted return; SR considers risk free rate of return

All else being equal: lower risk is better and higher return is better

01-07

71
Q

What is Sharpe Ratio (formula)?

A

S = mean(daily_rets - daily_rf) / std(daily_rets)

ExAnte: S = E[Rp - Risk free rate] / std[Rp - Risk free rate]

The value of a portfolio is directly proportional to the return it generates over some baseline (here risk-free rate), and inversely proportional to its volatility.

01-07

72
Q

What are options to use for “risk free rate”?

A

LIBOR (London Interbank Offer Rate)
3mo Treasury Bill
0%

01-07

73
Q

What is the daily risk free rate shortcut?

A

daily_rf = 252nd square root of (1.0 + risk free rate) - 1

01-07

74
Q

Can Sharpe Ratio vary widely depending on how frequently you sample?

A

Yes. SR is an annual measure.

SRannual = k * SR

sampling dailyK = root of 252
sampling weeklyK = root of 52
sampling monthlyK = root of 12

01-07

75
Q

What is a basis point (bip)?

A

1 basis point = 1/100 of 1% = .0001

01-07

76
Q

What are optimizers used for?

A
  1. Find minimum values of functions
  2. Build parameterized models based on data
  3. Refine allocations to stocks in portfolios

01-08