DEV Community

Grace Anyango
Grace Anyango

Posted on

Statistics; Parametric & non-Parametric in Data science

Introduction

Statistics is an important part of data science because it helps data scientists collect, organize, analyze, interpret, and present data. It provides methods for understanding patterns in data and making conclusions based on evidence.

In data science, statistical tests are used to determine whether relationships or differences observed in data are meaningful or could have happened by chance. Two major categories of statistical tests are parametric tests and non-parametric tests.

Before performing a statistical test, it is also important to understand hypothesis testing, which helps researchers make decisions about a population using sample data.

What is Statistics?

Statistics is the branch of mathematics concerned with collecting, organizing, analyzing, interpreting, and presenting data.

Statistics is widely used in:

  • Data science
  • Business
  • Healthcare
  • Banking and finance
  • Education
  • Marketing
  • Government
  • Scientific research

In data science, statistics helps transform raw data into meaningful information that can support decision-making.

Descriptive and Inferential Statistics

Statistics can generally be divided into descriptive statistics and inferential statistics.

A.Descriptive Statistics

Descriptive statistics are used to summarize and describe the main features of a dataset.

They help answer questions such as:

  • What is the average?
  • What is the highest or lowest value?
  • How spread out is the data?
  • What is the most common value?

Common descriptive statistical measures include:

  • Mean – the average value.
  • Median – the middle value when data is arranged in order.
  • Mode – the value that occurs most frequently.
  • Range – the difference between the highest and lowest values.
  • Standard deviation – measures how spread out the data is around the mean.
  • Variance – measures the amount of variation in a dataset.

B.Inferential Statistics

Inferential statistics are used to make conclusions or predictions about a larger population based on a sample of data.

Inferential statistics commonly involve:

  • Hypothesis testing
  • Confidence intervals
  • Correlation
  • Regression
  • Statistical tests

Hypothesis Testing

Hypothesis testing is a statistical method used to determine whether there is enough evidence to support a claim about a population.

A researcher begins with a question or claim and develops two hypotheses:

Null Hypothesis (H₀)

The null hypothesis states that there is no significant difference, relationship, or effect between the variables being studied.

Alternative Hypothesis (H₁ or Hₐ)

The alternative hypothesis states that there is a significant difference, relationship, or effect.

1.Parametric Tests

Parametric tests are statistical tests that make certain assumptions about the population or distribution of the data. They commonly assume that the data follows a particular distribution, such as a normal distribution, and they often involve parameters such as the mean and standard deviation.

Parametric tests are commonly used when the data is numerical and meets the required assumptions.

Common Parametric Tests

1.T-Test

A t-test is used to determine whether there is a significant difference between means.

Common types include:

  • One-sample t-test
  • Independent two-sample t-test
  • Paired t-test

2.ANOVA

ANOVA (Analysis of Variance) is used to compare the means of three or more groups.

3.Pearson Correlation

Pearson correlation measures the strength and direction of a linear relationship between two numerical variables.

The correlation coefficient ranges from -1 to +1:

  • +1 = perfect positive relationship
  • 0 = no linear relationship
  • -1 = perfect negative relationship

4.Linear Regression

Linear regression is used to examine the relationship between variables and can be used to predict one variable based on another.

Advantages of Parametric Tests

  1. High statistical power – They can detect differences or relationships effectively when their assumptions are satisfied.
  2. Use numerical information – They make effective use of the actual values in a dataset.
  3. Useful for many analyses – They can be applied to comparisons, correlations, and predictions.
  4. Well-established methods – They are widely used in research and data science.
  5. Can provide precise results – When assumptions are met, parametric tests can provide reliable estimates and conclusions.

5.Non-Parametric Tests

Non-parametric tests are statistical tests that do not require the same strict assumptions about the distribution of the data as parametric tests.

They are particularly useful when:

  • Data does not follow a normal distribution.
  • The sample size is small.
  • Data contains outliers.
  • Data is ordinal or ranked.
  • The assumptions required for a parametric test are not satisfied.

Instead of relying heavily on means and standard deviations, many non-parametric tests work with ranks or the order of observations.

Common Non-Parametric Tests

1.Mann-Whitney U Test

The Mann-Whitney U test is used to compare two independent groups when the assumptions of an independent t-test are not appropriate.

2.Wilcoxon Signed-Rank Test

The Wilcoxon signed-rank test is used to compare two related or paired sets of observations.

3.Kruskal-Wallis Test

The Kruskal-Wallis test is used to compare three or more independent groups.
It is commonly considered a non-parametric alternative to one-way ANOVA.

4.Friedman Test

The Friedman test is used to compare three or more related or repeated groups.

5.Spearman Rank Correlation

Spearman rank correlation measures the strength and direction of a relationship between variables based on their ranks.
It is useful when data is ordinal or when the assumptions required for Pearson correlation are not appropriate.

Advantages of Non-Parametric Test

  1. Fewer distribution assumptions – They do not require data to follow a specific distribution in the same way as many parametric tests.
  2. Useful for ordinal data – They can work well with ranked or ordered data.
  3. Less affected by outliers – Rank-based methods can be less sensitive to extreme values.
  4. Useful with small samples – They can be appropriate when sample sizes are small, depending on the test and study design.
  5. Flexible – They can be useful when the assumptions of parametric tests are not satisfied.

Parametric vs Non-Parametric Tests

Feature Parametric Tests Non-Parametric Tests
Distribution assumptions Usually stronger Usually fewer
Data Often numerical/continuous Often ordinal, ranked, or non-normal numerical data
Common measure Mean Ranks/medians
Outliers Can have greater influence Often less sensitive
Examples t-test, ANOVA, Pearson correlation Mann-Whitney U, Wilcoxon, Kruskal-Wallis, Spearman
Statistical power Often higher when assumptions are met Can be preferable when assumptions are violated

The choice between the two depends on the type of data, research question, sample size, and whether the assumptions of the test are satisfied.

Top comments (0)