Home > Net >  How to perform a Chi^2 Test with two data tables where x and y have different lengths
How to perform a Chi^2 Test with two data tables where x and y have different lengths

Time:11-30

So I have the following tables (simplified here):

this is Ost_data

Raumeinheit Langzeitarbeitslose
Hamburg 22
Koln 45

This is West_data

Raumeinheit Langzeitarbeitslose
Hamburg 42
Koln 11

Ost_data has 76 rows and West_data has 324 rows.

I am tasked with proving my hypothesis that the Variable "Langzeitarbeitslose" is statistically, significantly higher in Ost_data than in West_data. Because that variable is not normally distributed I am trying to use Pearson's Chi Square Test.

I tried

chisq.test(Ost_data$Langzeitarbeitslose, West_data$Langzeitarbeitslose)

but that just retuns that it can't be performed because x and y differs in length.

Is there a way to navigate around that problem and perform the Chi Square test regardless with my two tables which have varying lengths?

CodePudding user response:

Pearson's ChiSq test is when the rows are measuring the same thing. It sounds like here your rows are just measuring some quantity on repeated samples, so you should use a t-test.

t.test(Ost_data$Langzeitarbeitslose, West_data$Langzeitarbeitslose)

  • Related