R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("fPortfolio-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('fPortfolio') Loading required package: fBasics Rmetrics, (C) 1999-2005, Diethelm Wuertz, GPL fBasics: Markets, Basic Statistics, Date and Time Loading required package: fCalendar Rmetrics, (C) 1999-2005, Diethelm Wuertz, GPL fCalendar: Markets, Basic Statistics, Date and Time Loading required package: fSeries Rmetrics, (C) 1999-2005, Diethelm Wuertz, GPL fSeries: The Dynamical Process Behind Financial Markets Loading required package: fMultivar Loading required package: mgcv This is mgcv 1.3-1 Loading required package: nnet Rmetrics, (C) 1999-2005, Diethelm Wuertz, GPL fSeries 2: Multivariate Financial Markets Analysis Rmetrics, (C) 1999-2004, Diethelm Wuertz, GPL fPortfolio: Portfolio Selection and Optimization > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "A1-MultivariateDistribution" > > ### * A1-MultivariateDistribution > > flush(stderr()); flush(stdout()) > > ### Name: MultivariateDistribution > ### Title: Multivariate Normal and Student-t Distributions > ### Aliases: MultivariateDistribution fMV fMV-class dmvsnorm pmvsnorm > ### rmvsnorm dmvst pmvst rmvst mvFit print.fMV plot.fMV summary.fMV > ### Keywords: distribution > > ### ** Examples > > ## SOURCE("fBasics.A0-SPlusCompatibility") > ## SOURCE("fPortfolio.A1-MultivariateDistribution") > > ## rmvst - > xmpPortfolio("\nStart: Student-t with Random Deviates > ") > par(mfcol = c(3, 1), cex = 0.7) > r1 = rmvst(200, dim = 1) > ts.plot(as.ts(r1), xlab = "r", main = "Student-t 1d") > r2 = rmvst(200, dim = 2, Omega = matrix(c(1, 0.5, 0.5, 1), 2)) > ts.plot(as.ts(r2), xlab = "r", col = 2:3, main = "Student-t 2d") > r3 = rmvst(200, dim = 3, mu = c(-1, 0, 1), alpha = c(1, -1, 1), df = 5) > ts.plot(as.ts(r3), xlab = "r", col = 2:4, main = "Skew Student-t 3d") > > ## mvFit - > xmpPortfolio("\nNext: Fit Distribution > ") > # Generate Grid Points: > n = 51 > x = seq(-3, 3, length = n) > xoy = cbind(rep(x, n), as.vector(matrix(x, n, n, byrow = TRUE))) > X = matrix(xoy, n * n, 2, byrow = FALSE) > head(X) [,1] [,2] [1,] -3.00 -3 [2,] -2.88 -3 [3,] -2.76 -3 [4,] -2.64 -3 [5,] -2.52 -3 [6,] -2.40 -3 > # The Bivariate Normal Case: > Z = matrix(dmvsnorm(X, dim = 2), length(x)) > par (mfrow = c(2, 2), cex = 0.7) > persp(x, x, Z, theta = -40, phi = 30, col = "steelblue4") > title(main = "Bivariate Normal Plot") > image(x, x, Z) > title(main = "Bivariate Normal Contours") > contour(x, x, Z, add = TRUE) > # The Bivariate Skew-Student-t Case: > mu = c(-0.1, 0.1) > Omega = matrix(c(1, 0.5, 0.5, 1), 2) > alpha = c(-1, 1) > Z = matrix(dmvst(X, 2, mu, Omega, alpha, df = 3), length(x)) > persp(x, x, Z, theta = -40, phi = 30, col = "steelblue4") > title(main = "Bivariate Student-t Plot") > image(x, x, Z) > contour(x, x, Z, add = TRUE) > title(main = "Bivariate Student-t Contours") > > ## plot - > if (require(fExtremes)) { + xmpPortfolio("\nNext: Scatterplot, QQ and PP Plots > ") + # Student-t: Fixed number of degrees of freedom: + fit2 = mvFit(x = rmvst(100, 5), method = "st", fixed.df = NA) + # Show Model Slot: + fit2@model + # Show Scatterplot: + par(mfrow = c(1, 1), cex = 0.7) + plot(fit2, which = c(TRUE, FALSE, FALSE, FALSE, FALSE)) + # Show QQ and PP Plots: + par(mfrow = c(2, 2), cex = 0.7) + plot(fit2, which = !c(TRUE, FALSE, FALSE, FALSE, FALSE)) + # Interactive Plots: + # par(mfrow = c(1, 1)) + # plot(fit2, which = "ask") + } Loading required package: fExtremes Rmetrics, (C) 1999-2004, Diethelm Wuertz, GPL fExtremes: Beyond the Sample: Dealing with Extreme Values > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "A2-AssetsModelling" > > ### * A2-AssetsModelling > > flush(stderr()); flush(stdout()) > > ### Name: AssetsModelling > ### Title: Modelling of Multivariate Asset Sets > ### Aliases: AssetsModelling fASSETS fASSETS-class assetsSim assetsFit > ### assetsSelect assetsStats print.fASSETS plot.fASSETS summary.fASSETS > ### Keywords: models > > ### ** Examples > > ## SOURCE("fBasics.A0-SPlusCompatibility") > ## SOURCE("fPortfolio.A2-AssetsModelling") > > ## berndtInvest - > xmpPortfolio("\nStart: Load monthly data set of returns > ") > data(berndtInvest) > # Exclude Date, Market and Interest Rate columns from data frame, > # then multiply by 100 for percentual returns ... > berndtAssets = berndtInvest[, -c(1, 11, 18)] > rownames(berndtAssets) = berndtInvest[, 1] > head(berndtAssets) CITCRP CONED CONTIL DATGEN DEC DELTA GENMIL GERBER IBM MOBIL 1-Jan-78 -0.115 -0.079 -0.129 -0.084 -0.100 -0.028 -0.099 -0.048 -0.029 -0.046 1-Feb-78 -0.019 -0.003 0.037 -0.097 -0.063 -0.033 0.018 0.160 -0.043 -0.017 1-Mar-78 0.059 0.022 0.003 0.063 0.010 0.070 -0.023 -0.036 -0.063 0.049 1-Apr-78 0.127 -0.005 0.180 0.179 0.165 0.150 0.046 0.004 0.130 0.077 1-May-78 0.005 -0.014 0.061 0.052 0.038 -0.031 0.063 0.046 -0.018 -0.011 1-Jun-78 0.007 0.034 -0.059 -0.023 -0.021 0.023 0.008 0.028 -0.004 -0.043 PANAM PSNH TANDY TEXACO WEYER 1-Jan-78 0.025 -0.008 -0.075 -0.054 -0.116 1-Feb-78 -0.073 -0.025 -0.004 -0.010 -0.135 1-Mar-78 0.184 0.026 0.124 0.015 0.084 1-Apr-78 0.089 -0.008 0.055 0.000 0.144 1-May-78 0.082 0.019 0.176 -0.029 -0.031 1-Jun-78 0.019 0.032 -0.014 -0.025 0.005 > > ## assetsSelect - > xmpPortfolio("\nNext: Select 4 most dissimilar assets from hclust > ") > clustered = assetsSelect(berndtAssets, doplot = FALSE) > myAssets = berndtAssets[, c(clustered$order[1:4])] > colnames(myAssets) [1] "CONTIL" "DATGEN" "TANDY" "DEC" > # Scatter and time series plot: > par(mfrow = c(2, 1), cex = 0.7) > plot(clustered) > myPrices = apply(myAssets, 2, cumsum) > ts.plot(myPrices, main = "Selected Assets", + xlab = "Months starting 1978", ylab = "Price", col = 1:4) > legend(0, 3, legend = colnames(myAssets), pch = "----", col = 1:4, cex = 1) > > ## assetsStats - > if (require(fBasics)) assetsStats(myAssets) CONTIL DATGEN TANDY DEC Records 120.000 120.000 120.000 120.000 paMean -0.013 0.094 0.345 0.265 paAve -0.004 0.026 0.087 0.068 paVola 0.151 0.128 0.128 0.099 paSkew 1.999 0.279 0.552 -0.089 paKurt 16.402 1.669 0.785 2.540 maxDD 1.453 1.018 0.847 0.541 TUW 43.000 30.000 46.000 21.000 mMaxLoss -0.600 -0.342 -0.246 -0.364 mVaR -0.364 -0.204 0.048 0.034 mModVaR -1.398 -0.284 -0.043 -0.020 mSharpe -0.087 0.734 2.705 2.668 mModSharpe 0.009 -0.330 -8.116 -13.445 skPrice -0.037 0.037 -0.652 -0.420 > > ## assetsSim - > xmpPortfolio("\nNext: Fit a Skew Student-t > ") > fit = assetsFit(myAssets) > # Show Model Slot: > fit @model $mu CONTIL DATGEN TANDY DEC 0.01022950 0.00510446 0.03763053 0.01080663 $Omega CONTIL DATGEN TANDY DEC CONTIL 0.007574760 0.002644490 0.002609649 0.001715675 DATGEN 0.002644490 0.010040589 0.004875508 0.004306032 TANDY 0.002609649 0.004875508 0.011309984 0.004017812 DEC 0.001715675 0.004306032 0.004017812 0.005466660 $alpha CONTIL DATGEN TANDY DEC -2.233256e-01 -3.789005e-05 -2.385207e-01 3.260600e-01 $df [1] 4.118503 > # Simulate set with same properties: > set.seed(1953) > simAssets = assetsSim(n = 120, dim = 4, model = fit@model) > head(simAssets) V1 V2 V3 V4 1 0.01139188 0.08447736 0.09617182 0.061608403 2 -0.06973573 0.04842965 0.03044951 -0.003701457 3 0.02258202 -0.01718455 0.12885083 0.009701734 4 0.04114705 0.12015298 0.05542981 -0.007974320 5 0.04247112 0.05183009 0.29141806 0.183063206 6 0.01479039 -0.03463586 -0.02202967 -0.002789266 > simPrices = apply(simAssets, 2, cumsum) > ts.plot(simPrices, main = "Simulated Assets", + xlab = "Number of Months", ylab = "Simulated Price", col = 1:4) > legend(0, 3, legend = colnames(simAssets), pch = "----", col = 1:4, cex = 1) > > ## plot - > xmpPortfolio("\nNext: Show Simulated Assets Plots > ") > if (require(fExtremes)) { + # Show Scatterplot: + par(mfrow = c(1, 1), cex = 0.7) + plot(fit, which = c(TRUE, FALSE, FALSE, FALSE, FALSE)) + # Show QQ and PP Plots: + par(mfrow = c(2, 2), cex = 0.7) + plot(fit, which = !c(TRUE, FALSE, FALSE, FALSE, FALSE)) + } Loading required package: fExtremes Rmetrics, (C) 1999-2004, Diethelm Wuertz, GPL fExtremes: Beyond the Sample: Dealing with Extreme Values > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "A3-DrawdownStatistics" > > ### * A3-DrawdownStatistics > > flush(stderr()); flush(stdout()) > > ### Name: DrawdownStatistics > ### Title: Drawdown Statistics > ### Aliases: DrawdownStatistics dmaxdd pmaxdd rmaxdd maxddStats > ### Keywords: distribution > > ### ** Examples > > ## SOURCE("fBasics.A0-SPlusCompatibility") > ## SOURCE("fPortfolio.A3-DrawdownStatistics") > > ## rmaxdd - > xmpPortfolio("\nStart: Simulate maximum Drawdowns > ") > # Set a random seed > set.seed(1953) > # horizon of the investor, time T > horizon = 1000 > # number of MC samples, N -> infinity > samples = 1000 > # Range of expected Drawdons > xlim = c(0, 5)*sqrt(horizon) > # Plot Histogram of Simulated Max Drawdowns: > r = rmaxdd(n = samples, mean = 0, sd = 1, horizon = horizon) > hist(x = r, n = 40, probability = TRUE, xlim = xlim, + col = "steelblue4", border = "white", main = "Max. Drawdown Density") > points(r, rep(0, samples), pch = 20, col = "orange", cex = 0.7) > > ## dmaxdd - > xmpPortfolio("\nNext: Compare with True Density > ") > x = seq(0, xlim[2], length = 200) > d = dmaxdd(x = x, sd = 1, horizon = horizon, N = 1000) > lines(x, d, lwd = 2) > > ## pmaxdd - > xmpPortfolio("\nNext: Count Frequencies > ") > # Count Frequencies of Drawdowns Greater or Equal to "h": > n = 50 > x = seq(0, xlim[2], length = n) > g = rep(0, times = n) > for (i in 1:n) g[i] = length (r[r > x[i]]) / samples > plot(x, g, type ="h", lwd = 3, + xlab = "q", main = "Max. Drawdown Probability") > # Compare with True Probability "G_D(h)": > x = seq(0, xlim[2], length = 5*n) > p = pmaxdd(q = x, sd = 1, horizon = horizon, N = 5000) > lines(x, p, lwd = 2, col="steelblue4") > > ## maxddStats - > xmpPortfolio("\nNext: Compute expectation Value E[D] > ") > maxddStats(mean = -0.5, sd = 1, horizon = 10^(1:4)) [1] 6.841696 52.000000 502.000000 5002.000000 > maxddStats(mean = 0.0, sd = 1, horizon = 10^(1:4)) [1] 3.963327 12.533141 39.633273 125.331414 > maxddStats(mean = 0.5, sd = 1, horizon = 10^(1:4)) [1] 2.529253 4.566413 6.809237 9.101853 > > > > cleanEx(); ..nameEx <- "B1-VaRModelling" > > ### * B1-VaRModelling > > flush(stderr()); flush(stdout()) > > ### Name: VaRModelling > ### Title: Value-at-Risk Measures for Portfolios > ### Aliases: VaRModelling VaR CVaR CVaRplus lambdaCVaR pfolioMaxLoss > ### pfolioReturn pfolioTargetReturn pfolioTargetRisk pfolioSigma > ### pfolioHist > ### Keywords: math > > ### ** Examples > > ## SOURCE("fBasics.A0-SPlusCompatibility") > ## SOURCE("fPortfolio.B1-VaRModelling") > > ## assetsSim - > xmpPortfolio("\nStart: Artificial Mean Variance Portfolio > ") > myAssets = 100/12 * assetsSim(n = 120, dim = 4) > # Plot Cumulated Returns of the Assets: > prices = apply(myAssets, 2, FUN = cumsum) > par(mfrow = c(2, 1), cex = 0.7) > ts.plot(prices, col = 1:4, ylim = c(-300, 300)) > legend(0, 300, legend = colnames(myAssets), pch = "----", col = 1:4) > title(main = "Cumulated Returns", ylab = "Cumulated Returns") > abline(h = 0, lty = 3) > > ## CVaR - > xmpPortfolio("\nNext: Value-at-Risk and related measures > ") > equalWeights = rep(1/4, 4) > alpha = 0.10 > # Value at Risk: > VaR(myAssets, equalWeights, alpha) 23 -5.829052 > # Conditional Value at Risk Plus: > CVaRplus(myAssets, equalWeights, alpha) [1] -7.386715 > # Conditional Value at Risk Plus: > CVaR(myAssets, equalWeights, alpha) 23 -7.386715 > # Lambda - Atomic Split Value: > lambdaCVaR(120, alpha) [1] 0 > > ## pfolioHist - > xmpPortfolio("\nNext: Plot risk measures of portfolio > ") > # : > # Maximum Loss Value of the Portfolio > pfolioMaxLoss(myAssets, equalWeights) [1] -8.942029 > # Compute Portfolio Returns: > r = pfolioReturn(myAssets, equalWeights) > head(r) Portfolio 1 -6.2863089 2 8.0724834 3 -3.0463971 4 0.2229955 5 2.5478401 6 -3.1161434 > # Target Return and Target Risk: > pfolioTargetReturn(myAssets, equalWeights) TargetReturn 0.1698133 > pfolioTargetRisk(myAssets, equalWeights) TargetRisk 4.153612 > # Plot: > pfolioHist(myAssets, equalWeights, alpha, n = 20) VaR: -5.829052 VaRplus: -7.386715 max Loss: -8.942029 Mean: 0.1698133 StDev: 4.153612 > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "B2-MarkowitzPortfolio" > > ### * B2-MarkowitzPortfolio > > flush(stderr()); flush(stdout()) > > ### Name: MarkowitzPortfolio > ### Title: Markowitz Portfolio > ### Aliases: MarkowitzPortfolio fPFOLIO fPFOLIO-class portfolioMarkowitz > ### frontierMarkowitz montecarloMarkowitz print.fPFOLIO plot.fPFOLIO > ### summary.fPFOLIO > ### Keywords: math > > ### ** Examples > > ## SOURCE("fBasics.A0-SPlusCompatibility") > ## SOURCE("fPortfolio.B2-MarkowitzPortfolio") > > ## Not run: > ##D ## berndtInvest - > ##D xmpPortfolio("\nStart: Load monthly data set of returns > ") > ##D data(berndtInvest) > ##D # Exclude Date, Market and Interest Rate columns from data frame, > ##D # then multiply by 100 for percentual returns ... > ##D berndtAssets = berndtInvest[, -c(1, 11, 18)] > ##D rownames(berndtAssets) = berndtInvest[, 1] > ##D head(berndtAssets) > ##D > ##D ## Markowitz Portfolios: > ##D myPortfolio = portfolioMarkowitz(berndtAssets, targetReturn = 20/100/12) > ##D print(myPortfolio) > ##D pm = myPortfolio@pfolio$pm > ##D ps = myPortfolio@pfolio$ps > ##D pw = myPortfolio@pfolio$pw > ##D pfolioTargetReturn(berndtAssets, pw) > ##D pfolioTargetRisk(berndtAssets, pw) > ##D > ##D myPortfolio = portfolioMarkowitz(berndtAssets, targetReturn = 20/100/12) > ##D print(myPortfolio) > ##D pm = myPortfolio@pfolio$pm; pm > ##D ps = myPortfolio@pfolio$ps; ps > ##D pw = myPortfolio@pfolio$pw; pw > ##D pfolioTargetReturn(berndtAssets, pw) > ##D pfolioTargetRisk(berndtAssets, pw) > ##D > ##D ## Plot results: > ##D plot(myPortfolio) > ## End(Not run) > > > > cleanEx(); ..nameEx <- "B3-TwoAssetsPortfolio" > > ### * B3-TwoAssetsPortfolio > > flush(stderr()); flush(stdout()) > > ### Name: TwoAssetsPortfolio > ### Title: Two Assets Portfolio > ### Aliases: TwoAssetsPortfolio fPFOLIO2 fPFOLIO2-class > ### frontierTwoAssetsMarkowitz frontierTwoAssetsCVaR print.fPFOLIO2 > ### plot.fPFOLIO2 summary.fPFOLIO2 > ### Keywords: data > > ### ** Examples > > ## SOURCE("fBasics.A0-SPlusCompatibility") > ## SOURCE("fPortfolio.B3-TwoAssetsPortfolio") > > ## Not run: > ##D ## berndtInvest - > ##D xmpPortfolio("\nStart: Load monthly data set of returns > ") > ##D data(berndtInvest) > ##D # Select "IBM" and "DEC" > ##D twoAssets = berndtInvest[, c("IBM", "DEC")] > ##D rownames(twoAssets) = berndtInvest[, 1] > ##D head(twoAssets) > ##D > ##D ## Compute Efficient Frontier: > ##D myPortfolio = frontierTwoAssetsMarkowitz(twoAssets) > ##D > ##D ## Print Efficient Frontier: > ##D print(myPortfolio) > ##D > ##D ## Plot Efficient Frontier: > ##D plot(myPortfolio) > ##D > ##D ## Compute Efficient Frontier: > ##D myPortfolio = frontierTwoAssetsCVaR(twoAssets) > ##D > ##D ## Print Efficient Frontier: > ##D print(myPortfolio) > ##D > ##D ## Plot Efficient Frontier: > ##D plot(myPortfolio) > ##D > ##D > ##D > ##D show = > ##D function(i,j) { > ##D w = (0:100)/100 > ##D alpha = 0.04 > ##D par(mfrow = c(2,2), cex = 0.5) > ##D > ##D > ##D print(c(i, j)) > ##D twoAssets = cbind(berndtInvest[, i], berndtInvest[, j]) > ##D print(head(twoAssets)) > ##D > ##D > ##D means = apply(twoAssets, 2, mean) > ##D x.Return = y.VaR = y.CVaR = y.CVaRplus = NULL > ##D for (k in 1:101) { > ##D weights = c(w[k], 1-w[k]) > ##D x.Return = c(x.Return, weights > ##D y.VaR = c(y.VaR, -VaR(twoAssets, weights, alpha)) > ##D y.CVaR = c(y.CVaR, -CVaR(twoAssets, weights, alpha)) > ##D y.CVaRplus = c(y.CVaRplus, -CVaRplus(twoAssets, weights, alpha)) > ##D } > ##D plot(x = range(x.Return), y = range(c(y.VaR, y.CVaR, y.CVaRplus)), > ##D xlab = as.character(i), ylab = as.character(j), type = "n") > ##D lines(x.Return, as.vector(y.VaR), col ="red") > ##D lines(x.Return, as.vector(y.CVaR), col = "green") > ##D lines(x.Return, as.vector(y.CVaRplus), col = "blue") > ##D } > ##D > ##D par(mfrow = c(1,1)) > ##D > ##D w = (0:200)/200 > ##D alpha = 0.04 > ##D for (i in 2:17) { > ##D for (j in (i+1):18) { > ##D > ##D > ##D twoAssets = cbind(berndtInvest[, i], berndtInvest[, j]) > ##D > ##D means = apply(twoAssets, 2, mean) > ##D x = NULL > ##D y = NULL > ##D for (k in 1:201) { > ##D weights = c(w[k], 1-w[k]) > ##D x = c(x, weights > ##D y = c(y, -CVaRplus(twoAssets, weights, alpha)) > ##D } > ##D s = round(100*abs( y[201] - y[1] ) / ( max(y) - min(y))) > ##D print(c(i, j, s)) > ##D plot(x, y, main = paste(as.character(i), as.character(j))) > ##D } > ##D } > ##D > ##D > ##D i = 5; j = 13 > ##D twoAssets = cbind(berndtInvest[, i], berndtInvest[, j]) > ##D means = apply(twoAssets, 2, mean) > ##D x = y = NULL > ##D for (k in 1:201) { > ##D weights = c(w[k], 1-w[k]) > ##D x = c(x, weights > ##D y = c(y, -VaR(twoAssets, weights, alpha)) } > ##D s = round(100*abs( y[201] - y[1] ) / ( max(y) - min(y))) > ##D plot(x, y, main = paste(as.character(i), as.character(j))) > ##D > ## End(Not run) > > > > > cleanEx(); ..nameEx <- "X1-PortfolioData" > > ### * X1-PortfolioData > > flush(stderr()); flush(stdout()) > > ### Name: PortfolioData > ### Title: fPortfolio Data Sets > ### Aliases: PortfolioData vanIndices altInvest annualInvest assetsCorr > ### berndtInvest jobstCov > ### Keywords: data > > ### ** Examples > > ## SOURCE("fBasics.A0-SPlusCompatibility") > ## SOURCE("fPortfolio.X1-PortfolioData") > > ## vanIndices - > > > > cleanEx(); ..nameEx <- "Z1-PortfolioTools" > > ### * Z1-PortfolioTools > > flush(stderr()); flush(stdout()) > > ### Name: fPortfolioTools > ### Title: fPortfolio Tools > ### Aliases: fPortfolioTools xmpPortfolio xmpfPortfolio > ### Keywords: programming > > ### ** Examples > > ## SOURCE("fBasics.A0-SPlusCompatibility") > ## SOURCE("fPortfolio.Z1-PortfolioTools") > > ## Not run: > ##D ## xmpfPortfolio - > ##D # Popup the examples menu: > ##D xmpfPortfolio() > ## End(Not run) > > > > ### *