# Examples

### Example: Two Sample t-Test

January 31, 2012 |

The recovery time (in days) is measured for 10 patients taking a new drug and for 10 different patients taking a placebo. We wish to test the hypothesis that the mean recovery time for patients taking the drug is less than for those taking placebo. The...

### Example: One Sample t-Test

January 31, 2012 |

Using the stack loss dataset, test the hypothesis that the mean of the stackloss is equal to 20 versus a two-sided alternative. Solution:Codes:Output:Interpretation: With the p-value greater than the level of significance alpha at 0.05, then we la...

### Margin Constraints with LSPM

August 1, 2010 |

When optimizing leverage space portfolios, I frequently run into the issue of one or more f$([Max Loss]/f) being less than the margin of its respective instrument. For example, assume the required margin for an instrument is$500, f$is$100, an...

### LSPM Joint Probability Tables

May 18, 2010 |

I've received several requests for methods to create joint probability tables for use in LSPM's portfolio optimization functions.  Rather than continue to email this example to individuals who ask, I post it here in hopes they find it via a Google...

### Maximum Probability of Profit

April 9, 2010 |

To continue with the LSPM examples, this post shows how to optimize a Leverage Space Portfolio for the maximum probability of profit. The data and example are again taken from The Leverage Space Trading Model by Ralph Vince. These optimizaitons take ...

### LSPM with snow

January 10, 2010 |

My last post provided examples of how to use the LSPM package. Those who experimented with the code have probably found that constrained optimizations with horizons __ 6 have long run-times (when calc.max __= horizon).This post will illustrate how the s...

### LSPM Examples

January 2, 2010 |

I have received several requests for additional LSPM documentation over the past couple days and a couple months ago I promised an introduction to LSPM. In this long-overdue post, I will show how to optimize a Leverage Space Portfolio with the LSPM pa... [Read more...]

### RSI(2) Evaluation

June 28, 2009 |

Despite my best efforts, it's been a month since the last post of this series. The first post replicated this simple RSI(2) strategy from the MarketSci Blog using R. The second post showed how to replicate the strategy that scales in/out of RSI(2). ... [Read more...]

### Packages featured with Inference for R

May 12, 2009 |

quantmod, TTR, and xts were (not so) recently featured on the Inference for R Blog. Inference for R is a Integrated Development Environment (IDE) designed specifically for R.The post gives an example of how to easily perform advanced financial stock a...

### RSI(2) with Position Sizing

May 1, 2009 |

Though it's more than two weeks later, here's the second post in the series that will demonstrate how to build, test, and implement a trading strategy with R. You can find the first post here.The first post replicated this simple RSI(2) strategy from ...