[R-SIG-Finance] problem with frontierPlot

Santosh Srinivas santosh.srinivas at gmail.com
Sat Oct 16 05:41:54 CEST 2010


I tried this and seems to work

Lines <- "1970-01-31  0.0119702858  0.0074246655
 1970-02-28  0.0077859145 -0.0022183674
 1970-03-31 -0.0097686600  0.0028156804
 1970-04-30 -0.0010947363  0.0069857716
 1970-05-31  0.0001146949 -0.0001990794
 1970-06-30 -0.0014999062  0.0043774220
 1970-07-31 -0.0116682300 -0.0072369087
 1970-08-31  0.0088064660  0.0046168054
 1970-09-30  0.0019717544 -0.0030457644
 1970-10-31  0.0173595036 -0.0031445935
 "

 library(zoo)
 z <- read.zoo(textConnection(Lines), format="%Y-%m-%d")
 library("fPortfolio")
 y <- timeSeries(z)
 Frontier = portfolioFrontier(y)
 frontierPlot(Frontier, pch = 19, xlim = c(0, 0.05), ylim = c(0, 0.005))
 grid()
 abline(h = 0, col = "grey")
 abline(v = 0, col = "grey")



-----Original Message-----
From: r-sig-finance-bounces at stat.math.ethz.ch
[mailto:r-sig-finance-bounces at stat.math.ethz.ch] On Behalf Of Alvaro Riascos
Sent: 16 October 2010 05:35
To: r-sig-finance at stat.math.ethz.ch
Subject: [R-SIG-Finance] problem with frontierPlot

Dear R users:

I am new to R. I find weird that frontierPlot is unable to plot the
following dataExample time series object (see below).

Frontier=portfolioFrontier(dataExample)

works nicely but:

frontierPlot(Frontier)

doesn't work. Thanks for your help!

#####
> dataExample
GMT
                Series 7      Series 8
1970-01-31  0.0119702858  0.0074246655
1970-02-28  0.0077859145 -0.0022183674
1970-03-31 -0.0097686600  0.0028156804
1970-04-30 -0.0010947363  0.0069857716
1970-05-31  0.0001146949 -0.0001990794
1970-06-30 -0.0014999062  0.0043774220
1970-07-31 -0.0116682300 -0.0072369087
1970-08-31  0.0088064660  0.0046168054
1970-09-30  0.0019717544 -0.0030457644
1970-10-31  0.0173595036 -0.0031445935
             Series 9
1970-01-31  -9.648918
1970-02-28  12.257963
1970-03-31 -18.029950
1970-04-30 -21.304943
1970-05-31  -1.023360
1970-06-30  -4.760405
1970-07-31 -75.510609
1970-08-31 -43.097188
1970-09-30 -15.257833
1970-10-31 -40.216935

> Frontier = portfolioFrontier(dataExample)

> frontierPlot(Frontier)

Error en dimnames(x) <- dn :
  la longitud de 'dimnames' [1] no es igual a la extensisn del arreglo #####

	[[alternative HTML version deleted]]



More information about the R-SIG-Finance mailing list