[R-SIG-Finance] LSPM - Unexpected Results

Joshua Ulrich josh.m.ulrich at gmail.com
Tue Dec 28 04:17:07 CET 2010


On Mon, Dec 27, 2010 at 7:52 PM, Noah Silverman <noah at smartmediacorp.com> wrote:
> Josh,
>
> On your blog, you wrote that.
>
> "The methodology therein suggests finding optimal f values first, then
> calculating the portfolio that satisfies the margin constraints but keeps
> the ratio of each market system to one another the same."
>
> Since I want to invest 100% of my portfolio with no margin allowed, couldn't
> I just take:
> f / sum(f) for each asset.
>
> Then use those as the percentage of my port to invest?
>
That was the point of the post.  If it were as easy as f/sum(f), the
blog post would be a very convoluted way to accomplish the same thing.

> The concept of "contracts" or "units" doesn't seem applicable since I'm just
> interested in percentage of fund to invest in each asset.
>
> Do I have this correct?
>
The f values are not the same as portfolio allocation percentages and
contracts / units are applicable since that's a part of how f is
defined.  If you're interested in allocation percentages, you'll need
to calculate them from each fund's f, max loss, current price, and
your current account equity.

--
Joshua Ulrich  |  FOSS Trading: www.fosstrading.com


> -N
>
> On 12/27/10 12:07 PM, Joshua Ulrich wrote:
>
> On Mon, Dec 27, 2010 at 1:10 PM, Noah Silverman <noah at smartmediacorp.com>
> wrote:
>
> Josh,
>
> 1)
> R version: 2.11.0
> LSPM Version:  (Don't know where to check)
>
> packageDescription("LSPM")  # revision 49 is most recent
>
> 2)
> I'm fine with it taking many hours - that's to be expected.  There are
> 48 observations for each of the 13 assets.
>
> 3)
> The last output line from the optimizer is:
> 0 0.5908 0.545 0.0954 0.41 0 0.0969 0.0078 0.6066 0.4896 0.0113 0.7568 1
> -0.5036 -1 best value:  -1
>
> The last two values are negative, which I am now assuming are the "z"
> values.  But do not know what "z" values are - don't see any mention of
> them in the Handbook of Portfolio Mathematics.
>
> They're discussed in The Leverage Space Trading Model.  They control
> the aggressiveness of your position sizing when your equity is above /
> below target.
>
> 4)
> Is there documentation about how to specify the margin and other
> constraints?  The help files in R left me a bit lost.
>
> Sorry about the lack of documentation... here's how to specify margin
> constraints:
> http://blog.fosstrading.com/2010/08/margin-constraints-with-lspm.html
>
> Other constraints can be specified and passed via the
> constrFun/constrVal arguments, just like you specified the drawdown
> constraint.
>
> I'm trying this while looking at a portfolio that is a "fund of funds".
> So, they want to invest 100% of their fund and can't short anything.
> Furthermore, they can only re-balance every 90 days, which only adds
> further constraint.
>
>
> I'm using the jpt example function from your blog with n=4 and the
> following call in R:
> DEctrl <- list(NP=100, itermax=1000, trace=1 )
> res <- maxProbProfit(jpt, 1e-6, 6, probDrawdown, 0.1, DD=0.2,
> calc.max=4, snow=cl, control=DEctrl)
>
> Why are you setting itermax=1000?
>
> Thanks!!!!
>
> --
> Noah
>
>
> --
> Joshua Ulrich  |  FOSS Trading: www.fosstrading.com
>
>
>
> On 12/27/10 10:23 AM, Joshua Ulrich wrote:
>
> Noah,
>
> On Mon, Dec 27, 2010 at 12:02 PM, Noah Silverman
> <noah at smartmediacorp.com> wrote:
>
> Hi,
>
> I've been playing with the LSPM library from optimizing a portfolio of
> 13 assets (Using the interesting Leverage Space model developed by Ralph
> Vince.)
>
> Which version (and revision) of LSPM are you using?  Which version of R?
>
> Using the function:  maxProbProfit
>
> res <- maxProbProfit(jpt, 1e-6, 6, probDrawdown, 0.1, DD=0.2,
> calc.max=4, snow=cl, control=DEctrl)
>
> It takes a LONG time for the optmizer to find a solution.
>
> It's always going to take a long time, especially with 13 assets and
> 100 optimizer iterations (the default).  How many observations are in
> your lsp object?  A reproducible example, or just some sample data,
> would really help here.
>
> It has found a solution that has a 100% probability of profit given the
> constraints.
>
> The odd thing is that several of the values (optimal F) are negative.
> My understanding is that indicates shorting the asset.  This assets in
> this portfolio can't be shorted.
>
> I doubt any f values are negative because they're bound between [0,1]
> during the optimization.  My guess is that you're referring to the two
> "z" values, which will always be negative.
>
> Here's a quick example from ?maxProbProfit:
>
> require(LSPM)
> data(port)
> ipop <- cbind(runif(50,0,0.01),runif(50,0,0.01),runif(50,0,0.01),
>   runif(50,-1,-0.8),runif(50,-1,-0.8))
> DEctrl <- list(itermax=11, NP=50, initial=ipop)
> res <- maxProbProfit(port, 1e-6, 4, probDrawdown, 0.1,
>   DD=0.2, calc.max=4, control=DEctrl)
>
> res
>
> $f
> [1] 0.002308994 0.001884296 0.116972712
>
> $z
>     zminus      zplus
> -0.9256852 -0.9976883
>
> $profitProb
> [1] 0.9963587
>
>
> I've never read about shorting with the LSPM model, is this common?
> Is there a way to indicate, as a constraint, not to short?
> I have a portfolio of X dollars to allocate, so the percentages must sum
> to one, how do I do this once I get the F values?
>
> You need to do this during the optimization via the "margin" and
> "equity" arguments.
>
> HTH,
> --
> Joshua Ulrich  |  FOSS Trading: www.fosstrading.com
>
>
>
> Thanks in advance for any and all suggestions!
>
> --
> Noah
>
> _______________________________________________
> R-SIG-Finance at r-project.org 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.
>
> _______________________________________________
> R-SIG-Finance at r-project.org 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.
>
>



More information about the R-SIG-Finance mailing list