systematicinvestor / SIT

Systematic Investor Toolkit
483 stars 382 forks source link

aa.test() #19

Open f1nasf1 opened 8 years ago

f1nasf1 commented 8 years ago

Hi, There seems to be issues with aa.test():

Error in create.historical.ia(hist.returns, 12, symbols, symbol.names) : unused arguments (symbols, symbol.names) 3 create.historical.ia(hist.returns, 12, symbols, symbol.names) at con#2690 2 aa.test.create.ia() at con#1696 1 aa.test()

After overwriting so that the symbols and symbol.names are not passed to the create.histroical.aa:

Error in t(ia$hist.returns) - repmat(colMeans(ia$hist.returns), 1, nt) : non-conformable arrays 6 match.fun(add.constraint.fn)(ia, 0, ">=", constraints) at con#708 5 optimize.portfolio(ia, constraints, add.constraint.fn, min.risk.fn) at con#693 4 min.portfolio(ia, constraints, add.constraint.mad, portfolio.mad) at con#849 3 match.fun(min.risk.fn)(ia, constraints) at con#1502 2 portopt(ia, constraints, 50, "MAD", min.mad.portfolio) at con#1719 1 aa.test()

Thanks.

AlbertoBurchi commented 7 years ago

Dear avanchev I experienced the same problem in the string: a[1 : n, ] = t(ia$hist.returns) - repmat(colMeans(ia$hist.returns), 1, nt)

So, it is impossible to obtain the MAD ptf.

The problem is related to the matrix dimension.

Have you any idea about how to solve?

Thanks, Alberto

dxcv commented 7 years ago

me too

jupiters1117 commented 7 years ago

Here's my solution: a[1 : n0, ] = t(ia$hist.returns) - repmat(matrix(colMeans(ia$hist.returns)), 1, nt)