Objective functions

R में इंटरमीडिएट पोर्टफोलियो विश्लेषण

Ross Bennett

Instructor

Objective functions

Objective functions उद्देश्य मान की गणना करती हैं. PortfolioAnalytics में, objective functions कोई भी मान्य R function हो सकती हैं.

  • कॉमन पोर्टफोलियो जोखिम मापदंड

    • standard deviation, expected shortfall, value at risk, component contribution to risk, maximum drawdown, Sharpe Ratio
  • कॉमन बेंचमार्क-सापेक्ष प्रदर्शन मापदंड

    • information ratio, tracking error, excess return, maximum relative drawdown
R में इंटरमीडिएट पोर्टफोलियो विश्लेषण

कस्टम objective functions

Objective functions के रूप में user-defined functions

  • आर्गुमेंट नामकरण:

    • एसेट रिटर्न के लिए R

    • पोर्टफोलियो weights के लिए weights

    • moments के लिए mu, sigma, m3, m4

  • एक single value लौटाएँ

R में इंटरमीडिएट पोर्टफोलियो विश्लेषण
# Annualized sharpe ratio
sr_annualized <- function(R, weights, sigma, scale, rfr){

    # Geometric annualized return
    r <- Return.annualized(Return.portfolio(R, weights), scale = scale)
    # Annual excess return
    re <- r - rfr

    # Annualized portfolio standard deviation
    pasd <- sqrt(as.numeric(t(weights) %*% 
                 sigma %*% weights)) * sqrt(scale)

    return(re / pasd)
}
R में इंटरमीडिएट पोर्टफोलियो विश्लेषण
data(edhec)
asset_returns <- edhec[,1:4]

# Setup spec and add constraints port_spec <- portfolio.spec(assets = colnames(asset_returns)) port_spec <- add.constraint(portfolio = port_spec, type = "full_investment") port_spec <- add.constraint(portfolio = port_spec, type = "long_only")
# Add custom objective function port_spec <- add.objective(portfolio = port_spec, type = "return", name = "sr_annualized", arguments = list(scale = 12, rfr = 0.02))
R में इंटरमीडिएट पोर्टफोलियो विश्लेषण

अभ्यास करते हैं!

R में इंटरमीडिएट पोर्टफोलियो विश्लेषण

Preparing Video For Download...