RollingStyle in PApages?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

RollingStyle in PApages?

Matt Considine
I am wondering if anyone has a working example of using page.RollingStyle in PApages that they could point me to?
Using RStudio (v 0.95.256) and R (2.14.0 (2011-10-31), x86_64-pc-mingw32) I am trying this :

>  library("PApages")

>  data(managers)
>  books.Performance(managers,manager.column=1,peer.columns=c(2,3,4,5,6),index.columns=c(7,8,9,10))

and getting this


[1] "1 HAM1"
Error in page.Distribution(R, manager.column = manager.column, peer.columns = peer.columns,  :
   could not find function "VaR.traditional"

I'm able to fix that by substituting in a call to the current "VaR" function (and fixing a couple of parameters) elsewhere.

After that, the exercise fails with page.RollingStyle, e.g.

>  library(FactorAnalytics)

>  page.RollingStyle(R.fund = managers[,1,drop=FALSE], R.style = managers[,c(7,8,9,10)], method="constrained",leverage = FALSE,width = 36)
Error in checkData(R.fund) :
   The data cannot be converted into a time series.  If you are trying to pass in names from a data object with one column, you should use the form 'data[rows, columns, drop = FALSE]'.  Rownames should have standard date formats, such as '1985-03-15'.
In addition:Warning message:
In rollapply.zoo(data = merged.assets, FUN = function(x) { :
   na.pad argument is deprecated


However, when I run the checkData line outside of the function, there does not seem to be an error - and the rownames have the correct format.

Does anyone happen to have newer/fixed versions of page.RollingStyle that they can share?  Or can I be pointed to a fix for it?

FWIW, below is the version of page.Distribution that I got to work.  I *think* my changes (noted with the initials MattC) are correct, but would welcome feedback.
Regards,
Matt

new page.Distribution code :

function (R, manager.column = 1, peer.columns = NULL, index.columns = NULL,
     manager.color = "red", peer.color = "darkgray", index.color = "orange",
     rf = 0, event.lines = NULL, event.labels = NULL, legend.loc = "topleft",
     lwd = 1, width = 36, main = NULL, ...)
{
     x = checkData(R, method = "zoo")
     colnames = colnames(x)
     ncols = ncol(x)
     length.column.one = length(x[, manager.column])
     start.row = 1
     start.index = 0
     while (is.na(x[start.row, manager.column])) {
         start.row = start.row + 1
     }
     x = x[start.row:length.column.one, ]
     nrows = nrow(x)
     colorset = c(rep(manager.color, length(manager.column)),
         rep(peer.color, length(peer.columns)))
     legend.colorset = c(rep(manager.color, length(manager.column)),
         peer.color)
     linetypes = c(rep(1, length(manager.column)), rep(1, length(peer.columns)))
     legend.linetypes = c(rep(1, length(manager.column)), 1)
     dottypes = c(rep(1, length(manager.column)), rep(1, length(peer.columns)))
     legend.dottypes = c(rep(1, length(manager.column)), NULL)
     if (ncols>  1) {
         legend.loc = legend.loc
         legendnames = c(colnames(x[, manager.column, drop = FALSE]),
             "Peer group")
     }
     else legend.loc = NULL
     hVaR = quantile(as.vector(x[, c(manager.column), drop = FALSE]),
         probs = 0.01, na.rm = TRUE)[[1]]
     pVaR = -VaR(x[, c(manager.column), drop = FALSE], #MattC
         p = 0.99, method="historical")  #MattC
     mVaR = -VaR(x[, c(manager.column), drop = FALSE], #MattC
         p = 0.99, method="modified") #MattC
     library(sn)
     fit.st = st.mle(y = na.omit(x[, c(manager.column), drop = FALSE]))
     stVaR = qst(0.01, location = fit.st$dp[[1]], scale = fit.st$dp[[2]],
         shape = fit.st$dp[[3]], df = fit.st$dp[[4]], log = FALSE)
     require("fBasics")
     fit.stable = stableFit(as.vector(na.omit(x[, c(manager.column)])),
         doplot = FALSE)
     spVaR = qstable(0.01, alpha = fit.stable@fit$estimate[[1]],
         beta = fit.stable@fit$estimate[[2]], gamma = fit.stable@fit$estimate[[3]],
         delta = fit.stable@fit$estimate[[4]], pm = 0)
     detach("package:fBasics", unload = TRUE)
     detach("package:timeSeries", unload = TRUE)
     detach("package:timeDate", unload = TRUE)
     op<- par(no.readonly = TRUE)
     layout(matrix(c(1, 2, 3, 4, 5, 6), ncol = 2, byrow = TRUE),
         height = c(1, 1, 1), width = 1)
     par(cex = 0.8)
     chart.Histogram(x[, c(manager.column), drop = FALSE],
         probability = TRUE,
         show.outliers = TRUE,
         main = "Gaussian",
         note.lines = c(hVaR, pVaR, mVaR, stVaR, spVaR),
         note.labels = c("Historical VaR", "Parametric VaR", "Modified VaR", "", ""),
         note.color = c("darkblue", "darkgray", "darkgray", "darkgray", "darkgray"),
         methods = c("add.density", "add.normal"),
         cex.axis = 0.8, cex.lab = 0.8) #MattC
     par(cex = 0.8)
     chart.QQPlot(x[, c(manager.column), drop = FALSE], main = "QQ Fit To Gaussian",
         distribution = "norm", envelope = 0.99, xlab = "Normal Quantiles")
     par(cex = 0.8)
     chart.Histogram(x[, c(manager.column), drop = FALSE],
         probability = TRUE,
         show.outliers = TRUE,
         main = "Skew-T", note.lines = c(hVaR, pVaR, mVaR, stVaR, spVaR),
         note.labels = c("", "", "", "Skew-T VaR", ""),
         note.color = c("darkgray", "darkgray", "darkgray", "darkblue", "darkgray"),
         methods = "add.sst",
         cex.axis = 0.8, cex.lab = 0.8) #MattC
     par(cex = 0.8)
     chart.QQPlot(x[, c(manager.column), drop = FALSE], main = "QQ Fit To Skew-T",
         envelope = 0.99, distribution = "st", location = fit.st$dp[[1]],
         scale = fit.st$dp[[2]], shape = fit.st$dp[[3]], df = fit.st$dp[[4]],
         #log = FALSE, #MattC??
         xlab = "Skew-T Quantiles")
     require(fBasics)
     par(cex = 0.8)
     chart.Histogram(x[, c(manager.column), drop = FALSE], probability = TRUE,
         show.outliers = TRUE,
         main = "Stable",
         note.lines = c(hVaR, pVaR, mVaR, stVaR, spVaR),
         note.labels = c("", "", "", "", "Stable VaR"),
         note.color = c("darkgray", "darkgray", "darkgray", "darkgray", "darkblue"),
         methods = "add.stable",
         cex.axis = 0.8, cex.lab = 0.8)
     par(cex = 0.8)
     chart.QQPlot(x[, c(manager.column), drop = FALSE], main = "QQ Fit To Stable",
         envelope = 0.99, distribution = "stable", alpha = fit.stable@fit$estimate[[1]],
         beta = fit.stable@fit$estimate[[2]], gamma = fit.stable@fit$estimate[[3]],
         delta = fit.stable@fit$estimate[[4]], pm = 0)
     par(op)
}



        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|

Re: RollingStyle in PApages?

Matt Considine
FWIW, this was the code that I eventually got to work
(table.RollingStyle code was helpful here) :

page.RollingStyle2 <- function (R.fund, R.style, method =
c("constrained", "unconstrained",
     "normalized"), leverage = FALSE, selection = "none", width = 12,
     main = paste(colnames(R.fund)[1], " Rolling ", width, "-Month Style
Weights",
         sep = ""), space = 0, ...)
{
     R.fund = checkData(R.fund[, 1, drop = FALSE], method = "zoo")
     R.style = checkData(R.style, method = "zoo")
     method = method[1]
     columns.fund = ncol(R.fund)
     columns.style = ncol(R.style)
     columnnames.fund = colnames(R.fund)
     columnnames.style = colnames(R.style)
     merged.assets = na.omit(merge(R.fund, R.style))

     styleR <- function(x, method, leverage, selection)
{t(style.fit(R.fund = x[, 1, drop = FALSE],
                                                 R.style = x[, -1, drop
= FALSE],
                                                 method = method,
                                                 leverage = leverage,
                                                 selection =
selection)$weights)}

     result = xts:::rollapply.xts(data = merged.assets,
                                 FUN = styleR,
                                 width = width,
                                 method = method,
                                 leverage = leverage,
                                 selection = selection,
                                 by = 1,
                                 by.column = FALSE,
                                 align = "right")

     styleRfit <- function(x, method, leverage, selection)
{t(style.fit(R.fund = x[, 1, drop = FALSE],
                                                 R.style = x[, -1, drop
= FALSE],
                                                 method = method,
                                                 leverage = leverage,
                                                 selection =
selection)$R.squared)}

     fit = xts:::rollapply.xts(data = merged.assets,
                         FUN = styleRfit,
                         width = width,
                         method = method,
                         leverage = leverage,
                         selection = selection,
                         by = 1,
                         by.column = FALSE,
                         na.pad = FALSE,
                         align = "right")

     colnames(result) = columnnames.style
     rows = nrow(result)
     ymax = max(c(1, result))
     ymin = min(c(-1, result))
     op <- par(oma = c(2, 0, 4, 0), mar = c(0, 4, 0, 4))
     layout(matrix(c(1:columns.style, columns.style + 1, columns.style +
         2), nc = 1, byrow = TRUE))
     for (i in 1:columns.style) {
         if (even(i))
             yaxis.right = TRUE
         else yaxis.right = FALSE
         chart.TimeSeries(result[, i, drop = FALSE], type = "h", lend =
"butt",
             xaxis = FALSE, main = "", ylab = colnames(result)[i],
             ylim = c(ymin, ymax), yaxis.right = yaxis.right,
             ...)
     }
     positives = result
     for (column in 1:ncol(result)) {
         for (row in 1:nrow(result)) {
             positives[row, column] = max(0, result[row, column])
         }
     }
     negatives = result
     for (column in 1:ncol(result)) {
         for (row in 1:nrow(result)) {
             negatives[row, column] = min(0, result[row, column])
         }
     }
     sumpositives = zoo(apply(positives, 1, sum), order.by =
index(positives))
     sumnegatives = zoo(apply(negatives, 1, sum), order.by =
index(negatives))
     net = apply(result, 1, sum)
     if (even(columns.style + 1))
         yaxis.right = TRUE
     else yaxis.right = FALSE
     chart.TimeSeries(cbind(sumpositives, sumnegatives), type = "h",
         lend = "butt", xaxis = FALSE, main = "", ylab = "Total",
         yaxis.right = yaxis.right, ...)
     lines(1:rows, net)
     if (even(columns.style + 2))
         yaxis.right = TRUE
     else yaxis.right = FALSE
     chart.TimeSeries(fit, type = "l", xaxis = TRUE, main = "",
         ylab = "AdjR^2", ylim = c(0, 1), yaxis.right = yaxis.right,
         ...)
     mtext(main, side = 3, outer = TRUE, font = 2, cex = 1.2,
         line = 1)
     par(op)
}

Regards,
Matt

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|

Re: RollingStyle in PApages?

Kenton Russell
In reply to this post by Matt Considine

If it makes you feel better, I get all the same errors.  I just have not had time to debug.  It appears the only difference between table.RollingStyle (which works) and page.RollingStyle (which does not work) is          method = "zoo" but as you said checkData(managers[,1]) works just fine outside of the function, so that it is not the problem.  The error stems from the rollapply, which I and other had issues with on a previous r-sig listserve.  To work around, pass in a matrix rather than xts. result = rollapply(data = as.matrix(merged.assets), FUN = function(x) {
    t(style.fit(R.fund = x[, 1, drop = FALSE], R.style = x[,
                                                           -1, drop = FALSE], method = method, leverage = leverage,
                selection = selection)$weights)
  }, width = width, by = 1, by.column = FALSE, na.pad = FALSE,
                     align = "right")
  fit = rollapply(data = as.matrix(merged.assets), FUN = function(x) {
    t(style.fit(R.fund = x[, 1, drop = FALSE], R.style = x[,
                                                           -1, drop = FALSE], method = method, leverage = leverage,
                selection = selection)$R.squared)
  }, width = width, by = 1, by.column = FALSE, na.pad = FALSE,
                  align = "right") Kent
 > Date: Mon, 5 Mar 2012 11:07:26 -0500

> From: [hidden email]
> To: [hidden email]
> Subject: [R-SIG-Finance] RollingStyle in PApages?
>
> I am wondering if anyone has a working example of using page.RollingStyle in PApages that they could point me to?
> Using RStudio (v 0.95.256) and R (2.14.0 (2011-10-31), x86_64-pc-mingw32) I am trying this :
>
> >  library("PApages")
>
> >  data(managers)
> >  books.Performance(managers,manager.column=1,peer.columns=c(2,3,4,5,6),index.columns=c(7,8,9,10))
>
> and getting this
>
>
> [1] "1 HAM1"
> Error in page.Distribution(R, manager.column = manager.column, peer.columns = peer.columns,  :
>    could not find function "VaR.traditional"
>
> I'm able to fix that by substituting in a call to the current "VaR" function (and fixing a couple of parameters) elsewhere.
>
> After that, the exercise fails with page.RollingStyle, e.g.
>
> >  library(FactorAnalytics)
>
> >  page.RollingStyle(R.fund = managers[,1,drop=FALSE], R.style = managers[,c(7,8,9,10)], method="constrained",leverage = FALSE,width = 36)
> Error in checkData(R.fund) :
>    The data cannot be converted into a time series.  If you are trying to pass in names from a data object with one column, you should use the form 'data[rows, columns, drop = FALSE]'.  Rownames should have standard date formats, such as '1985-03-15'.
> In addition:Warning message:
> In rollapply.zoo(data = merged.assets, FUN = function(x) { :
>    na.pad argument is deprecated
>
>
> However, when I run the checkData line outside of the function, there does not seem to be an error - and the rownames have the correct format.
>
> Does anyone happen to have newer/fixed versions of page.RollingStyle that they can share?  Or can I be pointed to a fix for it?
>
> FWIW, below is the version of page.Distribution that I got to work.  I *think* my changes (noted with the initials MattC) are correct, but would welcome feedback.
> Regards,
> Matt
>
> new page.Distribution code :
>
> function (R, manager.column = 1, peer.columns = NULL, index.columns = NULL,
>      manager.color = "red", peer.color = "darkgray", index.color = "orange",
>      rf = 0, event.lines = NULL, event.labels = NULL, legend.loc = "topleft",
>      lwd = 1, width = 36, main = NULL, ...)
> {
>      x = checkData(R, method = "zoo")
>      colnames = colnames(x)
>      ncols = ncol(x)
>      length.column.one = length(x[, manager.column])
>      start.row = 1
>      start.index = 0
>      while (is.na(x[start.row, manager.column])) {
>          start.row = start.row + 1
>      }
>      x = x[start.row:length.column.one, ]
>      nrows = nrow(x)
>      colorset = c(rep(manager.color, length(manager.column)),
>          rep(peer.color, length(peer.columns)))
>      legend.colorset = c(rep(manager.color, length(manager.column)),
>          peer.color)
>      linetypes = c(rep(1, length(manager.column)), rep(1, length(peer.columns)))
>      legend.linetypes = c(rep(1, length(manager.column)), 1)
>      dottypes = c(rep(1, length(manager.column)), rep(1, length(peer.columns)))
>      legend.dottypes = c(rep(1, length(manager.column)), NULL)
>      if (ncols>  1) {
>          legend.loc = legend.loc
>          legendnames = c(colnames(x[, manager.column, drop = FALSE]),
>              "Peer group")
>      }
>      else legend.loc = NULL
>      hVaR = quantile(as.vector(x[, c(manager.column), drop = FALSE]),
>          probs = 0.01, na.rm = TRUE)[[1]]
>      pVaR = -VaR(x[, c(manager.column), drop = FALSE], #MattC
>          p = 0.99, method="historical")  #MattC
>      mVaR = -VaR(x[, c(manager.column), drop = FALSE], #MattC
>          p = 0.99, method="modified") #MattC
>      library(sn)
>      fit.st = st.mle(y = na.omit(x[, c(manager.column), drop = FALSE]))
>      stVaR = qst(0.01, location = fit.st$dp[[1]], scale = fit.st$dp[[2]],
>          shape = fit.st$dp[[3]], df = fit.st$dp[[4]], log = FALSE)
>      require("fBasics")
>      fit.stable = stableFit(as.vector(na.omit(x[, c(manager.column)])),
>          doplot = FALSE)
>      spVaR = qstable(0.01, alpha = fit.stable@fit$estimate[[1]],
>          beta = fit.stable@fit$estimate[[2]], gamma = fit.stable@fit$estimate[[3]],
>          delta = fit.stable@fit$estimate[[4]], pm = 0)
>      detach("package:fBasics", unload = TRUE)
>      detach("package:timeSeries", unload = TRUE)
>      detach("package:timeDate", unload = TRUE)
>      op<- par(no.readonly = TRUE)
>      layout(matrix(c(1, 2, 3, 4, 5, 6), ncol = 2, byrow = TRUE),
>          height = c(1, 1, 1), width = 1)
>      par(cex = 0.8)
>      chart.Histogram(x[, c(manager.column), drop = FALSE],
>          probability = TRUE,
>          show.outliers = TRUE,
>          main = "Gaussian",
>          note.lines = c(hVaR, pVaR, mVaR, stVaR, spVaR),
>          note.labels = c("Historical VaR", "Parametric VaR", "Modified VaR", "", ""),
>          note.color = c("darkblue", "darkgray", "darkgray", "darkgray", "darkgray"),
>          methods = c("add.density", "add.normal"),
>          cex.axis = 0.8, cex.lab = 0.8) #MattC
>      par(cex = 0.8)
>      chart.QQPlot(x[, c(manager.column), drop = FALSE], main = "QQ Fit To Gaussian",
>          distribution = "norm", envelope = 0.99, xlab = "Normal Quantiles")
>      par(cex = 0.8)
>      chart.Histogram(x[, c(manager.column), drop = FALSE],
>          probability = TRUE,
>          show.outliers = TRUE,
>          main = "Skew-T", note.lines = c(hVaR, pVaR, mVaR, stVaR, spVaR),
>          note.labels = c("", "", "", "Skew-T VaR", ""),
>          note.color = c("darkgray", "darkgray", "darkgray", "darkblue", "darkgray"),
>          methods = "add.sst",
>          cex.axis = 0.8, cex.lab = 0.8) #MattC
>      par(cex = 0.8)
>      chart.QQPlot(x[, c(manager.column), drop = FALSE], main = "QQ Fit To Skew-T",
>          envelope = 0.99, distribution = "st", location = fit.st$dp[[1]],
>          scale = fit.st$dp[[2]], shape = fit.st$dp[[3]], df = fit.st$dp[[4]],
>          #log = FALSE, #MattC??
>          xlab = "Skew-T Quantiles")
>      require(fBasics)
>      par(cex = 0.8)
>      chart.Histogram(x[, c(manager.column), drop = FALSE], probability = TRUE,
>          show.outliers = TRUE,
>          main = "Stable",
>          note.lines = c(hVaR, pVaR, mVaR, stVaR, spVaR),
>          note.labels = c("", "", "", "", "Stable VaR"),
>          note.color = c("darkgray", "darkgray", "darkgray", "darkgray", "darkblue"),
>          methods = "add.stable",
>          cex.axis = 0.8, cex.lab = 0.8)
>      par(cex = 0.8)
>      chart.QQPlot(x[, c(manager.column), drop = FALSE], main = "QQ Fit To Stable",
>          envelope = 0.99, distribution = "stable", alpha = fit.stable@fit$estimate[[1]],
>          beta = fit.stable@fit$estimate[[2]], gamma = fit.stable@fit$estimate[[3]],
>          delta = fit.stable@fit$estimate[[4]], pm = 0)
>      par(op)
> }
>
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
     
        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|

Re: RollingStyle in PApages?

Peter Carl-2
In reply to this post by Matt Considine
Matt,

Thanks for this.  The package description notes that this code is
"considered EXPERIMENTAL CODE and WILL NOT BE SUPPORTED."  The shouting
parts of that statement should probably be interpreted as "much of it is
broken and is not being worked on or maintained currently."

Specifically, the style analysis parts are deprecated and will eventually
be replaced by functionality in FactorAnalytics.  The current style code
is proof of concept and should be taken with a large grain of salt.

Still, I appreciate your interest.  Feel free to contact me offline and
I'd be happy to discuss how to move forward.

pcc
--
Peter Carl
http://www.braverock.com/~peter

> FWIW, this was the code that I eventually got to work
> (table.RollingStyle code was helpful here) :
>
> page.RollingStyle2 <- function (R.fund, R.style, method =
> c("constrained", "unconstrained",
>      "normalized"), leverage = FALSE, selection = "none", width = 12,
>      main = paste(colnames(R.fund)[1], " Rolling ", width, "-Month Style
> Weights",
>          sep = ""), space = 0, ...)
> {
>      R.fund = checkData(R.fund[, 1, drop = FALSE], method = "zoo")
>      R.style = checkData(R.style, method = "zoo")
>      method = method[1]
>      columns.fund = ncol(R.fund)
>      columns.style = ncol(R.style)
>      columnnames.fund = colnames(R.fund)
>      columnnames.style = colnames(R.style)
>      merged.assets = na.omit(merge(R.fund, R.style))
>
>      styleR <- function(x, method, leverage, selection)
> {t(style.fit(R.fund = x[, 1, drop = FALSE],
>                                                  R.style = x[, -1, drop
> = FALSE],
>                                                  method = method,
>                                                  leverage = leverage,
>                                                  selection =
> selection)$weights)}
>
>      result = xts:::rollapply.xts(data = merged.assets,
>                                  FUN = styleR,
>                                  width = width,
>                                  method = method,
>                                  leverage = leverage,
>                                  selection = selection,
>                                  by = 1,
>                                  by.column = FALSE,
>                                  align = "right")
>
>      styleRfit <- function(x, method, leverage, selection)
> {t(style.fit(R.fund = x[, 1, drop = FALSE],
>                                                  R.style = x[, -1, drop
> = FALSE],
>                                                  method = method,
>                                                  leverage = leverage,
>                                                  selection =
> selection)$R.squared)}
>
>      fit = xts:::rollapply.xts(data = merged.assets,
>                          FUN = styleRfit,
>                          width = width,
>                          method = method,
>                          leverage = leverage,
>                          selection = selection,
>                          by = 1,
>                          by.column = FALSE,
>                          na.pad = FALSE,
>                          align = "right")
>
>      colnames(result) = columnnames.style
>      rows = nrow(result)
>      ymax = max(c(1, result))
>      ymin = min(c(-1, result))
>      op <- par(oma = c(2, 0, 4, 0), mar = c(0, 4, 0, 4))
>      layout(matrix(c(1:columns.style, columns.style + 1, columns.style +
>          2), nc = 1, byrow = TRUE))
>      for (i in 1:columns.style) {
>          if (even(i))
>              yaxis.right = TRUE
>          else yaxis.right = FALSE
>          chart.TimeSeries(result[, i, drop = FALSE], type = "h", lend =
> "butt",
>              xaxis = FALSE, main = "", ylab = colnames(result)[i],
>              ylim = c(ymin, ymax), yaxis.right = yaxis.right,
>              ...)
>      }
>      positives = result
>      for (column in 1:ncol(result)) {
>          for (row in 1:nrow(result)) {
>              positives[row, column] = max(0, result[row, column])
>          }
>      }
>      negatives = result
>      for (column in 1:ncol(result)) {
>          for (row in 1:nrow(result)) {
>              negatives[row, column] = min(0, result[row, column])
>          }
>      }
>      sumpositives = zoo(apply(positives, 1, sum), order.by =
> index(positives))
>      sumnegatives = zoo(apply(negatives, 1, sum), order.by =
> index(negatives))
>      net = apply(result, 1, sum)
>      if (even(columns.style + 1))
>          yaxis.right = TRUE
>      else yaxis.right = FALSE
>      chart.TimeSeries(cbind(sumpositives, sumnegatives), type = "h",
>          lend = "butt", xaxis = FALSE, main = "", ylab = "Total",
>          yaxis.right = yaxis.right, ...)
>      lines(1:rows, net)
>      if (even(columns.style + 2))
>          yaxis.right = TRUE
>      else yaxis.right = FALSE
>      chart.TimeSeries(fit, type = "l", xaxis = TRUE, main = "",
>          ylab = "AdjR^2", ylim = c(0, 1), yaxis.right = yaxis.right,
>          ...)
>      mtext(main, side = 3, outer = TRUE, font = 2, cex = 1.2,
>          line = 1)
>      par(op)
> }
>
> Regards,
> Matt
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions
> should go.
>

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.