1

I am a student and new in R. I found many post about it, but didn't understand what to do with my data. I try to make a Box-Constrained Portfolio Frontier but get this error (it's incredible, but earlier I used to do this task on other assets, there was no such error)

Code and error

> tail(ALIGNED)
GMT
            ASBN FBPRP FBTT FCPB FCRGF  FLWS FPAFF FQVLF  MSFT PGQWF  OPMZ  VALE  PIH   USEL TURN
2018-02-16 20.55    22 32.9 7.95 16.62 11.00  0.70 16.50 92.00  0.08 2e-04 14.12 7.10 0.1901 1.78
2018-02-19 20.55    22 32.9 7.95 16.62 11.00  0.70 16.50 92.00  0.08 2e-04 14.12 7.10 0.1901 1.78
2018-02-20 20.14    22 32.9 7.95 16.62 11.35  0.67 16.31 92.72  0.08 1e-04 13.98 6.95 0.3020 1.87
2018-02-21 20.14    22 32.9 8.50 16.62 11.50  0.67 16.45 91.49  0.08 1e-04 13.66 6.90 0.3020 1.88
2018-02-22 20.14    22 32.9 8.50 16.62 11.95  0.67 16.36 91.73  0.08 1e-04 13.98 6.70 0.3020 1.90
2018-02-23 20.11    22 32.9 9.00 16.62 12.50  0.64 16.66 94.06  0.08 1e-04 14.20 6.65 0.3020 1.92
> class(ALIGNED)
[1] "timeSeries"
attr(,"package")
[1] "timeSeries"
boxSpec <- portfolioSpec()
setNFrontierPoints(boxSpec) <- 15
boxConstraints <- c("minW[1:15]=0.3", "maxW[1:15]=0.12")

boxFrontier <- portfolioFrontier(data = ALIGNED, spec = boxSpec, constraints = boxConstraints)
#Error in `colnames<-`(`*tmp*`, value = names(getMu(Data))) : 
#  attempt to set 'colnames' on an object with less than two dimensions

manual
error log

Community
  • 1
  • 1
xcoder
  • 36
  • 4
  • What's your question? I am unsure you're asking us to help you with, as it's not clear what your data is. It would also help if you edit your post to contain the exact code relevant to your question, instead of a screenshot of your study notes – MBorg Mar 11 '18 at 06:54
  • 1
    Please read https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example as it will help you to ask question in a better way. – MKR Mar 11 '18 at 07:35
  • anybody can help?. thx – xcoder Mar 11 '18 at 12:17

1 Answers1

0

Selfcleared, the problem was in the frontierpoints, just enter some random quantity of setNFrontierPoints, and you will clearyfy this

xcoder
  • 36
  • 4
  • I'm trying to set a max weight (.5) for all symbols using the example data. I;'m getting the getMU error, even if i supply a spec with NFrontierPoints set to 50. (My hope is to find 50 portfolios, all of which obey the maxW constraint.) Is that possible? – Gerry May 13 '19 at 00:01