tests/testthat/test_PortfolioOptimProjection_2.R

rr <- matrix(c(-0.21481708,0.18571984,-0.1523601,0.13916639,-0.18270073,0.13240731,0.13736715,0.04114946,0.15929706,0.09056012,
					-0.19366846,0.23596871,-0.06373515,0.0888071,-0.17804216,0.13484693,0.12872991,0.11483243,0.1449673,-0.02435218,
					-0.16526522,0.37355874,0.05065155,0.07574426,-0.19046866,0.04408062,0.11363588,0.01410258,0.09919878,0.25314035,
					-0.15180283,0.16092582,-0.16920904,0.14634784,-0.29608858,0.1928281,0.20616873,-0.0452911,0.23095132,0.05036431,
					-0.241186841,0.434656598,-0.011505425,0.105050583,-0.338251064,0.161053614,0.093324546,-0.004589778,0.20171661,0.115914413), 10,5)
pk = rep(0.1, 10)
dat = cbind(rr, pk)
Aconstr <- matrix(c(1,-1,1,-1,1,-1,1,-1,1,-1),2,5)
bconstr<- c(1,-1)
LB <- rep(-1,5)
UB <- rep(1,5)
bvec <- c(0.14648652, 0.18339899, 0.38757874, 0.08859466, 0.19394109)


test_that("Output type",{
  expect_is(sss<-PortfolioOptimProjection(dat, 0.06, "MAD",  0.95 , bvec, Aconstr, bconstr, LB, UB, maxiter = 200, tol = 1e-4)
, "list" )
})

Try the PortfolioOptim package in your browser

Any scripts or data that you put into this service are public.

PortfolioOptim documentation built on May 2, 2019, 10:21 a.m.