PerformanceAnalytics

Introductie tot portefeuilleanalyse in R

Kris Boudt

Professor, Free University Brussels & Amsterdam

De uitdaging voor de praktijk

  • In de praktijk: tijdreeks van portefeuillerendementen
  • Langer verleden → meer info over de portefeuille
  • Goed pakket: PerformanceAnalytics
Introductie tot portefeuilleanalyse in R

De makers

  • PerformanceAnalytics is hét pakket voor portefeuillerendementen in R

image18-1082.jpg

Peter Carl

image17-1083.jpg

Brian Peterson

1 https://tradeblotter.files.wordpress.com/2012/02/bwauthorpcc.jpeg
Introductie tot portefeuilleanalyse in R

Rendementen berekenen

  • Return.calculate: berekent activarendementen

  • Return.portfolio: berekent portefeuillerendement

  • Return.calculate(prices)

    • xts-object
  • Datumformaat: YYYY-MM-DD

Introductie tot portefeuilleanalyse in R

Rendementen berekenen

  • Return.calculate
returns <- Return.calculate(prices)
returns <- returns[(-1),]
head(prices)
AAPL   MSFT
2006-01-03 9.829465  21.07395
2006-01-04 9.858394  21.17603
2006-01-05 9.780810  21.19173
...
head(returns)
            AAPL         MSFT 
2006-01-03  NA           NA
2006-01-04  0.002943090  0.0048434670
2006-01-05 -0.007869842  0.0007415934
...
Introductie tot portefeuilleanalyse in R

Dynamiek van portefeuillegewichten

ch_1_video_4.002.png

Introductie tot portefeuilleanalyse in R

Dynamiek van portefeuillegewichten

ch_1_video_4.003.png

Introductie tot portefeuilleanalyse in R

Portefeuillerendementen

Return.portfolio <- function(R, weights = NULL, 
    rebalance_on = c(NA, "years", "quarters", 
                         "months", "weeks", "days"))
  • Drie te specificeren argumenten:
    • rendementsdata
    • gewichten
    • herbalancering
Introductie tot portefeuilleanalyse in R

Laten we oefenen!

Introductie tot portefeuilleanalyse in R

Preparing Video For Download...