As mentioned in the first tutorial that these chapters are designed to help you learn and train for SAS Business Analyst certification and other data scientist certifications, we are going to first focus on topics which are more relevant for that and then we will explore the vast ocean of statistical concepts.
if you have gone through the last 3 chapters, then you have already got your foot wet with the basic concepts of data science and have a basic understanding about its operations.
In this chapter, we will primarily focus on ANOVA which is listed as one of the topics on SAS BA certification page and the technique is widely used in data science domain.
Analysis of variance (ANOVA)
Analysis of variance which is also known as ANOVA, is the statistical model or rather, collection of models which is used to measure the significant variation between groups of variable where usually means are used to measure the difference. It basically inform user about the difference in the mean of multiple groups for statistical significance.
You can use t-test if you are going to compare two groups, you can learn about t-test in our previous chapters.
ANOVA is primarily used when you are going to measure differences between more than 2 groups. ANOVA was developed by R.A Fisher.
In the last chapter while explaining t-test, I have used two groups preparing for SAS certification as an example to elaborate T-Test. Suppose you need to measure the performance for more than 2 groups, you will use ANOVA.
Type of ANOVA
- One Way ANOVA
- Two Ways ANOVA
Before we further move into ANOVA, let’s look at two important concepts which are integral to ANOVA.
It is a test where distribution is F shaped. It is commonly used in ANOVA when means of the two population, having similar standard deviations, are equal.
Critical value is selected using the f table and then it is used to accept or reject the null hypothesis.
F values are non-negative, distribution is asymmetric and two independent degrees of freedom, one for numerator and one for denominator.
And the second concept is, test statistic.
F test is used in test statistic where distribution pattern is f shaped. Test statistic is used to measure one attribute and is a standard value calculated from a sample data while performing a hypothesis test.
Let’s go through the following example to understand F Test;
|Sample 1||value-mean||Squared||Sample 2||value-mean||Squared||Sample 3||value-mean||Squared|
Sum of Squares within Group = Sum of squares Sample 1 + Sum of squares Sample 2+ Sum of squares Sample 3
Sum of Squares within Group: 57.12+143.2+37.2= 237.52
|Now calculate total sum of squares using all groups|
493.33= Sum of Squares between Group + 237.52
To find out Sum of Squares between Group, mean of each group (sample, sample 1, sample 2 etc) – mean of all the groups (22.33 in this case)
|Total x 5(number of units in each sample)|
You can also use basic algebra to figure out the value of sum of squares between groups, but I did it manually to give you some idea on how it is done manually. But round off is causing issues here, so we will use 255.81 to rule out errors.
Now Calculate Total/degree of freedom numerator where degree of freedom numerator=number of sample Groups – 1
255.81/2 = 127.905
Now Calculate Sum of Squares within Group/degree of freedom denominator where degree of freedom denominator=number of items within sample Groups – number of samples
237.52/15-3 = 19.79
F is ratio of total/sum of squares within group
Now We need to determine the critical value using the below table where numerator is at the top and denomincator are the horizontal lines, we need to determine the intersecting points of the table for 2 and 12.
|Now we have;|
As f value or ratio is greater than critical value and above 5%, null hypothesis will be rejected.
So coming back to ANOVA, it is one of the most widely used techniques in psychological experiments to collect and examine data.
Please find same calculation in the excel format, please note that some of the cells don’t have formulas so you can manually calculate them but most of the functions are already there;
Download F test calculations
Assumption of ANOVA
Assumptions of ANOVA are very important in data science field. They are also required for SAS BA exams. So now we will look at assumptions of ANOVA.
- Dependent variable are normally distributed and have same variance.
- Errors are normally distributed and are independent.
We will further look into the assumptions and one way ANOVA in the next chapter.