Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Conduct a t-test | Statistical Testing
Learning Statistics with Python
course content

Contenido del Curso

Learning Statistics with Python

Learning Statistics with Python

1. Basic Concepts
2. Mean, Median and Mode with Python
3. Variance and Standard Deviation
4. Covariance vs Correlation
5. Confidence Interval
6. Statistical Testing

bookConduct a t-test

A company wants to determine if there is a significant difference in the productivity levels of developers who work from home versus those who work in the office. Good thing you already know a t-test can help with it.

The company has two independent developer teams: one works remotely, and the other works from the office. You've been provided with two files, 'work_from_home.csv' and 'work_from_office.csv', which contain the monthly task completion counts for each developer.

Your task is to conduct a t-test. The company wants to know whether developers who work from the office are more productive than home workers. If so, they will also force the second team to work from the office. In case of home workers being more productive, the company will not make any changes. So the desired alternative hypothesis is "The mean productivity of office workers is greater than that of home workers."

Let's check if the variances are the same:

1234567
import pandas as pd home_workers = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/a849660e-ddfa-4033-80a6-94a1b7772e23/Testing2.0/work_from_home.csv').squeeze() office_workers = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/a849660e-ddfa-4033-80a6-94a1b7772e23/Testing2.0/work_from_office.csv').squeeze() # Printing sample standard deviations print('Home workers std:', home_workers.std()) print('Office workers std:', office_workers.std())
copy

The second standard deviation is twice as much as the first, so variances differ. Recall the function ttest_ind to perform a t-test.

Tarea
test

Swipe to show code editor

  1. Import scipy.stats using the st alias.
  2. Conduct a t-test with the following setup:
    • Samples: home_workers, office_workers;
    • Alternative hypothesis: office > home;
    • No homogeneity of variances.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 6. Capítulo 7
toggle bottom row

bookConduct a t-test

A company wants to determine if there is a significant difference in the productivity levels of developers who work from home versus those who work in the office. Good thing you already know a t-test can help with it.

The company has two independent developer teams: one works remotely, and the other works from the office. You've been provided with two files, 'work_from_home.csv' and 'work_from_office.csv', which contain the monthly task completion counts for each developer.

Your task is to conduct a t-test. The company wants to know whether developers who work from the office are more productive than home workers. If so, they will also force the second team to work from the office. In case of home workers being more productive, the company will not make any changes. So the desired alternative hypothesis is "The mean productivity of office workers is greater than that of home workers."

Let's check if the variances are the same:

1234567
import pandas as pd home_workers = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/a849660e-ddfa-4033-80a6-94a1b7772e23/Testing2.0/work_from_home.csv').squeeze() office_workers = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/a849660e-ddfa-4033-80a6-94a1b7772e23/Testing2.0/work_from_office.csv').squeeze() # Printing sample standard deviations print('Home workers std:', home_workers.std()) print('Office workers std:', office_workers.std())
copy

The second standard deviation is twice as much as the first, so variances differ. Recall the function ttest_ind to perform a t-test.

Tarea
test

Swipe to show code editor

  1. Import scipy.stats using the st alias.
  2. Conduct a t-test with the following setup:
    • Samples: home_workers, office_workers;
    • Alternative hypothesis: office > home;
    • No homogeneity of variances.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 6. Capítulo 7
toggle bottom row

bookConduct a t-test

A company wants to determine if there is a significant difference in the productivity levels of developers who work from home versus those who work in the office. Good thing you already know a t-test can help with it.

The company has two independent developer teams: one works remotely, and the other works from the office. You've been provided with two files, 'work_from_home.csv' and 'work_from_office.csv', which contain the monthly task completion counts for each developer.

Your task is to conduct a t-test. The company wants to know whether developers who work from the office are more productive than home workers. If so, they will also force the second team to work from the office. In case of home workers being more productive, the company will not make any changes. So the desired alternative hypothesis is "The mean productivity of office workers is greater than that of home workers."

Let's check if the variances are the same:

1234567
import pandas as pd home_workers = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/a849660e-ddfa-4033-80a6-94a1b7772e23/Testing2.0/work_from_home.csv').squeeze() office_workers = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/a849660e-ddfa-4033-80a6-94a1b7772e23/Testing2.0/work_from_office.csv').squeeze() # Printing sample standard deviations print('Home workers std:', home_workers.std()) print('Office workers std:', office_workers.std())
copy

The second standard deviation is twice as much as the first, so variances differ. Recall the function ttest_ind to perform a t-test.

Tarea
test

Swipe to show code editor

  1. Import scipy.stats using the st alias.
  2. Conduct a t-test with the following setup:
    • Samples: home_workers, office_workers;
    • Alternative hypothesis: office > home;
    • No homogeneity of variances.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

A company wants to determine if there is a significant difference in the productivity levels of developers who work from home versus those who work in the office. Good thing you already know a t-test can help with it.

The company has two independent developer teams: one works remotely, and the other works from the office. You've been provided with two files, 'work_from_home.csv' and 'work_from_office.csv', which contain the monthly task completion counts for each developer.

Your task is to conduct a t-test. The company wants to know whether developers who work from the office are more productive than home workers. If so, they will also force the second team to work from the office. In case of home workers being more productive, the company will not make any changes. So the desired alternative hypothesis is "The mean productivity of office workers is greater than that of home workers."

Let's check if the variances are the same:

1234567
import pandas as pd home_workers = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/a849660e-ddfa-4033-80a6-94a1b7772e23/Testing2.0/work_from_home.csv').squeeze() office_workers = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/a849660e-ddfa-4033-80a6-94a1b7772e23/Testing2.0/work_from_office.csv').squeeze() # Printing sample standard deviations print('Home workers std:', home_workers.std()) print('Office workers std:', office_workers.std())
copy

The second standard deviation is twice as much as the first, so variances differ. Recall the function ttest_ind to perform a t-test.

Tarea
test

Swipe to show code editor

  1. Import scipy.stats using the st alias.
  2. Conduct a t-test with the following setup:
    • Samples: home_workers, office_workers;
    • Alternative hypothesis: office > home;
    • No homogeneity of variances.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Sección 6. Capítulo 7
Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
We're sorry to hear that something went wrong. What happened?
some-alt