Friday, March 20, 2015

Testing of Hypothesis in Business Analytics: An Analogy from Everyday Life

Testing of Hypothesis in Business Analytics: An Analogy from Everyday Life


One advanced technique you need to learn in business analytics is how to test your hypotheses. Learning how to test a hypothesis is important for analysts because they will use the process in many situations, such as when testing correlation, testing regression coefficients, testing parameter estimates in time-series analysis, testing the goodness of fit in logistic regression, and so on.
Let’s use a simple real-life example to conduct a test. Say you want to buy a 50-pound cake for a big party. You walk into a cake shop and ask for one. The store manager says it’s ready, and she shows it to you. You might get suspicious about its taste and quality. Fifty pounds is a giant cake, and obviously you don’t want to take any risks, even if the store manager assures you that it’s the best quality. In fact, you may want to test the cake. In other words, you would like to test the statement made by the store manager that the cake is of good quality. Obviously, you can’t eat the whole cake and claim you are just testing. So, you will ask the manager to cut a small piece out of the cake give it to you for testing. You might want to cut this test sample randomly from the cake. The following are the possibilities that might result from your test:

·         The test piece is awesome and tastes like the best cake you have ever had. It may be an instant buy decision.
·         The test piece is contradictory to your expectations. You will definitely not buy it in that case.
·         The quality is not the best, but it is still satisfactory. You may want to buy it if nothing better is available.

You had an assumption to begin with, you then took a sample to test it, and you made a conclusion based on a simple test. In statistical terms, you made an inference on the whole population based on testing a random sample. This process was the essence of the testing of hypothesis, in other words, the science of confirmatory data analysis.

Let’s consider one more example. A giant e-commerce company claims that half of its customers are male and another half female. To test this statement, you take a random sample of 100 customers and count how many of them are male. Again, the following three scenarios may arise:

·         Exactly 50 percent are males, and the other 50 percent are females.
·         One gender dominates. For example, almost 90 percent are males, and only 10 percent are females.
·         One gender is near 50 percent. For example, 52 percent are males in the sample.
In the first scenario, you agree to the statement made by the e-commerce company that the count of male and female customers is the same. In the second scenario, you simply reject the company’s claim. In the third scenario, you may tend to agree with the claim. Once again, you are making an inference on the whole population based on the sample measures.

These are reasonably good examples of the process of testing a hypothesis. It is summarized as follows:
1.      You start with an assumption.
a.      The whole cake is good in the first example.
b.      Overall, the gender ratio is 50 percent in the second example.

2.      You take a sample that represents the population.
c.       You try a piece of cake in the first example.
d.      You look at 100 customers in the second example.

3.      You do some kind of test on the sample gathered in step 2.
e.      You test the piece of cake by putting it in your mouth.
f.        You actually count the number of male and female customers in the sample.

4.      You make a final interpretation and inference based on the testing of random sample.
g.      You make a decision about whether the cake is good or bad.
h.      You make an inference about whether the gender ratio is really 50 percent or not.

What Is the Process of Testing a Hypothesis?

Testing of hypothesis is a process similar to the examples discussed in the previous section. Using this process you make inferences about the overall population by conducting some statistical tests on a sample. You are making statistical inferences on the population parameter using some test statistic values from the sample.
In inferential statistics, you make an assumption about the population. That assumption is called the hypothesis (the null hypothesis to be precise). You take a sample and calculate a test statistic, and you expect this test statistic to fall within certain limits if the null hypothesis is true.
Table 1-1 contains a few more examples involving the process of testing a hypothesis.

Table 1-1. Examples of Testing a Hypothesis
Scenario
Null Hypothesis
Sample
Sample Statistic
Inference
Bank customers salary
The average income is $35,000.
You take a simple random sample of 300 customers.
The sample statistic is the average salary of 300 sampled customers.
Accept the null hypothesis if the salary of the sample falls near $35,000, or reject the null hypothesis.
Drug testing
The drug has 1.5 percent alcohol.
You take a random sample of 100 ml.
The sample statistic is the measured alcohol percentage in the sample.
Accept the null hypothesis if the sample test value is near 1.5 percent.
Product feedback
Our product customer satisfaction is 80 percent.
You take a simple random or stratified sample of users across various segments.
You conduct a survey and take the sample C-SAT score (formal customer satisfaction score).
Accept the null hypothesis if the sample C-SAT falls near 80 percent.
Student training
The training has no significant effect on students.
You take a sample of students who took the training.
Students take a test before the training and a test after the training.
If there is a significant increment in the marks, then accept the null hypothesis.
Smoking causes cancer
Smoking does not cause cancer (smoking and cancer are independent).
You take a random sample from the population (contains smokers and nonsmokers).
The sample statistic is the proportion of cancer in smokers and nonsmokers.
If the proportion of cancer is not significantly different in smokers than in nonsmokers, then accept the null hypothesis.

This article was taken from the following book of Venkat Reddy And Shailendra Kadre..

Practical Business Analytics Using SAS: A Hands-on Guide
ISBN-10: 1484200446
ISBN-13: 978-1484200445




Friday, February 20, 2015

Basic Statistics for Business Analytics



21 Feb 2015, Shailendra Kadre and Venkat Reddy



By the end of this blog post, you will get some basic idea the following concepts that are essential for proceeding with business analytics techniques:
1.   The difference between population and sample
2.   Different types of sampling
3.   The difference between variable and parameter
4.   The differences between descriptive, inferential, and predictive statistics
5.   The steps involved in solving a business analytics problem
1.   Population and Sample
Population is the complete set of objects or data records that are available for an analytics project or data analysis. For example, in a countrywide marketing campaign, a narrowed-down list of the country’s citizens will form the population for the analytics problem. Generally it might not be possible to analyze the entire population because of the sheer size of the data, availability of time, funding, or limited processing power of available computing machines. These reasons may compel you to consider only a subset of the population. This subset is usually referred to as a sample in statistical terminology. If properly chosen, analyzing with a sample can be as good as analyzing the full population.

2.   Different Types of Sampling

A sample can be formally defined as the subset of a population that is selected for analysis. The procedure of creating or collecting this subset is called sampling. Sometimes, it might be necessary to manually collect some records from the overall population. There are several types of sampling techniques. The following are the ones that are most commonly used in business analytics projects.
Simple random sampling is the most commonly used sampling method. Randomly choosing some records from a population (denoted by n) is called simple random sampling. There are several methods for deciding on the right sample size. Sometimes the business problem that we are handling gives us an idea of the sample size. Once the sample size (n) has been decided based on one of the methods, records are randomly selected from the population. Convenient functions are available in SAS for this purpose.
A classic example of random sampling is of a blindfolded man picking up ten apples from a basket full of apples. All the apples have an equal probability of being picked from the basket.
Consider an example population, which has preexisting segments of same or different sizes. Segments are the population records that are already classified into a distinct number of subgroups. In such a case, it is best to do a random sampling from each segment; as such, a sample will truly represent the nature of such population.
The size of each segment can be based upon the proportion of that segment in the entire population. Such segments are usually referred to as strata. The process of simple random sampling from each strata is called stratified sampling. Segments can be manually created, and stratified sampling can be performed even when there are no obvious segments in the population.
For example, if 1,000 random candidates are to be picked from across the country for a sporting event, it might be a good idea to pick them proportionately from each state.
Systematic sampling is based on a fixed rule, like picking every fifth or seventh observation from a given population. It is different from random sampling, wherein any random values are picked. This type of sampling is generally done if testing is a continuous process. Recording the room temperature every 60 minutes or measuring the blood pressure of a patient every 10 minutes are examples of systematic samples.
·         Example: Consider a mass manufacturing machine that produces simple bolts to be used in a chemical plant erection project. Every 30th bolt manufactured by the machine can be collected as sample. This may look like a random sample from the whole lot, but you are not actually waiting for the whole lot to form; instead, you are collecting your sample much before creating the heap.

3.   The difference between variable and parameter

Simply put, a variable in a statistical data table is nothing but a column or a field in the table, a feature that may change its value from one record to another. It may well be a numeric, which can be measured for each record, or a non-numeric such as city, gender, or a status field containing Yes or No entries. Other examples are age, monthly income, daily sales, and cost data. The following are the major types of variables that a population or a sample may contain.

Non-numeric, qualitative, and categorical variables are the type of variables that represent quality or a characteristic field.
Examples are shirt sizes expressed as S, M, L, XL, and XXL, or distance, which is expressed as near and far. It can as well be a Boolean value like a pass or a fail or a yes or no field.

Parameter


A parameter is a measure that is calculated on the entire population. Any summary measure that gives information of population is called a parameter.
For example, take the data on electricity utility bills of an entire state like California.  It will be huge by any standards because it represents the variables such as name, address, type of connection, month, units consumed, and the bill amount for all households in the state. Now for planning purposes, that is, to forecast the electricity demand for the next five years in the state, if you calculate the averages on all the state’s households for the variables like units consumed and bill amount, it will be termed as parameters. So, two example parameters, that is, the entire state’s average units consumed per household and the average bill amount may look like 650 units and $100, respectively. These parameters are calculated on the entire population, which might be really large at times. So, it’s not hard to predict that it may require huge amount of computational effort.


There are three methods of Statistical analysis: descriptive, inferential, and predictive. In descriptive statistics methods, the data is simply summarized using statistical central tendencies and variations. In inferential statistics, a sample is drawn from the population to infer on the full set of data or population. Predictive statistics, as expected, can predict the dependent variable using methodologies such as linear and logistic regression.


The typical steps in problem solving in Business Analytics are as follows

a.       The Data Preparation
b.      Descriptive Analysis and Visualization



Many thanks to you for spending time reading this article. Much more on this and many other topics is available in the book, Practical Business Analytics Using SAS: A Hands-on Guide by Venkat Reddy and Shailendra Kadre. You can buy it right now at Amazon. The authors are reachable at shailendrakadre@gmail.com and 21.venkat@gmail.com.