Dear Ilya & Alexios,

given that the Alexios played the ball into my court, please find below a toy example to your problem:

(the parma package is loaded for the data set)

library(parma)

library(cccp)

data("etfdata")

R = etfdata/lag(etfdata)-1

R = na.omit(R * 100)

N <- ncol(R)

S = cov(coredata(R))

Se <- eigen(S)

Sr <- Se$vectors %*% diag(sqrt(Se$values)) %*% t(Se$vectors)

all.equal(Sr %*% Sr, S, check.attributes = FALSE)

mu <- colMeans(R)

q <- -mu

## Formulating constraints

## Non-negativity & SOC

nvec <- rep(0, N)

nno1 <- nnoc(G = -diag(N), h = nvec)

soc1 <- socc(F = Sr, g = nvec, d = nvec, f = 1.5)

## Budget constraint

A <- matrix(rep(1, N), nrow = 1, ncol = N)

b <- matrix(1, nrow = 1, ncol = 1)

## Solving problem

Popt <- cccp(q = q, A = A, b = b,

cList = list(nno1, soc1))

w <- getx(Popt)

## checking

all(w > 0)

all.equal(sum(w), 1.0)

(retmax <- -getstate(Popt)["pobj"])

(sdrisk <- drop(sqrt(crossprod(w, S) %*% w)))

Best wishes,

Bernhard

-----Ursprüngliche Nachricht-----

Von: R-SIG-Finance [mailto:

[hidden email]] Im Auftrag von alexios

Gesendet: Donnerstag, 9. Juli 2015 15:17

An: Ilya Kipnis;

[hidden email]
Betreff: Re: [R-SIG-Finance] What's the best package for SOCP in R?

Ilya, Bernhard's cccp package should be the definitive socp package in R now.

cran.r-project.org/package=cccp

-Alexios

On 08/07/2015 18:37, Ilya Kipnis wrote:

> I was reading the following paper from Adam Butler:

>

>

http://www.bpgassociates.com/docs/Adaptive-Asset-Allocation-A-Primer.p> df

>

> I saw the example on page 26, namely one with an 8% annualized volatility target.

>

> I was wondering if there's a go-to package among the R/Finance community to solve problems of the type:

>

> max w'r

> s.t.

> w'Sw = target

> 0 <= w_i <= 1 for all i

> Sum(i=1...n)w_i = 1

>

> I know that quadprog solves problems of the form of min -w'r +

> lambda*w'Sw s.t.

> 0 <= w_i <= 1 for all i

> Sum(i=1...n)w_i = 1

>

> I was wondering if there was a go-to package for SOCP so that I could solve the first type of problem without needing to call a global optimizer.

>

> Thanks a lot.

>

> -Ilya

>

> [[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.

>

>

_______________________________________________

[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.

*****************************************************************

Confidentiality Note: The information contained in this ...{{dropped:10}}

_______________________________________________

[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.