[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hello from a newbie - Now Lin Reg



PureBytes Links

Trading Reference Links

Sorry, this one is a life experience so will not have analogies like Corey's
explanation, so no pretty girls.

Before I started trading on my own account, I was  for some time part of the
management team of the trading division of a large oil company.
Our book, would have say 3M barrels going wet overnight. These barrels price
against a formula which related to the individual deal. Some would price a
few days either side of loading based upon a formula, whilst others price
say a month after delivery. These barrels would then be onsold on a
different price formula. Furthermore we would have a position upto say 10 M
barrels long or short depending upon our view of the market. Right, that's
the easy bit. If oil drops overnight as it did last night and we were long
it's pretty straight forward to understand the net effect on our P&L.

To make life simple, we would express our exposure to oil price movement as
n million barrels. Hence if the oil price dropped by say 0.5 USD and we had
an exposure of 5 M barrels, our loss would be $2.5M. Of course the converse
is true, but markets tend to fall faster than they rise. Thus when our daily
mandate to trade was signed the Chairman would signify that he was content
that we were say 7.5 million barrels long. My experience is that the more
senior a manager is, the more he dislikes surprises. Shareholders dislike
surprises even more. Thus it' was important to get as good a handle as
possible on the risk we were running at any point in time.

Now the more complicated bit is products. We would have positions in
products. as well. So we would have gasoil, fuel oil, jet etc. By way of
example, crude oil dropped  0.5 USD, gasoline dropped 1.01 cents/gallon last
night. Thus we have a relationship between our gasoline position in tonnes
and our crude oil position in barrels. Of course last nights relationship is
only one point on the chart, and we have many charts.  What we didn't talk
about before was the fact that markets are manipulated. Lets say, I have a
cargo of 250,000 tonnes of fuel oil which I am selling to you at a number
relating to the price of the close of futures market fuel oil price tonight
. So if I buy the Nymex close, the market will rise and I make money on the
physical cargo.  Thus, there is error in price of the auction process.

So when trying to derive our relationships for exposure, we know there is
error in price ( & time, hence my observation on linear regression) .  Now,
from our statistical look at the world,  there will be a lot of points which
describe our gasoline/ crude oil price movement relationship.  Some will be
consistent and others (a hopefully smaller number) will be just wrong. Thus,
we use a robust statistic which is "insensitive to small departures from the
idealised assumptions for which the estimator is optimised". This may be
interpreted as either fractionally small departures for all data points
e.g. errors in time/price of a bar or fractionally large departures in a
small number of data points e.g. bad ticks. I'll leave the maths out, but
I'm sure you'll spot that the problem may be described as a probability
density function.

Broadly speaking there three types of  robust estimation M(maximum
likelihood), L(linear combination) & R(rank test). M estimates are
reasonably straight forward, as we minimise the mean absolute  deviation
rather than the mean square deviation. To actually describe solution of
these is beyond my typing skills/e-mail. However, mathematical statistical
text book or books on signal processing tend to be quite good in this area.

My experience was that by using these estimates rather than least squares, I
had a better handle on the exposure we were running, and thus felt warmer
when asking the Chairman to sign for the risk we were running. Someday,
probably sooner than later I'll get around to building an indicator based on
the robust statistic - funny how one gets ideas from an innocent observation
on the seeming inadequacies of a function.



----- Original Message -----
From: "Lionel Issen" <lissen@xxxxxxxxxxxxxx>
To: <metastock@xxxxxxxxxxxxx>
Sent: Friday, October 19, 2001 12:01 AM
Subject: Re: hello from a newbie - Now Lin Reg


> David:
> what do you mean by "the robust statistic"?
> Lionel Issen
> lissen@xxxxxxxxxxxxxx
> ----- Original Message -----
> From: "David Jennings" <davidjennings@xxxxxxxxxxxxx>
> To: <metastock@xxxxxxxxxxxxx>
> Sent: Thursday, October 18, 2001 4:29 PM
> Subject: Re: hello from a newbie - Now Lin Reg
>
>
> > Corey,
> > Thanks for the reply. I like your wave analogy. I haven't used lin reg
in
> > Metastock, but have used it extensively elsewhere, and was surprised
that
> > the MetaStock implementation appeared to have no predictive capability
> i.e.
> > one can't explicitly look at a value say 5 bars into the future - thus
> > thought maybe I had its particular implementation around my neck.
> >
> > I suspect I should given a rather longer explanation of what I was
getting
> > at. I was looking for an answer which was as simple as last bar on chart
> > based on n periods back, or the number of bars back was the same as the
> > number forward (less likely) or the number of bars back was set
> implicitly.
> > Thus, humble apologies.
> >
> > This prompts question, have you tried using the robust statistic? I've
not
> > rigorously  tried it for use in smoothing price as an input to an
> indicator,
> > but have found that it gives superior results for volatility /EOD
exposure
> > calculations.
> >
> > Many thanks
> >
> > DJ.
> > . ----- Original Message -----
> > From: "C.S." <csaxe@xxxxxxx>
> > To: "MetaStock List" <metastock@xxxxxxxxxxxxx>
> > Sent: Thursday, October 18, 2001 7:29 PM
> > Subject: Re: hello from a newbie - Now Lin Reg
> >
> >
> > > David,
> > > I will give it a try, at least how I see it. You should really go to a
> > > library to find a book on Basic Statistics. I have found that at least
a
> > > basic grasp of statistics is essential to technical analysis so you
can
> > > accurately judge if one indicator or system is really "better" than
> > another,
> > > and by how much. It also speeds the development of an indicator since
> you
> > > will have a grasp of what is really being measured and can zero in on
a
> > > specific path for improvement for an indicator, rather than blindly
> > plugging
> > > numbers into an equation and wasting your time.
> > >
> > > Imagine standing at the beach and watching the waves roll in. You find
a
> > > nice flat board 13 feet (periods) long, and throw it lengthwise into
the
> > > surf so the ends of the board extend from one wave crest to the next.
> The
> > > ends of the board will slightly sink into the wave crests while the
> middle
> > > of the board will rise slightly above the trough between the crests.
The
> > > board is trying to find a true sort of average of the level of the
ocean
> > as
> > > it sees it from its 13 foot (period) world.
> > >
> > > If the height and shape of both waves are the same, the surface of the
> > board
> > > will be level. Obviously, if one wave crest is higher or broader than
> the
> > > other, that end of the board will be higher than the other. The board
> will
> > > be sloped from horizontal.
> > >
> > > If we had attached a felt-tip pen to one end of the board and let it
> mark
> > > the motion of the end of the board onto some paper (yeah, waterproof),
> we
> > > would see the result of the movement of the end of the board as waves
> > moved
> > > under it. Although linear regression uses a straight line to form our
> > board,
> > > MetaStock graphs the line that would result from the end of that board
> as
> > it
> > > moves over the crests and troughs of the close of prices. If we had
> thrown
> > a
> > > shorter board into the surf, it would pitch up and down and show a
> larger
> > > range of slope changes than the longer board. The pen attached to the
> > > shorter board will also more closely graph the shape of the waves. The
> > > analogy of the difference between a small boat and a supertanker in a
> > storm
> > > could also be used.
> > >
> > > If the foregoing has completely confused you, just do the following:
> > > 1. Open a chart of prices and double-click directly on the prices to
> > change
> > > the price style to line.
> > >
> > > 2. Go to Insert, and line studies, and draw a 13 period linear
> regression
> > > line onto the prices anywhere on the graph.
> > >
> > > 3. Go to Indicator Quicklist and select Linear Regression Indicator.
Put
> a
> > > 13 period indicator onto the prices.
> > >
> > > 4. Click directly on the 13 period line study bar that you drew in #2,
> and
> > > holding down the left mouse button, slide it left and right over the
> > prices.
> > >
> > > 5. Cool, eh? Notice that the right end of the linear regression line
> study
> > > bar perfectly traces out the line that was graphed by the 13 period
> Linear
> > > Regression Indicator from the Quicklist.
> > >
> > > 6. Get back to the beach and offer a cold one to that gorgeous blonde
> that
> > > helped you find the boards.
> > >
> > > -Corey Saxe
> > >
> > >
> > >
> >
>
>
>