Saturday, 14 April 2012

Cluster Analysis - 101

The current Wikipedia page on Cluster Analysis, excerpted below, is correct, detailed and makes absolute sense.  Then again, if you do not have a background in statistical modeling, I'm guessing these two paragraphs leave you no wiser.
Cluster analysis or clustering is the task of assigning a set of objects into groups (called clusters) so that the objects in the same cluster are more similar (in some sense or another) to each other than to those in other clusters. 
Clustering is a main task of explorative data mining, and a common technique for statistical data analysis used in many fields, including machine learning, pattern recognition, image analysis, information retrieval, and bioinformatics.
Wikipedia 4/2012 
In this post I hope to provide a workable introduction for people that need to be educated consumers of cluster analysis.
(If you want more technical detail, I suggest you go back to the Wikipedia link above, and follow up on the range of hyperlinks embedded in the document -  it's really very good.)

Let's put this in context with an example.  Assume we are working with a retailer that has 1000 stores and they want to decide which dairy products to put in each store to maximize sales.

One option would be to treat all stores as being the same, come up with one assortment list and put it everywhere.  This has the singular advantage of being easy to execute while leaving all non-mainstream products off the shelf.

At the other extreme, we could try to tailor product assortment individually by store.  Did I mention there are 1000 of them?  Apart from the work involved in building 1000 individual analyses, do we have the discipline to execute such analyses consistently across 1000 stores? Would we have sufficient organization to execute these unique selections in 1000 stores?

Most teams will end up working with groups of stores that they consider "similar" as a compromise.   These groupings may be based off single store features (e.g. stores with more than 30% of sales from premium products) or maybe geographical features (e.g. everything in the South East).  Bear in mind that, if you are trying to do this without statistical help, they really need to be simple groupings .

For assortment selection, we really want to group together stores where people buy similar products.  In this case we want to find groups of stores that have similar sales patterns.  For dairy, these sales patterns could be related to the % of sales associated with various product characteristics:
  • premium vs. value, 
  • single-serve vs. multi-serve, 
  • cheese vs. yogurt vs. creamer vs. drinks vs. milk
  • yogurt styles
(Note: I do eat a lot of dairy but I haven't worked that category yet so forgive me if I missed something big)

Cluster analysis (actually a class of statistical algorithms, not just one) is used to scan across multiple features that you think are important, to find groups (clusters) so that:
  • stores within a cluster are similar to each other
  • stores in different clusters are dissimilar
It sounds rather like magic doesn't it ?  You just throw it at the algorithm and (big fanfare) it finds clusters !  Well perhaps it's not quite that easy.
  • It does take some care to prepare the data, ensuring it's clean, accurate and in a form that works for this process (see Data Cleansing: boring, painful, tedious and very, very important).  
  • In reviewing the results you may decide to drop some features and split out others (e.g. "Premium" is split into "Premium" and "Super Premium").
  • You need to determine how many clusters are correct for your data.
  • You may want to bring in some additional data to help describe clusters
    • demographics of people living near the store (ethnicity, income, household size etc. )
    • geography (maps work well)
    • local competition
  • Really an extension from clustering, but you could build predictive models to explain why , for example, super-premium, greek yogurt is so very popular in Cluster 4.  If you can tie high sales of this product group to specific demographics, you may find other stores with similar demographics that have not previously sold it. (Could be a big opportunity).
I'll return to this topic in future posts, but for today, your takeaways are simple:
Cluster Analysis finds better groups (clusters) of similar things.  Clusters help you target your offering without dying under the weight of work.

Saturday, 7 April 2012

Reporting is NOT Analytics

Reporting is about what happened; Analytics is about answering "what if" and "what's best" questions.  Most of the materials that land on a VP/Director’s desk (or inbox) are examples of reporting with no analytical value added.


Reporting tells us what has happened: sales; orders; production; system downtime; labor utilization; forecast accuracy. Reports leave it up to the reader to digest this information and based off their experience and expertise about the world around them construct a ‘story’ as to why it may have happened that way.

Really good reports will look for known causes of routine issues. For example, if I know a store is low on inventory of a specific product, I could just report that. If I flag it as an exception the person receiving the report may even see it among the sea of other facts. To go the extra mile, it would be wise to see whether I can (automatically) find any disruptions back in the supply chain (either with inventory or flow of goods) and include that information to answer the routine questions that will be raised by my report. But, the report builder must anticipate these needs at the point they are writing the report and for more complex issues that’s just not realistic.

Analytics is all about finding a better story or, if you prefer, insight from data. We’ll talk about tools for finding insights in a moment, but much of this is about approach: develop a working theory about what may be happening and test it out with the data you have available. Revise your theory if needed, rinse and repeat: this is very definitely an iterative and interactive process.

At the simplest level a lot of really good analytics is enabled by being able to interact with the data: filter it to see specific features; sort it to find your exceptions, drill-down into more detail to see (for example) which stores are causing the issue in your region, chart it to see trends across time or perhaps even see relationships between variables (like temperature and sales of ice-cream by region). Generally available tools (like Excel) can get you a long way to intuitively understanding your data and finding some insight.
A further step (and one I fully understand most analysts cannot take - see  What is ‘analysis’ and why do most ‘analysts’ not do it? ) would be to run some descriptive statistics around the data.
  •  Measures of ‘average’ (mean, median, mode)
  • Measures of ‘spread’ (Standard deviation, percentile ranges, Min/Max)
  • Frequency histograms and boxplots to visually show the distribution of data
  • Scatter plots to view interaction
  • Correlation matrices to spot high level interactions
  • Outlier detection
  • Dealing with missing values
If these options seem strange perhaps even archaic and of little relevance to the business world, you may need to trust me when I say that these are exceptionally valuable capabilities that increase understanding of the data, uncover insights and prepare you to step into the world of (predictive) modeling. Thinking back over the last 2 weeks of work (store clustering, system diagnostics, algorithm development and even some ‘reporting’) I can confirm that I have used every one of these multiple times and to good effect.

In Predictive Modeling we build a mathematical model around the problem you are trying to solve. Once the model is built, and (very importantly) validated to confirm that it really does behave as you expect the world too, you can start asking questions like:
  • what happens if I add another warehouse to this network
  • what is the best combination of price and promotion to maximize profitability
  • how much inventory do I need in each warehouse
  • what is the best way to load this truck
  • what is the best assortment for each of my stores
  • why are sales dropping in the Western region

Everyone is familiar with the phrase “Garbage In, Garbage Out” relating to how computers will happily calculate (and report) garbage when you throw bad inputs at them. With modeling, the structure of the model is one of those inputs and many of you may have experienced the complete junk that comes out of a bad model even when you put good data into it. Picking the right modeling tools for the right job and applying them correctly is a very skilled job. Predictive modeling covers an extraordinarily broad field of statistics, mathematical and operations research. Just as for data handling (see The Right Tool for the Job), this is not something you are likely to do well without appropriate training: understanding the field you are trying to apply these tools to helps enormously too.

So why go to the trouble and expense of ‘Analytics’ rather than ‘Reporting’? Reporting is essential, but well-built Analytics or Predictive Models can find insights and opportunities that you will never find by any other means.

A really good analyst will do this work and while being willing, ready and able to take you to whatever depth of complexity you wish, will furnish you with a simple (perhaps even one page) report that answers your questions and makes the end result look … obvious.

Friday, 6 April 2012

Property speculation in Malaysia. [Updated, April 2012]

By Jackie, Researcher

The impact of property speculation towards the younger Malaysian generation, the causes and effects of this speculation as well as the future predictions and forecasting about potential property investment in Malaysia. [Updated, April 2012 with 2012 Real Property Gains Tax (RPGT)]


From stylish, contemporary homes to luxurious condominiums with lush greenery

Introduction

The objective of this research is to get a clearer picture on property speculation issues which have started to happen in Malaysia since 2007. Well, after seeing some real-life examples through buying and selling (as my family is dealing with this kind of business), doing ample researches through property news investment like attending Gavin Tee’s seminar, following up government plans [eg. Malaysia My Second Home (MM2H) programme and 2012 Real Property Gains Tax (RPGT)], studying the “conversion strategies” played by the broker and developers and analysing the increase rate of oversea investors, I have decided to share my experiences here.

Overview

The real estate market had gone through a “roller coaster ride” in the recent years, from a soaring market in 2008 to a depressed market in 2009 and skyrocketing again in 2011. There is a lot of controversial points related to this current issue whether Malaysia is currently facing “real estate bubble” [also known as property bubble as well as housing bubble] or not? Steps and measurement have been taken by both government (by implementing RPGT) and banking sector (by disallowing full-loan to Malaysian property buyers).



What is wrong with Malaysia My Second Home (MM2H) programme?

The objective of this programme is to encourage or attract foreigners to retire in Malaysia or spend extended periods here. The major advantages offered by the government include low cost of living, developed infrastructure, friendly Malaysians, attractive tourist destination, quality environment, good climate and variety of food. This programme however, has induced some foreign investors to invest instead of staying here. As most of them are very rich, they used to left their house here waiting for the price to shoot up and then sell back to earn an attractive capital gain.

“Conversion strategies” played by unethical brokers and greedy developers.

Honestly, most of them prefer to sell house to foreigner. Why? The reason is simple. This is because they have a higher purchasing power than Malaysian. Also, please note that some of them are come from Middle East, Japan, Korea, China and Singapore. Ok, now let's take at look into a deeper ground. Have you ever feel that developers always build high luxury condos, semi-detached houses, bungalows instead of low price apartments or moderate double storey houses? This is all about Economics! Land is limited. Why they want to build a lower priced house when they can build a higher priced house on the same land? They are not afraid of unable to sell all the units because now their strategy is to build in a smaller scale instead of large. Plus, they are not afraid of having no customers as they have found the “new higher purchasing power customers from other countries”.

What will happen in the future?

Well, a fresh degree graduate can only earn an average of RM2,000 to RM3,000 per month. The cost of living in Malaysia is rising plus most of them need to pay installment for cars normally when they need to go to work as there is still some “lacking” in public transport in Malaysia [Not all place is reachable, mismatch of time and inconvenient]. Recently, banks only lend up to 70% of the house in value. The new mortgage lending rule applies only to borrowers taking up a third housing loan to curb excessive investment and speculative activity in urban areas. In short, "the rich will become richer, while the poor have to work harder". Some experts spark up rumors by saying that Malaysian young generation will turn into a condition, so called "homeless generation" too, and indirectly speed up the government's plans to handle this worrying situation. 

Steps and measurement taken by the government to solve this issue.

Implementation of 2012 Real Property Gains Tax (effective from 1 January 2012) with chargeable gains from disposal of real properties are as follow:
1. Sold within 2 years = RPGT 10%
2. Sold above 2 years and below 5 years = RPGT 5%
3. Held more than 5 years will be exempted from the Real Property Gains Tax (RPGT)


Predictions and forecasting

Potential property investment in the future kindly refer to this talk given by President of SwhengTee International Real Estate Investors Club, Gavin Tee’s on Ipoh Property Talk at The Haven Lakeside Residences:
Part 3: http://www.youtube.com/watch?v=YUfSg-cgtjM




Upcoming issue***

"In order to tackle the rising of house prices in Malaysia, the government is now considering whether is it appropriate to double the minimum price of houses which the foreigners can purchase"





Wednesday, 4 April 2012

Gold Investment Forecast and Predictions [Updated, April 2012]

By Jackie, Researcher

This is a private college research on gold investment based on historical data, and analysis for the future market trend in global market. Well, after seeing a lot of theories, stories and discussion; my curiosity and doubtfulness towards gold investment grows deeper and stronger. The main idea is whether it is worthwhile to invest your money in gold investment rather than putting your money in bank's fixed deposit account to earn a fixed rate of interest. Therefore, after getting some internal news plus doing some researches on this matter, I have decided to share this knowledge and ideas with you guys.

Firstly, there are several advantages of investing in gold.
  1. The stability of gold tends to be stable from year to year. Have you ever heard of gold price fall? The answer might be yes, but most of the time is no. Why? In Economic, gold is consider as 'limited supply'. Therefore, as time passed by, the demand of gold will shoot up due to the 'increasing demand' in raw stock to make jeweleries.
  2. Not affected by inflation like other currencies do (Zero inflation effect).
  3. Can be withdrawn in the future in physical state to make jeweleries (In bank, you might have to buy minimum quantity in order to do this).
The disadvantages are as follow:
  1. You might suffer loss if the gold price drops; earn nothing if gold price stay stagnant, and eventually waste a lot of time in order to wait for the price to shoot up again.
  2. Transaction/ procedure fees.
Below are some examples of an gold investment deposit account offered by CIMB Bank Malaysia.




Perhaps, this graph will give a clear picture on the historical data of global gold price. It is positive gradient on overall.


So, what will happen next?

According to the Star newspaper which I have read on this 16 of February , it is written there "The Gold Bullion Entrepreneurs Association of Malaysia (GBEAM) expects gold price to hit US$2,000 per ounce by mid-year from the current US$1,733 per ounce as the weakening global economy would drive more funds to safe-haven investments such as gold". 

Therefore, based on my calculation there is a high opportunity of making 15.4% capital gain on investment, if the prediction is correct. Although risk is still there, but it has been minimized as ample forecasting have been made by experts. I am not saying that they will be certainly right, but their probability of making wrong is very low. 

Another popular theory I always heard is "purchase gold when the gold price is low, sell it off when the price is high". This theory is basically closely related to capital gain maximization. 

So, what is the right time to sell? Answer: during the peak price. An OCBC Bank report in January 2012, has forecast that gold price would be around US$1,800 per ounce by the end of 2012. That means the falling occurs between June till December this year.

In conclusion, it is very hard to say that gold investment is highly-profitable. This is because it depends on market situation. It is advised that investors should always keep on updating themselves with the latest market information and get some views from experts. Whenever you can foreseen the opportunity, why don't you give a try. Remember, in Economic, whenever a marginal benefit of doing something is greater than its marginal cost. Just do it! And you will never regret. Do not let the opportunity cost gone like that.

Thanks for spending sometime to read this. Any constructive opinion is highly-welcomed.    

Here are some useful links regarding this issue:
http://biz.thestar.com.my/news/story.asp?file=/2012/2/16/business/10717078&sec=business
http://www.youtube.com/watch?v=F1yjB3M8SNM&noredirect=1
http://www.cimbbank.com.my/index.php?ch=cb_per_st&pg=cb_per_st_inv&ac=12&tpt=1#



Saturday, 31 March 2012

Data handling - the right tool for the job


Microsoft Excel must be the most widely used analytic tool available today but, it’s not the only tool in my tool-bag and it should not be the only one in yours either.  It’s perfect for building small models, has broad embedded functionality, good charting capabilities, pivot-tables (a superb tool worthy of its own post), comes with a programming language so you can extend its capability even further and almost everybody has a copy already.  It’s awesome and I use it every day.

But...the data we analyze is getting much bigger and a lot more complex.  Even with newer versions of Excel allowing over 1 million records in a sheet, what can you do usefully in Excel with 1 million records?  Certainly, you don’t want to print it, it’s near impossible to chart or model against, bottom line you are using the wrong tool for the job.  To do the job well you need to find, learn and use the right tool.  Don’t believe me?  Try chopping down a tree with a hammer!

It may be tempting to aggregate your data to reduce data size and continue using Excel.  Beware!  When you aggregate (Sum, Average, etc.) you lose detail you might need.  As an example, let's look at retailer point-of-sale data: the record of every purchase in every store:  
  • Aggregate individual shopper transactions into daily summaries (by product and store) and you can no longer see product associations in the basket or product substitution  from basket to basket;  
  • Aggregate daily to weekly data and you will be blind to monthly sales patterns (which can be very extreme).  
  • Aggregate store to national data and you will be unable to see regional patterns or relate sales profiles to demographics by store.  
If you throw away the detail you need (just to fit in a smaller space) then to quote a friend of mine "everything just looks vanilla".

At this point, most business analysts will open up Microsoft Access.  This can handle more data (up to 2 Gigabytes) and the complexity of multiple tables better than excel does it in multiple worksheets.  It also uses the same programming language so there is less to learn.   It’s a very good tool when used appropriately and I have a lot of experience with it, even designing custom data architectures and programming extensions to drive faster performance from it.

It seems easy to go beyond 2 Gigabytes these days but even before you reach 2GB you really should move to a more industrial-strength database (SQL Server, Oracle, DB2, MySQL…) just to handle the data volume effectively.  As data heads towards Terabytes and the data complexity increases you will need much more knowledge about database design and programming to do it well.

The analysis tools are not nearly so easy to apply in these environments as in Excel, requiring access to more high powered and analytical, data mining and optimization tools (SAS, SPSS, ILOG) or, for simpler analytics and my preference, a capable programmer that can embed the analytics directly into your database applications so they are usable on demand.

I have recently been working on a 3 Terabyte database, around 1500 times larger than the biggest Access database you can build and substantially larger than most SQL Server databases.  At this point, we are really talking ‘Big Data’.  In the analytical world you’ll see this phrase ‘Big data’ a lot right now.  If, for example, you’re collecting high frequency sensor data for weather modeling, or collecting data on for a web search engine, 3TB may not seem that big, but by current CPG standards it certainly is and importantly, its big enough that it becomes challenging to use regular, even industrial-strength, database packages. 

In this case (for Point of Sale data analysis) we use a novel and application-specific, data-architecture and associated query engine developed by Shiloh Technologies (www.shilohtech.com) on a SQL Server database.  The Shiloh application, enhanced now by a variety of analytic tools handles the huge data volumes for us, runs analysis, filters, summarizes and presents the data back to the user in a volume that a mere human can manage (certainly less than 100,000 records, 10,000 would be better).  And guess where we put that data?  Back into Excel of course – it’s a truly phenomenal tool!



Tuesday, 20 March 2012

Data Cleansing: boring, painful, tedious and very, very important

I've been working recently on a category management project and I'm reminded of just how essential clean, well-organized data is.  We are working to group stores into 'clusters' of similar stores; later we will see what geographic and demographic data best helps us to predict cluster membership and optimize product assortment by cluster.

As a first pass, and under a severe time crunch, we took the data available, ran it through the model and while it processed, I was unhappy with the predictive power we found.  Of course, this approach was ridiculously  optimistic: so, back to look at the product characteristics we were using.
While the data were cleaner than expected they still suffered from a range of problems visible to someone who does not know the products that well:
  • missing, invalid and inconsistent values
  • inconsistency across related products (flavor variations with different weights and pricing). 
  • product characteristics that should really be split into multiple characteristics (because the options are not mutually exclusive)
It's taken a few iterations and a few days to get this cleaned up and to embed some of the new product characteristics in the system but its worth every minute.  Even simple analysis  now shows more meaningful results.  Predictive models will benefit even more.

Clustering is a relatively simple statistical process:   once set up, I can teach someone with limited predictive modeling skills to re-run models with sensible defaults and to interpret the outputs.  Cleaning the data and presenting it correctly to the modeling tools (so you get useful answers) takes more skill.


So, if you are knee-deep in a modeling project and have not paused to check your data quality, perhaps now is the time…



Sunday, 18 March 2012

What is ‘analysis’ and why do most ‘analysts’ not do it?

In the Consumer Product Goods (CPG) world, there are a lot of analysts: supply chain analysts; sales analysts; shelf analysts; category analysts; transportation analysts... you get the idea.  For many people the 'analyst' role is their first step onto the managerial ladder.  It is their job to learn the business,  'crunch' numbers and one day, with hard work and a little luck, get promoted to a non-analytic, managerial role.



Knowing this career path, their managers recruit for skills and attitudes that reflect managerial and leadership potential (results focus, initiative, collaborative team working and initiative).  Rarely do they look for strong analytical skills (math, statistics, logical reasoning, systems engineering, management science and operations research) and as most organizations provide limited career paths for people with such skills, perhaps it is best not to recruit them into a dead-end role.

For many analysts, much of the work is focused around report generation which is manual and repetitive in nature ( run/copy/paste/format) and leaves little time for investigative, analytical work to comment on the reports, let alone investigate why the report says what it does.  The analyst stays stuck in this rut because they do not possess the skills and perhaps the time to find a way out.

It should not come as a surprise then that while analysts can be very bright, very energetic and looking forward to a great career in your company, they may not be very strong at 'analysis': framing the business issue to be solved; extracting the maximum useful insight from available data; and making recommendations as to next steps.

There are certainly other ways of thinking about what 'analysis' is, but I think this serves for now.  Of course it also gives you an idea why some people strong in analytic skills don't always do good analysis either :-)  In my experience, many lack the interest in the business issue they are working on, being enamored with the analytic process rather than the end-result.

Finding the combination of skill-sets you need to do this work well is tough and unless you have a very large organization, maintaining a critical mass of these skills is likely to be a problem too - it may be necessary to buy it in.