Friday, December 17, 2010

Merry Xmas Edition: Fun With Statistics: Chernoff Faces

Chernoff Face Features Mapped To ValuEngine Model Variables

The Faces Of The Thirty DJIA Stocks

Let's take a break from High Alpha-Low Beta stocks for this week and have some fun with statistics, with a visualization tool called Chernov Faces. Chernoff Faces help us to visualize multivariate data, by putting a 'face' to it. Here's the explanation from Wikipedia:Chernoff faces, invented by Herman Chernoff, display multivariate data in the shape of a human face. The individual parts, such as eyes, ears, mouth and nose represent values of the variables by their shape, size, placement and orientation. The idea behind using faces is that humans easily recognize faces and notice small changes without difficulty. Chernoff faces handle each variable differently. Because the features of the faces vary in perceived importance, the way in which variables are mapped to the features should be carefully chosen (eye size and eyebrow-slant have been found important). For the drawing of the face of each DJIA stock, I have selected 14 of the ValuEngine model variables and each stock's values of these variables constitute its face. The whole matrix is standardized by scaling each column from 0 to 1 so that face features are relative to the population. The face feature and the model variable that is associated with it is shown in the top Table. We have to remember that for some variables, the smaller the value, the better e.g. valuation % and volatility. Let's see what we can glean from the faces of the DJIA stocks:
1. I think the most unique face belongs to Alcoa: The slanted eyes represent its small market cap. The small face shows its undervaluation.2. Caterpilar has an extremely long nose, and that's due to its high Beta. 3. Microsoft's eyes are extremely far apart because its got good 5-year returns.4. Bank of America's small face shows extreme undervaluation.And so you can compare the faces by yourself. The spreadsheet of the actual values is available from me if anyone wants it. All in all, I would think that (1) they all look quite alike except for weird people like Alcoa and Bank of America. Everybody is smiling because the last three columns that involved features of the mouth were not used. General Electric looks honest and Coca Cola looks like the jovial pastor from the church on Main Street. I don't like the looks of Hewlett Packard, the narrow jaw relative to the wide forehead.
And finally for a Gallery of The Art of the DJIA, like the Contour Plot in the top image, see it on my other Blog at http://www.fu-lu-shou.net/2010/12/stock-market-data-as-art.html Until then, Have A Merry X'mas and a Happy New Year.

Saturday, December 11, 2010

HighAlpha-LowBeta Stocks: Week 3

A beautiful representation of ValuEngine's model variables applied to the thirty DJIA components. Model variables were first standardized by converting to Zscores and Principal Component Analysis was done on the selected 15 variables. What you see is a 3D surface and contour visualization of the coefficients of each Principal Component. For more of DJIA as art, see http://www.fu-lu-shou.net/2010/12/stock-market-data-as-art.html
The list of stocks
Last 12-Month Return % (Momentum)

Beta

EPS Surprise %

M/B Ratio

P/E Ratio

Valuation %

Volatility %

This week we continue with our screen for high Alpha, low Beta stocks [see previous two posts]. If you compare this week's list with the first list, you will notice that many of the stocks were on the first list e.g. Frontier Gold, US Gold, Logmein, 7-Days Group etc. You will also realize that many of the stocks are in the high expectations industries e.g. mining, biotech, Chinese Internet, Oil and Gas. These are what we usually think of as high Beta stocks, but the difference is that these particular stocks have a high Alpha and low Beta-which makes any run-up more sustainable [see their low Beta values in top table]. But ValuEngine's Beta are longer term Betas, and therefore it is possible for these stocks to have short term correction. Frontier Gold was 9.19 when we listed it two weeks ago versus 10.42 now. US Gold was 5.56 versus 7.56 now, Western Refining was 9.25 versus 10.22 now. So whether these stocks continue to run up depends on the market, the perceptions on Gold, Oil and the USD. What we can do is to take a look at the performance of this week's portfolio next week. For now, just take a look at each of the image maps based on some of the model variables. First of all, note that the list of stocks are in two clusters: One in segment S3 and the other in segment S1. Segment S3 include the red-hot stocks like FRG,UXG and WNR which have already made good gains.

The images are self-explanatory. The stocks are plotted against the backdrop of the S&P500 stocks.

Look at where the stocks are positioned, and look at the scale below. In general, these high Alpha stocks have become more expensive [see valuation map], with high P/E ratio, and higher volatility. But their M/B Ratio is low and the EPS Surprise % is very high. Momentum is high, and Beta is higher for the stocks in S3, but lower for the stocks in S2.

My bet is on the lower Beta stocks in S2: PBT,LOGM,SVN,MNRO,OPEN and HTWR. Let's see how they perform next week.

Saturday, December 04, 2010

Performance Of Last Week's HighAlpha-LowBeta Stocks

+ 37 % change of last week's stocks versus S&P500's + 3.9 %
Last week, I accidentally left out the full details of my ValuEngine Institutional screening. Well, here it is: Because there is no definitive way to interpret the value of Jensen's Alpha (other than to say that it must be positive), and because Alpha is derived from Beta, and Beta is about performance relative to the market as represented by an Index- I used the Ranking system in ValuEngine. That is I screened for stocks with Jensen's Alpha Rank > than 90. This means that in relation to ValuEngine's Universe of 4500 stocks, these are the stocks in the top 10 % in terms of Alpha value. Also, the stocks have to have a minimum market cap greater than $0.5 Billion and average daily volume greater than 100000 shares. Then I added the constraint that the Beta should be less than 1. When this yielded too many stocks (about 76) I progressively lowered the Beta value until it was 0.6.
Now, lets take a look at the performance of the selected stocks which was based on their location on the Self-Organizing Map [SOM]. (Refer to last week's post). Well, from the image above you can see that the results have been quite good. Against the S&P's performance of +3.9 %, we have a portfolio average of + 37 %. Mostly due to two big gainers: Frontier Gold and U.S. Gold Corp. Tune in again next when we shall do more of the same and demonstrate that even in a flat market, high Alpha low Beta stocks can outperform.

Sunday, November 28, 2010

Stocks WIth High Jensen's Alpha and Low Beta For An Uncertain Market?

The formula for Jensen's Alpha
The High Alpha/ Low Beta stocks
Beta map Sharpe Ratio Map
P/E Ratio Map
M/B Ratio Map
LAst 12-M Return % Map

Forecast 1-M Return % Map

I just discovered that ValuEngine's Institutional software does have Jensen's Alpha in its output. Jensen's Alpha is basically risk-adjusted Alpha [see formula in top image], and is what hedge fund managers use as measurement of their performance (and to justify their management fee). Jensen's Alpha is derived from the Beta, and therefore inherits all the flaws of a simple measure like Beta. Beta is a meaure of regression/correlation and its value depends on (1) the period used for calculation (2) assumption that it doesn't change much during the period of measurement and is not volatile [bad assumption]. What I wanted to know was, what kind of stocks are high Alpha low Beta and whether they would be suited for an edgy market situation like currently. When the market is strongly trending upward, you ought to pick high Beta stocks and never mind the Alpha, But when the market is uncertain, low Beta high Alpha stocks should do better since hopefully the Alpha component of a stock's characteristics will carry through to make gains in spite of the market.
Thus using ValuEngine, I screened for stocks with (1) minimum market cap > $ 0.5 Billion (2) Average daily volume > 100000 shares (3) Beta<>
The results are interesting. Refer to the images above and looking at the scale below each map you will find the following characteristics of the high Alpha low Beta stocks in the table above.
1. These stocks have a high Sharpe Ratio- these are safe stocks, as measured by their returns/standard deviation over 5 years.
2. They have high last 12-month returns % and in the world of fundamental analysts that's high Momentum!
3. They have high P/E Ratio but low M/B Ratio- i.e going by book value ( and not just earnings) again, these are safe stocks.
What more could an investor wish for in such uncertain times? Now let's go over to the qualitative side and look at the Companies that are on our list. [If you look at any of the SOM, you will see that most of the stocks (their ticker symbols) are clustered very close together- a good sign that they have a high degree of similarity not only in their Alpha, but in all the other fundamental variables of the ValuEngine model]. For this reason, let's leave out WNR Western Refining way out in S1 cluster and ALK Alaska Air also away from the tight cluster.
FRG Frontier Gold: Exploration and Mining of Gold, Silver, Copper and Uranium
LOGM Logmein: Information Technology remote connectivity services for small and medium businesses
NFLX: Netflix. We know what it does, maybe there's some takeover of this business?
NRGY: Inergy L.P: owners of gas pipelines, storage tanks, terminals and other distribution networks.
PBT: Permian Basin Royalty Trust: Royalty rights in mineral properties in the U.S.
QCOR: QuestCor Pharmaceutical: Drugs for Nervous System, inflammation, insomnia
SQNM: Sequenom Inc: Biomedical Genetic Analysis and Molecular Dynamics for humans, agriculture and livestock.
SVN: 7-Days Group ADR: Chinese budget hotel chain with 400 hotels.
SVR: Syniverse Holdings: Wireless voice and data services for telecommunications companies worldwide
UXG: U.S. Gold Corp: Gold mining with properties in USA and Mexico
VHC: Virnetx Holdings: engages in developing and commercializing next generationsoftware and technology solutions for securing real-time communications over the Internet.
Well, wouldn't you agree that these are all sexy Companies? Just remember that the Alpha and Beta values used here are longer term calculations in line with ValuEngine's fundamentals-based models, so don't expect this to be like technical analysis. Perhaps next week we screen again for such stocks and denoise them or look at them with Wavelets like in some of the other posts.

Saturday, November 27, 2010

Enigmatic Stocks Of The Singapore Exchange: Capitaland, Hyflux, Jardine

Continuous Wavelet Transform of Capitaland
Capitaland De-Noised
Residuals (Noise) of Capitaland
Continuous Wavelet Transform of Hyflux
Hyflux De-Noised
Residuals (noise) of Hyflux
The Inexplicable Jardine Cycle & Carriage
Using Wavelets, we take a look at three Blue-Chips of the Singapore Exchange and try to explain why even long term holders may lose patience with certain Blue-Chips. Capitaland and Jardine Cycle & Carriage are components of the 30-stock Straits Times Index of Singapore. Hyflux used to be a component too, I think. The data here is for approximately 5 years [see number of days indicated at the top of each chart]. Before you begin: (1) you may want to read more in general about Wavelets from the other posts on this Blog (2) The Y-axis represents 'scale' on wavelets, the higher the longer term. (3) Patterns that you see are real. They are fractal self-similarities if they extend up the image (3) The higher on the Y-axis, the bigger the picture i.e the low frequency approximations while at the bottom are the high frequency details.
And if you look at the charts, Capitaland and Hyflux have been going nowhere, despite the strong fundamentals. Hyflux is one of the top water technology Companies in Asia, and Capitaland is South-East Asia's largest property developer. The notes on each image are self-explanatory. To summarize: As the years went by, shorter term players began to lose interest in Capitaland and Hyflux, and now there is less and less interest in them. Hyflux does have higher 'turnover' than Capitaland, but these are on the longer term scale. Hyflux is a totally different animal from Capitaland, i.e. its holders are of a different type. The autocorrelation level of Hyflux is very high compared to most other stocks which means that it is more suitable for technical analysis (of the longer term kind, maybe using weekly data). As for Jardine, its Continuous Wavelet Transform shows it to have basically no pattern of any kind. I don't know what to say abgout it. Its most common use as noted by many Singapore traders is as something to throw in a few seconds before the closing bell, to affect the ST Index one way or another. Will Hyflux and Capitaland change their 'personalities'? Not unless they draw more interest from shorter term players.

Sunday, November 21, 2010

Explaining and Interpreting Wavelets

The shape of a typical Wavelet, in this case a Daubechies
Breaking down a signal with Wavelet
Continuous Wavelet Transform (CWT) of iShares FTSE/Xinhua China 25 Index(966 days till November 20 2010)

Hope the above helps in explaining and interpreting Wavelets. Basically, a Mother Wavelet like the Daubechies wavelet and its Scaling function the Father Wavelet is stretched and shifted along the length of the signal, and the correlation between wavelet and signal recorded as coefficients- the larger the higher the correlation with the signal. Starting from a small wavelet, that caters to the higher frequency (details), the wavelets are stretched into bigger wavelets for approximating the lower frequencies at the higher end of the scale. Actually most wavelet transforms are Discrete and have less scaling and shifting and are yet able to approximate the signal for full re-construction approximate the signal. But in our case we have used a Continuous wavelet transform without redundancy , to go every step of the way and get a full pciture because in highly non-stationary financial data, interesting details are lost if Discrete wavelets are used.

Shanghai Index (SSE) More Technically Driven Than Singapore Index (STI)

CWT of XLF
1. Continuous Wavelet of SSE (Shanghai Composite)[Daubechies 6 to Level 5]

2. SSE De-Noised with Haar wavelet and Adaptive Thresholding to Level 5

3. Residuals of SSE, Histogram, Autocorrelation and Spectrum

4. Continuous wavelet of STI (Straits Times Index)[Daubechies 6 to Level 5]

5. De-Noised STI with Haar wavelet using Adaptive Thresholding to Level 5

6. Residuals of STI, Histogram, Autocorrelation and Spectrum

Contrary to popular opinion, a market that is less-fundamentally driven [by which I mean it is more technically driven] is easier to predict. This can be illustrated with the example of the SSE versus the STI. The SSE is wilder in its swings and speculation plays a greater part. It is also more insular and less affected by international events and other international markets. The STI on the other hand is very open, and like Singapore's economy is easily rocked by international events and other markets. Trying to predict the direction and magnitude of change for tomorrow's close of the STI is nigh impossible. On the other hand, using technical analysis and other non-linear tools, it is possible to for a short period grasp the mathematical properties of the SSE for prediction purpose.Image 1 and image 4 compare a continuous wavelet (CWT) of the SSE and the STI. A CWT can capture the fractal self-simlar patterns of a time series, and looking at the SSE and the STI we see that the patterns are less defined for the STI. As an afterthought and to show you something that is even less predictable than the STI, I put the CWT of the XLF which is the iShares ETF of the US Finance Sector right at the top.
In image 2 and image 4, I used a Haar wavelet to denoise the SSE and STI. The original and de-noised signals can be seen as an overlay. Unlike a moving average, wavelets have no lag. And if we were to for example put a +1 % upper band and a -1% lower band to the de-noised signal, we could use it as a Buy/Sell signal. You would be able to ignore the small moves, ride the big upswings and cut loss on the big downswings. Images 3 and 6 show that the noise removal has been quite effective. The residuals are random, the histogram is Gaussian (normal) the autocorrelations drop nicely from zero, and spectrums indicate that signal energy has been retained for the lower (significant) frequency approximations.

Saturday, November 20, 2010

Beta Is A Double-Edged Sword

1. Clusters
2. Cluster Statistics
3. Cluster Summary
4. Beta
5. Valuations
Beta, which measures the sensitivity of a stock to a market Index, is a double-edged sword. When the market has high upward trend and momentum, high Beta stocks do well. When the market has a strong correction, high Beta stocks will also be strongly affected. As a conservative investor, I prefer to look for stocks with low Beta and high Alpha. Alpha is difficult to define. While Beta is the slope of the linear regression line that has the stock's % change on the X-axis corresponding with the market Index's % change on the Y-axis, Alpha is the point on the Y-axis where the Beta line starts from X=zero. Unfortunately, this definition is not helpful in terms of stating quantitatively what a value of Alpha implies. For example what does a value of 0.8 for Alpha mean, what does Alpha > 1 mean? Just as hedge fund managers define Alpha as the portion of their skills that enable them to outperform the Index, I will now define Alpha as a stock's 'distance' (mathematical, Euclidean Distance) from the Index in terms of overall fundamental characteristics- the greater the distance the better.
A Self-Organizing Map which clusters stocks according to their degree of similarity in overall characteristics, will allow us to look for high Alpha stocks. With the SOM, high Alpha stocks are therefore those which are as dis-similar to the market as possible-in a good way of course. With this in mind, and using ValuEngine's fundamental variables, I first screened for stocks with minimum market cap > US$0.5 billion, and Average Daily Volume > 100000 shares. Then I ranked them by their Beta, and took the 40 stocks with the lowest Beta. # It must be mentioned that the value of Beta depends on the time period that you use for calculating it, and ValuEngine's Beta is a long term Beta. These stocks were plotted on a SOM using the S&P500 as a backdrop. Image 1 shows the clusters generated by the SOM, and the Ticker Symbols of the selected low Beta stocks, and their position on the SOM. Looking at Image 2 and Image 3, it is clear that S1 cluster is the cluster where most of the S&P500 stocks reside. So in our task to select low Beta, high Alpha stocks, we leave out all of the low Beta stocks which are in S1, as we want stocks which will be as different from the Index as possible.
Next, we look at cluster S2. Is it really different from S1? From Image 2 which measures the difference between clusters in terms of standard deviation (the longer the bar the greater the degree of difference), there really is not much difference between S1 and S2. It's only S3 which has a big difference with the Index. Nevertheless, there are some differences between S1 and S2 in some
key model variables. For example, S2 stocks are undervalued while S1 stocks are overvalued, S2 stocks have higher 1-month forecast return %, S2 stocks have lower Sharpe Ratio, lower 12-month return % etc.
Next take a look at Image 4 which shows the Beta as a color-scaled intensity map. And Image 5 is the same type of map for Valuations.
The low Beta areas are Blue/Violet. I have identified and labeled the low Beta stocks which also have low valuations. The list of stocks and their business profile from Yahoo Finance are:
ADM- Beta: 0.23. Archer Daniels Midlands Company: Archer Daniels Midland Company procures, transports, stores, processes, and merchandises agricultural commodities and products in the United States and internationally. It operates in three segments: Oilseeds Processing, Corn Processing, and Agricultural Services.
AVAV-Beta 0.23. AeroVironment Inc: AeroVironment, Inc. designs, develops, produces, and supports unmanned aircraft systems and efficient energy systems for various industries and governmental agencies. It offers small, hand-launched unmanned aircraft systems (UAS) that provide intelligence, surveillance, and reconnaissance, including real-time tactical reconnaissance, tracking, combat assessment, and geographic data to the small tactical unit or individual war fighter. THAT'S HOT !! :)
APOL- Beta 0.09. Apollo Group: Apollo Group, Inc., together with its subsidiaries, provides various educational programs and services at the undergraduate, graduate, and doctoral levels. The company offers associates, bachelors, masters, and doctoral degree programs in arts and sciences, business and management, criminal justice and security, education, human services, health care, psychology, technology, and nursing through its campus locations and learning centers in 39 states and the District of Columbia, and Puerto Rico, as well as through online educational delivery system.
PBCT Beta 0.21 - People's United Finance. People's United Financial, Inc. operates as the bank holding company for People's United Bank that provides commercial banking, retail and small business banking, and wealth management services to individual, corporate, and municipal customers. The company operates in three segments: Commercial Banking, Retail Banking and Small Business, and Wealth Management.
TFSL- Beta 0.28 TFS Financial Corporation operates as the holding company for Third Federal Savings and Loan Association of Cleveland that provides retail consumer banking services in Ohio and Florida. The company offers various deposit accounts, including savings accounts, NOW accounts, certificates of deposit and individual retirement accounts, and other qualified plan accounts
HMY- Beta 0.29 Harmony Gold Mining: Harmony Gold Mining Company Limited engages in underground and surface gold mining. It also involves in related activities, including exploration, processing, and smelting. The company operates a total of 10 underground operations, 1 open cast mine, and 8 processing plants located in the Witwatersrand basin of South Africa, as well as the Green Stone belt. It also holds interests in the development and exploration prospects at Hidden Valley and Wafi in Papua New Guinea. In addition, the company holds interests in the Amanab and the Mount Hagen Projects located in Papua New Guinea.
As you can see from the list of selected stocks, low Beta high Alpha has no sector preference. I thought that Utilities and big cap Pharna stocks would make the list. Anyway, this is a more holistic way for selecting stocks with low Beta and high Alpha.

Saturday, November 13, 2010

Technical Analysis: Lag_Free Noise Removers Using Wavelets

1. My experimental no lag indicator: Buy/Sell when cross zero: Keppel Corp
2.Normal 5-Day Simple Moving Average
3.Continuous Wavelet Transform of Keppel Corp
4. Compression
5. Residuals of Compression
6. Denoised and original signal
7. Independent interval thresholds for change in characteristics

8. Residuals of Denoising
9. Regression Estimate of Main Signal and original signal
10. Residuals of Regression
# Credits and Citations for posts on Wavelets: Much of the pioneering work on denoising using wavelets and the use of thresholds was done by D.L Donoho and I.M Johnstone (USA) and Kerkyacharian and Picard (France). Also thanks to Amara Graps of the South-West Research Institute , Colorado and and Robi Polikar of Rowden University,NJ whose articles made understanding of Wavelets by the layman possible. And finally, thanks to Matlab, whose Wavelet Toolbox is the industry standard, and whose User Guide is better than any text book.
Every technical analysis enthusiast is familiar with the Moving Average and what it does- it smoothes the signal and thus acts as a de-noiser so that you can ignore the noise. But noise always has to be user-defined as what is not noise to a short term investor is noise to the long term investor. Although a useful tool for medium term and longer term traders, a Moving Average is less useful to the short term trader; and choosing the optimal period for an MA is a bit of guesswork, since you can back test all you want, but the market and the stock's characteristics are always changing.
In this post we use Wavelets to denoise a stock signal [the example used here is Keppel Corp- a Blue Chip on the Singapore Exchange]. Wavelets are a more recent technology used in digital signal processing for working with signals that are not regular, and have sharp sudden and transient moves. Fourier transforms with their regular sinusoids cannot handle such signals. Stock market signals fit this category of signals. In wavelet methodology, the signal is also decomposed into constituent wavelets like in Fourier transforn, but different parts of the signal in time are handled by different stretched and shifted versions of the mother wavelet. Thus changes in characteristics of the stock signals can be accomodated, Moreover, wavelets have compact support and are orthogonal. Compact support means the wavelest have a cut-off point unlike regular sine waves which go on forever. Orthogonal means there is no overlap of information being handled by different constituent wavelets. There are three different ways that Wavelets can take away noise from a signal: (1) by normal denoising (2) by compression (3) by regression. Although the algorithms for each is different, the end result is the same: you get a signal that is smoother than the original signal. The test for how good a denoiser is can be shown by the residuals. That is, after denoising, compression or regression, the leftovers, if they are indeed (white) noise will show a random distribution. Lets go through each image from the top:
Image 1 shows a technical indicator I developed using the wavelets methods below. The idea is to Buy when the indicator crosses above zero and sell when it crosses below zero. As you can see from the vertical lines aligned with the stock chart, the indicator is quite efficient. Only problem is how do we determine whether the crossing of zero can be sustained. We will have to use it in conjunction with another indicator.
Inage 2 shows a normal 5-day Simple Moving Average of the stock. 5- day is too short and you won't want to move in and out of the market so often.
Inage 3 shows a Continuous Wavelet Transform of Keppel Corp using a Daubechies 4 to Level 5, and scale 1: 128. All it can tell you is that the stock does not move randomly. There is a large deterministic component, but it is always changing in its parameters. The image shows the fractal self- similarity characteristic of Chaos Theory.
Image 4 shows how compression can give you a smoother less noisy signal. In this case, 99 % of the signal's energy (entropy) was retained while 92 % of the image was padded with zeroes. That is, only 8 % of signals's content was sufficient to derive the compressed signal. But if you look at the residuals in image 5 , the residuals are not as random as the residuals for denoising and regression below. Which means that some useful content was also taken away. Still I think that if we are trading a Blue Chip like Keppel Corp where we can have a greater tolerance for 'noise', this derived signal is the best of the four methods here.
Image 6 shows the signal after denoising, and it hugs closely the original signal and has no lag. This denoising was done with two different thresholds. As shown in image 7, the market got noiser and more volatile during the last 300 trading days or so, so a different threshold for defining what is noise was used. The residuals show that the denoising was quite effective.
Image 9 and 10 shows how regression can also be considered a form of denoising. Regression algorithms are 'fitting' algorithms but the end result is the same. We get a smoother less nosiy derived signal.
I could fine-tune the regular denoising and regression algorithms to hug the main signal less as in the compression algorithm. But it's hard work and still a trial and error thing choosing the right wavelet family, the appropriate number of vanishing moments, level of decomposition etc. Nevertheless my point is that it's time the people who design technical indicators think of using Wavelets to do the work. Wavelets are a better tool to analyse the kind of signals that stock markets generate, taking into account the non-linear adaptive dynamics that characterise stock markets.