Question for quants, math geeks  reducing volatility in my costs?
Question for quants, math geeks  reducing volatility in my costs?
Hi,
Theoretical question here for any quants, math geeks or analytical wiz out there...
I buy a product in large quantities monthly (whose price in very volatile but I have been tracking it for years). It is a very large percent of my total costs.
Quantitatively, how can I find a basket of tradable securities (or commodities) that behave similar or identical to my product costs? If I have that, I can potentially trade options or futures to minimize my risks or have less volatility. Correlations and Regression?
Any pointers to techniques, research papers? Or even what terminology is used so I can Google this? I am guessing hedge funds, investment banks, etc must be doing stuff like this and more. I tried searching for hedging, risk management, etc but couldn't find what I was looking for.
Thanks!
Theoretical question here for any quants, math geeks or analytical wiz out there...
I buy a product in large quantities monthly (whose price in very volatile but I have been tracking it for years). It is a very large percent of my total costs.
Quantitatively, how can I find a basket of tradable securities (or commodities) that behave similar or identical to my product costs? If I have that, I can potentially trade options or futures to minimize my risks or have less volatility. Correlations and Regression?
Any pointers to techniques, research papers? Or even what terminology is used so I can Google this? I am guessing hedge funds, investment banks, etc must be doing stuff like this and more. I tried searching for hedging, risk management, etc but couldn't find what I was looking for.
Thanks!

 Posts: 712
 Joined: Sat Feb 28, 2015 4:35 pm
Re: Question for quants, math geeks  reducing volatility in my costs?
What is the product? Gasoline?
Or, you can ... decline to let me, a stranger on the Internet, egg you on to an exercise in timewasting, and you could say "I'm probably OK and I don't care about it that much." Nisiprius
Re: Question for quants, math geeks  reducing volatility in my costs?
No, not gasoline. Gasoline has futures and other instruments that are traded. This one does not. For my business.EHEngineer wrote:What is the product? Gasoline?
I am interested in the mathematical approach. It isn't as much about the specific product. I can find a bunch of securities and commodities that are correlated to it, but how do I go beyond that mathematically to find the mix?

 Posts: 712
 Joined: Sat Feb 28, 2015 4:35 pm
Re: Question for quants, math geeks  reducing volatility in my costs?
The garden variety math tool for modeling is multiple linear regression. many software packages will do it. Matlab is super easy. Octave is a free option. Excel used to have a "data analysis toolkit" you could work with, but its no longer included in the version I have (was in Tools > Addins > Data Analysis Toolkit) If you need to learn MLR, check out http://www.coursera.org for free video classes.jane1 wrote:No, not gasoline. Gasoline has futures and other instruments that are traded. This one does not. For my business.EHEngineer wrote:What is the product? Gasoline?
I am interested in the mathematical approach. It isn't as much about the specific product. I can find a bunch of securities and commodities that are correlated to it, but how do I go beyond that mathematically to find the mix?
Or, you can ... decline to let me, a stranger on the Internet, egg you on to an exercise in timewasting, and you could say "I'm probably OK and I don't care about it that much." Nisiprius
Re: Question for quants, math geeks  reducing volatility in my costs?
You can get as fancy as you want on this one. In pretty much every case, linear regression is going to be your basic tool.
Put the returns you are trying to hedge on the left hand side of the regression and the asset(s) you want to use as hedges on the right. The position you will take in each hedging asset is the negative of the coefficient on that asset times the dollar exposure you have to the thing you are trying to hedge against. You can use R^2 as an insample measure of how much of the risk you are getting rid of.
You will want to spend some time backtesting this, though. Regression betas of this type change over time. If you find that a beta estimated on data from two years ago doesn't hedge the risk over the past year very well, then the relationship may not be stable enough to make a good hedge. Good luck.
Put the returns you are trying to hedge on the left hand side of the regression and the asset(s) you want to use as hedges on the right. The position you will take in each hedging asset is the negative of the coefficient on that asset times the dollar exposure you have to the thing you are trying to hedge against. You can use R^2 as an insample measure of how much of the risk you are getting rid of.
You will want to spend some time backtesting this, though. Regression betas of this type change over time. If you find that a beta estimated on data from two years ago doesn't hedge the risk over the past year very well, then the relationship may not be stable enough to make a good hedge. Good luck.
Re: Question for quants, math geeks  reducing volatility in my costs?
Thanks! I was thinking Multiple Linear Regression too. Will give it a try as soon as I identify a bunch of securities/commodities that might have decent correlation with my cost data. I can use R or Excel.EHEngineer wrote:The garden variety math tool for modeling is multiple linear regression. many software packages will do it. Matlab is super easy. Octave is a free option. Excel used to have a "data analysis toolkit" you could work with, but its no longer included in the version I have (was in Tools > Addins > Data Analysis Toolkit) If you need to learn MLR, check out http://www.coursera.org for free video classes.jane1 wrote:No, not gasoline. Gasoline has futures and other instruments that are traded. This one does not. For my business.EHEngineer wrote:What is the product? Gasoline?
I am interested in the mathematical approach. It isn't as much about the specific product. I can find a bunch of securities and commodities that are correlated to it, but how do I go beyond that mathematically to find the mix?
Are Random Forest, ARIMAX type techniques used for such things that you are aware of?

 Posts: 712
 Joined: Sat Feb 28, 2015 4:35 pm
Re: Question for quants, math geeks  reducing volatility in my costs?
Gosh, you are over my head already. A few months back I was hoping to learn R, and this book was recommended to me. Maybe it can help you.jane1 wrote:Are Random Forest, ARIMAX type techniques used for such things that you are aware of?
Download the PDF here (free): http://wwwbcf.usc.edu/~gareth/ISL/index.html
physical version at amazon: https://www.amazon.com/IntroductionSta ... 1461471370
Or, you can ... decline to let me, a stranger on the Internet, egg you on to an exercise in timewasting, and you could say "I'm probably OK and I don't care about it that much." Nisiprius
Re: Question for quants, math geeks  reducing volatility in my costs?
Thanks! Very helpful. Will give it a try. You mentioned Linear Regression as the basic tool. What advanced techniques may be better? I am happy to learn if you can point to some decent references. For instance if I find thatfarnsy wrote:You can get as fancy as you want on this one. In pretty much every case, linear regression is going to be your basic tool.
Put the returns you are trying to hedge on the left hand side of the regression and the asset(s) you want to use as hedges on the right. The position you will take in each hedging asset is the negative of the coefficient on that asset times the dollar exposure you have to the thing you are trying to hedge against. You can use R^2 as an insample measure of how much of the risk you are getting rid of.
You will want to spend some time backtesting this, though. Regression betas of this type change over time. If you find that a beta estimated on data from two years ago doesn't hedge the risk over the past year very well, then the relationship may not be stable enough to make a good hedge. Good luck.
Price of Product P = 0.3* SPY + 0.4*Oil Index + 0.1*AMZN  1.1*Industrials Index
gives me satisfactory results for extended time and backtesting. Should I short/long on these or use options/futures? Again all theoretically. I won't rush into anything without understanding!
How are some of the derivatives types instruments created that might have an inverse relationship without as much cash investment to take opposite positions?
Re: Question for quants, math geeks  reducing volatility in my costs?
I have the book  PDF and hard copy! Would strongly recommend their videos too.EHEngineer wrote:Gosh, you are over my head already. A few months back I was hoping to learn R, and this book was recommended to me. Maybe it can help you.jane1 wrote:Are Random Forest, ARIMAX type techniques used for such things that you are aware of?
Download the PDF here (free): http://wwwbcf.usc.edu/~gareth/ISL/index.html
physical version at amazon: https://www.amazon.com/IntroductionSta ... 1461471370
https://www.rbloggers.com/indepthint ... rtvideos/
I am kind of theoretically familiar with various techniques. Hoping to figure out which tool in my kit is typically used for such situations and gives best results. Any references for techniques used by quants for these kinds of problems. You gave a good idea, I will try some amazon searches (so far been doing google searches).

 Posts: 1076
 Joined: Tue Feb 23, 2016 4:24 am
Re: Question for quants, math geeks  reducing volatility in my costs?
You can use any of the model types you like. The biggest question though is the robustness of your model to predict out of sample results. All models have assumptions about the nature of the data which are approximations of reality. But the underlying problem is minus theory you are likely to find multiple sperious relationships due to testing thousands of things. (Multiple testing) You would to make sure what ever you found in a sample works in a different one. (Split samples)
You might want to be more explicit on what you are trying to model and try posting on stack exchange or another place where statisticians hang out.
Good luck
You might want to be more explicit on what you are trying to model and try posting on stack exchange or another place where statisticians hang out.
Good luck
G.E. Box "All models are wrong, but some are useful."
Re: Question for quants, math geeks  reducing volatility in my costs?
I've been paid more than I deserved to build models like this for different situations (like workforce models that predict the needed size and distribution of employees for given projects). In my experience, more often than not, you end up overfitting the data to get to a comfortable r^2 that you can defend with a narrative that is acceptable but not really true and then act all surprised when the forecasted relationships don't hold. With a workforce model it probably doesn't matter much  it becomes a selffulfilling prophecy since you assign the resource the model spits out and they find a way to get the job done  for you it could set you up for a nasty surprise at just the wrong time.
I have no doubt you could find a basket that backtests well and even works out of sample somewhere  I would be wary of taking on too much financial risk using that basket. You might have better luck talking to reinsurers and see what it would cost to create price protection that way.
I have no doubt you could find a basket that backtests well and even works out of sample somewhere  I would be wary of taking on too much financial risk using that basket. You might have better luck talking to reinsurers and see what it would cost to create price protection that way.
Re: Question for quants, math geeks  reducing volatility in my costs?
Totally agree with post giving caution to this.
That said, to do what you're proposing, here's how you could pursue.
First consider the data you have on your 'product.' Do you have prices for every day? Can you get data going back even further in time? The more, the better. Put dates in one column and prices in corresponding column in something like excel.
Then gather a bunch of other variables that you think are candidates for having the desired relationship to the product. Get data on price and dates corresponding to the data you have on the initial product. Create columns for these, too.
Now you have a data set to work with, and even in excel can do a lot of damage. You can simply run correlation coefficients and see what's related and to what extent. You can then model multiples variables together to see how much each additional fund or what have you adds to the variance explained by a given model. E.g., say I have 30 variables that I'm considering as being related to the one question. I could add one at a time to a multiple regression model and see what additional variance is accounted for by each additional variable. Find what is best and the point of diminished returns. This could help minimize the number of funds or what have you that you'd need to hold to get the desired result.
Keep in mind, you could do this, get an incredible amount of variance explained, and it still can go to heck because the model is built on past data. I get why you're wondering about this though.
That said, to do what you're proposing, here's how you could pursue.
First consider the data you have on your 'product.' Do you have prices for every day? Can you get data going back even further in time? The more, the better. Put dates in one column and prices in corresponding column in something like excel.
Then gather a bunch of other variables that you think are candidates for having the desired relationship to the product. Get data on price and dates corresponding to the data you have on the initial product. Create columns for these, too.
Now you have a data set to work with, and even in excel can do a lot of damage. You can simply run correlation coefficients and see what's related and to what extent. You can then model multiples variables together to see how much each additional fund or what have you adds to the variance explained by a given model. E.g., say I have 30 variables that I'm considering as being related to the one question. I could add one at a time to a multiple regression model and see what additional variance is accounted for by each additional variable. Find what is best and the point of diminished returns. This could help minimize the number of funds or what have you that you'd need to hold to get the desired result.
Keep in mind, you could do this, get an incredible amount of variance explained, and it still can go to heck because the model is built on past data. I get why you're wondering about this though.
Re: Question for quants, math geeks  reducing volatility in my costs?
Be careful about costs. For any financial products you use for hedging there will be spreads and transaction costs that could be substantial, particularly if your strategy involves much trading. Also, consider that for commodities the spot prices you may find in historical data may not reflect the actual prices at which you would buy or sell in real life.
Frankly, this sounds like a fun exercise but extremely risky to do for real.
Frankly, this sounds like a fun exercise but extremely risky to do for real.
We don't know how to beat the market on a riskadjusted basis, and we don't know anyone that does know either 
Swedroe 
We assume that markets are efficient, that prices are right 
Fama

 Posts: 1402
 Joined: Tue Aug 19, 2014 10:09 pm
Re: Question for quants, math geeks  reducing volatility in my costs?
Honestly, this sounds like something where you should consult a business consultant and a specialist financial consultant to evaluate what is and is not an appropriate hedging vehicle. Since it's not a readily traded commodity, I think you're very likely to do more harm than good by only DIY'ing it. By all means educate yourself first, but this can easily be treacherous ground.

 Posts: 131
 Joined: Thu Mar 06, 2008 7:02 pm
Re: Question for quants, math geeks  reducing volatility in my costs?
"With four parameters I can fit an elephant, and with five I can make him wiggle his trunk."  John von Neumann
Re: Question for quants, math geeks  reducing volatility in my costs?
I am starting to learn R. Are there any good packages out there with financial data? Specially anything with total return indexes. Or any other packages out there that people have found useful?jane1 wrote:I have the book  PDF and hard copy! Would strongly recommend their videos too.EHEngineer wrote:Gosh, you are over my head already. A few months back I was hoping to learn R, and this book was recommended to me. Maybe it can help you.jane1 wrote:Are Random Forest, ARIMAX type techniques used for such things that you are aware of?
Download the PDF here (free): http://wwwbcf.usc.edu/~gareth/ISL/index.html
physical version at amazon: https://www.amazon.com/IntroductionSta ... 1461471370
https://www.rbloggers.com/indepthint ... rtvideos/
I am kind of theoretically familiar with various techniques. Hoping to figure out which tool in my kit is typically used for such situations and gives best results. Any references for techniques used by quants for these kinds of problems. You gave a good idea, I will try some amazon searches (so far been doing google searches).
Re: Question for quants, math geeks  reducing volatility in my costs?
I am discovering too, just installed yesterday... I have come across Quandl, Quantmod and Thinknum which seem decent for financial data downloads and some analysis.alex_686 wrote: I am starting to learn R. Are there any good packages out there with financial data? Specially anything with total return indexes. Or any other packages out there that people have found useful?
https://www.rbloggers.com/financialda ... partiii/
For Correlations I like the visualizations that corrplot offers. Don't know about total return indices.
Re: Question for quants, math geeks  reducing volatility in my costs?
You hit the nail on the head.afan wrote:Be careful about costs. For any financial products you use for hedging there will be spreads and transaction costs that could be substantial, particularly if your strategy involves much trading. Also, consider that for commodities the spot prices you may find in historical data may not reflect the actual prices at which you would buy or sell in real life.
Frankly, this sounds like a fun exercise but extremely risky to do for real.
Yes, the cost of hedging may be substantial.
If actual prices can be very different from spot prices, how can one reconcile this?
And the other issue is, whether futures and options actually do a good enough job of gauging the direction of the security/commodity. Even with hedging, one is (to some extent albeit smaller extent) betting on the direction. It would be interesting to see how, for instance, SPY options pricing was correlated to actual SPY performance over time. Although I am not sure what I mean by this
Re: Question for quants, math geeks  reducing volatility in my costs?
This thread has run its course and is locked (product costs are not relevant to personal investing). See: Investing  Theory, News & General
If it's investment related and it doesn't fall into the above category it goes here. Examples of acceptable topics include news about new fund offerings, pointers to academic papers about investing issues, questions about the proper role of a particular asset class in a portfolio, or questions about Vanguard policies.
Additionally, this forum is for use by personal investors only. Requesting assistance to further one's business interests is offtopic.jane1 wrote:No, not gasoline. Gasoline has futures and other instruments that are traded. This one does not. For my business.EHEngineer wrote:What is the product? Gasoline?
I am interested in the mathematical approach. It isn't as much about the specific product. I can find a bunch of securities and commodities that are correlated to it, but how do I go beyond that mathematically to find the mix?