Monday, January 7, 2013

What kind of problem do you have?


The primary focus here is to look at the process of modeling human behavior. Specifically, the focus is on the modeling or categorization of individual observations of human behavior. These observations generally involve some type of prediction about the future. Here are just a few examples of the types of predictions that could be made:
  • Topic of incoming phone calls.
  • Response to outbound telesales.
  • Response to Direct Mail.
  • Purchase given response.
  • Credit Risk of customer making full payment on loans or credit cards.
  • Risk behavior and insurance claim behavior of vehicle operators, renters, and homeowners.
  • Health risks of individuals – likelihood of dying or injury or getting a specific disease.
  • Individual membership in certain lifestyle categories, such as high income, low education, married without children.
  • Income potential of students.
  • Attrition risk of customers or group members.
  • Voting patterns of individual voters.
  • Risk of recidivism for criminals.
  • Graduation success of students.
Classifying your problem into a specific type is just the beginning of the problem. The next step is
  • Defining your problem – There are a wide number of problems that can be solved by statistical modeling. The following is not intended to be comprehensive, but merely a sampling:
    • Prioritization – Prioritization problems encompass a wide range of modeling solutions. The primary objective is to rank order the observations by some objective. For example:
      • Rank order a portfolio of credit card account applications as to the likelihood of identity theft and then target the top 0.1% for further investigation.
      • Rank order loan accounts that are late as to the likelihood of going on to be 30 days past due and then target various accounts for tailored contacts (reminder e-mails for the least likely, reminder phone calls for mid range, and multiple phone calls for the most likely)
      • Rank order incoming phone calls to a catalog company as to the likelihood of a potential sale.
      • Rank order patients for online medical advice as to the potential severity of their symptoms
      • Rank order students as to their likelihood of scoring poorly on standardized tests and then give those at risk extra work and attention.
      • Rank order applicants for auto or homeowners insurance by risk levels and give those with lower risk better rates and coverage, those with higher risk may be directed to special companies or other treatment, such as more frequent review and adjustment of their pricing.
    • Estimates of specific values – Estimation problems require a model that can predict specific values; however, most of these problems can be solved with rank ordering solutions. For any group within a rank ordered solution (i.e. the top 1%), an average value for the target can be calculated and used for predicting a specific value. Usually, for these kind of problems more accuracy is needed than in a rank ordered solution. For example:
      • Predicting the exact weight (±5%) of an individual based on diet, age, height, bone density and body fat.
      • Predicting the MPG of a vehicle based on the design specifications under given driving conditions
      • Predicting the amount of money that can be recovered from a loan that has been charged off (alternatively called LGD or Loss Given Default).
      • Predicting the amount of loss that can be expected for a specific group of insurance policies which helps price these policies.
      • Predicting the arrival time of an airplane flight based on weather, speed, and type of aircraft.
    • Segmentation – Categorization of observations into homogeneous groups. This is various forms of statistical clustering and is often not classified as a modeling problem; but, it has many similarities to traditional modeling: it involves individual observations; sampling is always an issue; and it can be used for a variety of predictive purposes. It also involves a lot of subjective judgement, such as what variables are used for clustering; how is a good cluster defined; how will the categories be used. Examples of segmentation:
      • Lifestyle segmentation – Classifying individuals or households into specific categories that may be described by lifestyle characteristics. This is usually based on census data (age, income, family size, education, ethnicity, housing, and other demographic information derived from the census bureau), survey information, subscription information, and so forth. The primary idea here is to define homogeneous groups for purposes of marketing or surveys.
      • Performance segmentation – Classifying individual accounts or customers into various homogeneous segments based on performance, what they buy, how often the buy, where they buy, when they buy. These classifications can then be used for marketing purposes, retention, potentially for risk evaluation, items to stock or sell, and so forth. Examples of markets where this type of segmentation can be used:
        • Credit Card – Credit Card utilization can be used to group users as Revolvers, Transactors, inactive, balance transfers. Other information, such as merchant SIC can further group users into
        • Frequent buyer cards – Information from frequent buyer
          • retail stores – grocery, hardware, pharmacies, …
          • airlines,
          • online purchasers – Auctions, Books, gadgets, collectibles, …
        • Insurance – Types of insurance, levels of risk, amount of coverage, … Such as high risk vehicle drivers with multiple policies, hurricane prone properties, Other weather, such as hail, tornadoes, blizzards, …
These are just a few of the issues that must be addressed before a modeling project is initiated.
There are several steps in this development, which will be addressed in separate sections:
  • What is the modeling Target (dependent variable(s))?
  • What are the predictive (independent) variables?
  • What are the time windows for both the target and predictive variables?
  • Will there be any performance inference?
  • How to deal with interactions between variables?
  • How will the model be implemented and monitored?
Once the initial design is completed, the next step is to define the samples that will be used during development. There should be two samples used for a rigorous model development process, a development sample and an Out of Time Sample (OTS). Both will be discussed in the sections below.

                                                        Return to FAMQ

How do you approach first steps if you are a client?


As a modeling client it is important to understand the basics behind modeling. First, we need to define what kinds of problems are being addressed in this paper. There are a wide variety of modeling problems.
  • Physical models – These encompass efforts to mathematically model the physical world. These include: biological or bio-medical models wherein an attempt is made to model the underlying biological or chemical interactions of drugs and or chemicals. These also include modeling the physical and/or mechanical world, such as aerodynamics or the weather or geological aspects. These also include queuing models such as the work flow on a factory floor or transactions at a service window or teleprocessing of customer service calls.
  • Financial and economic Models – These models typically try to predict things like how much money will be spent or earned by an entity. These are accounting models. The look at and try to predict interest rates, exchange rates and economic variables such as employment rates, GDP, and so forth.
  • Human behavior models – These encompass efforts to mathematically model the much more complex behavior of humans. These include things like: risk, response, buying, selling, mating, and so forth behavior.
The physical and bio-stats models require intimate theoretical knowledge process being modeled and familiarity with the medical field. This paper does not address the unique aspects of these kind of challenges; although many of the issues addressed herein can be applied to these other kind of problems.

Why are First Steps important? – Defining the Problem


One of the first steps in any modeling project is to define the problem and establish the details of the business objective. Many modelers want to grab some data and just start building a model. Many Clients just want a model because everyone else has one. The problem with this is that if the parameters of the problem are not thoroughly discussed with the business partners then the resultant model may end up with serious flaws. Things to look for:
  • Accuracy - The final model may not have sufficient accuracy to be useful.
    • A model can have some performance accuracy but not enough to justify the expense of implementation and maintenance. It is important to understand what level of improvement is needed by the business customer.
    • The wrong target and or performance window was not accurately defined.
    • Estimate the potential accuracy of the model by researching similar models in the company or industry.
  • Implementation - The model may not be implementable.
    • Variables are used in the model that are very predictive but are not available for implementation.
    • Variables are used in the model that are very predictive but are too expensive for implementation.
    • Systems need to be revised or updated for real-time implementation.
    • Evaluate the potential variables in the final model and check with the implementation team for known and unknown issues.
  • Monitoring - The final model may not be adequately monitored and thus not be able to be subject to live validation.
    • Monitoring is not best practice, it is a requirement in many industries.
    • If a model cannot be monitored then it may not be known if and when it is no longer effective even hazardous to the business

Basic Stats - Why does it matter?

In a previous blog I described some very basic concepts in descriptive stats. Why does this matter to the typical consumer?

One of the most important things a consumer needs is the knowledge that enables them evaluate advertisements, news articles, political speeches, business portfolios, and other information.

Often, these sources of information will use some form of statistics to describe some policy, test result, financial statement or other numerical summary or analytical result. Knowing basic stats will help the consumer to better understand these results and when to question the results.

Examples

The examples presented here cover most of the situations that the ordinary consumer will encounter; however, more advance analysis requires additional insight which may be answered in my Frequently Asked Modeling Questions (FAMQ).

                                                        Return to FAMQ

  • Central Tendency - Question whether a measure of central tendency is using median or mean. Often a result is presented as the average, but is that the average of all numbers (mean) or the value for the average individual (median). This is particularly true for monetary data (income, salary, net worth, price of items, ...) which are often negatively skewed. The mean makes the "average" seem higher and the median makes it look lower.
  • Dispersion - When looking at dispersion it is important to question what it is when it is omitted from a report. Sometimes two populations will be compared by reporting only the  mean or median. These values may differ greatly, but in order to truly compare the two populations you need to know how the values vary. For example, one could be comparing two realty companies based on how long it takes them to sell a property. One could be higher than the other but have a much wider dispersion
  • Samples - Sampling is often biased and not randomly selected. The example above on realtors could have bias by comparing high priced properties for one company and low priced properties for the other firm.



Friday, December 28, 2012

Descriptive Stats - Samples

In my opinion, the concept of sampling is one of he most important concepts for the non-stats guy. One of the primary reasons is that just about anyone can understand the sampling concept and, for a specific population with which one is familiar, it doesn't take deep knowledge of stats to understand whether a sample is biased.

The first part of sampling is to understand that if you want to make a broad statement about a population you need to take a sample and calculate stats from that sample. What is crucial is that the sample be Random and unbiased.

What is a Random Sample

The classical definition of a random sample is that every member of the population has a equal chance of being chosen in the sample. This is almost always impossible; however, the key to getting a reasonable sample is to consider all the possibilities from the sampling process that could contribute to bias.

What is Bias?

Bias has to do with the sampling being non-random. I know, this seems circular and it is. The key is to understand whether or not the non-randomness has an impact on the values that are being collected from the sample. This is best demonstrated by an example

Let us consider an elementary class room of children and we want to collect a sample to estimate the weight of the average child in the school, Let's say that you have the children line up by height and pick the first 10 children and measure their weight.

First, if you just select children from one class room there will be the age bias (younger children are lighter). Second, by sorting the sample by height there will a bias towards heavier children since taller kids are usually heavier. The ultimate result will be biased in the calculation of weight.

Now, if you were trying to measure the average hair length, this process might not be biased, unless  there is a gender bias in the sorting process.

How to protect against bias?

This is where "local" knowledge comes into play. As a stats guy, I can sometimes identify sources of sample bias, but there is no substitute for "local" knowledge or what we call SME (Subject Matter Expertise).

In the above example, an elementary school teacher would be better able to judge whether there is a height gender bias in that school. Obviously, as children age, males tend to be taller, but is that true with elementary students.

A typical example in the credit card industry is to find a random sample to determine basic stats about a specific population of accounts. Often these accounts will be sorted by date of origination or payment. Does this contribute to a bias? Again, a SME experienced with the data would be helpful if identifying any potential bias. For example, it could be that accounts that have a history of delinquency are sent out early in the billing cycle or accounts that have been on the books a long time are likely to have higher limits since they have been on the books longer and had the "bad" accounts charged off.

Identifying bias is an extremely important step in stats. It can influence everything that happens in the use of the sample. It goes back to the old acronym GIGO, Garbage In, Garbage Out.

Thursday, December 27, 2012

Basic Stats - Descriptive Stats: Central Tendency, Divergence and Distributions

Descriptive Stats

Descriptive stats is the area of stats used to describe general summary information about data. These stats basically describe something about the middle values of the data and how the data varies.

NOTE: in this blog the measures discussed are specifically for numeric rank order data. The generally do not apply to categorical data such as:

  • Color - Color eyes, hair, objects
  • Numerical Categories - Zip Code, Social Security Number, account number.
  • Type of Object - car brand, type of car, type of house, ...

Central Tendency

The first concept that one needs to deal with in basic Stats is the concept of Central Tendency.

This seems like a simple concept, and it really is, but there are a few subtleties. When we talk about central tendency, we usually think of average, but what is average really? There are several things people refer to when they talk about the average:

Average - The classical definition in stats is called the Mean which is the sum of all values divided by the number of values. For example, if you have 10 people in a room and you add their ages and you get 100 then the average or Mean age of this group is 10 years.

Median - Sometimes, when people say average, they really mean the Median, which is the middle value. This is obtained by ranking the observations in numerical order and then picking the middle value (if you have an even number of values you take the mid point between the middle two values). For example, in our hypothetical room lets say you have, 5 four year-olds, 4 five year-olds and one 55 year-old. The middle value is then 4.5 years. Average is often represented by the symbol X with a line over the top, called X-bar.

Mode - The mode is the most common value. In our room, the mode would be  years.

As can be seen in this example, there is a huge difference between Mean and Median and Mode. Because of this it is important to know what someone (especially someone with an Agenda) means when they refer to average. This is particularly true when the value being used is from a "skewed" distribution where most the observations are in a narrow range, but a few are substantially different. Typically, this causes the Mean to be significantly different from the Median.

This is especially true of Income. For example, lets say the company for which you work has 100 people and 95 of them make minimum wage of $8.00 per hour. The remaining 5 managers make $100, $200, $300, $400, and $500 per hour. Here, the Median wage ($8.00) might be quoted if someone wanted to imply that the company didn't have a very high payroll, but if another person wanted to brag about how well paid the employees were they might use the Mean ($13.60). So if someone said the average worker at this company makes X dollars and hour, what value should they use?

Divergence

In the discussion above on central tendency, I referred to a "skewed" distribution. This starts to get into the concept of divergence.

Divergence is an extremely important concept in stats.To demonstrate this let's take an example from American football. As a coach, you are in a situation where you need to gain at least 1 yard. You need to chose between two plays. Looking at the stats you see that both plays gain an average of 2 yards; however, play A gains 2 yard plus or minus 1 yard and play B most of the time loses ground, but sometimes gains 10 or more yards. The choice should be obvious, for this situation you should call play A.

In this example, Play A has a much smaller divergence than Play B. In a different situation, say where 10 yards is required, play B might be more appropriate.

As with central tendency, there are a number of divergence calculations:

Variance - This stat is rarely mentioned in descriptive stats, but it is one of the basic calculations. It is defined as the sum of the squared differences between each value and the mean. It is represented by s squared:

Standard Deviation - This is the most common calculation and is the square root of the variance:
Why do we use standard deviation? It all gets down to some higher level math and the convenience of the variance calculation. For basic description, it is best to think of the average absolute deviation.

Average Deviation - An easier to understand calculation is the average absolute deviation (we use absolute deviation because basic deviation is positive and negative and would average out to zero). For the average deviation add up the absolute deviation for each observation from the mean and then take the average of those values:

Average Deviation
Other measures of divergence are:

Range - The difference between the largest and smallest value.

Inter-Quartile Range - The range of the middle 50% of the population.

There are a number of other divergence calculations, but they are relatively esoteric and beyond the scope here.

Distribution

When we describe a distribution we generally talk about the shape of the curve that describes the data. These distributions fall into three basic categories:
  • Normal Distribution - This is the classic symmetric, bell shaped distribution:
    Typical normal distributions are physical measurements, such as weight, height, distance, speed, ...

    • Uniform - This is basically a flat distribution. All values are equally frequent. A good example is the number (1-6) on a fair single die. 
    • Symmetric - The unifom and Normal distributions are symmetric, there are also other symmetric distributions that may be flatter or wider than a typical Normal distribution.
    • Skewed distributions - In the example used in the Central Distribution discussion above, we saw a skewed distribution where the distribution is NOT symmetric.
    Knowledge of the type of the distribution is helpful in understanding both the importance of the measure used for central tendency and dispersion.

    For symmetric distributions, the Mean, Median, and Mode are about the same and the dispersion measure tells you about how far the data are spread on either side of the middle. For skewed distributions there are significant differences between the central tendency values:

    Summary

    As a data consumer, which everone is, knowledge of the basics of descriptive stats are important when reading, watching, or listening to various reports in the media (news reports, advertisements) it is important to question the assumptions on which these reports are based. 
    • Is the reported middle value from a skewed distribution?
    • Are they reporting mean, median, or model?
    • What is the dispersion of the data being reported? 
    • Does the middle value come from data with a narrow distribution or a large dispersion?

    Musings

    I have been playing around with various mantras:

    What is, is.
    What isn't is not.

    What's done is done.
    What's not done is undone.

    What will be, will be.
    What won't be will not be.

    What happens, happens.
    What doesn't happen, does not happen.