1 2 Previous Next 15 Replies Latest reply on Aug 4, 2016 6:10 AM by Zainab AlFarsi

# chi-square test for goodness of fit

I have two set of data from two experiment and i wanted to compare the distribution between them , i wanted to use the chi-square test and found the follwing exmple in Tableau Using table calculations to calculate chi square, but i don't have catogories , i want to compare the bins of the values and i don't know how to do it (this is what i read from through searching that to compare goodness of fit i have to have bins to catogerise the data), can anyone help please .

• ###### 1. Re: chi-square test for goodness of fit

Right click on your value field and create Bin

• ###### 2. Re: chi-square test for goodness of fit

I have created the bin but how to use it in the chi-square test ??

• ###### 3. Re: chi-square test for goodness of fit

Sorry I think I misunderstood your question.

Your method requires categories but you have bins.

So you need to create categories?

If so to do this create a calculated field,

if [value] >x and [value]< y then  A

else if [value] >Y  and [value]<z then B

else if...

.....

end

you should be able to use this as a category

I'm sorry that's as much as I can help on this as I have not come across chi calculations but will have a read tonight and get back to you if I learn anything new.

Khalid

• ###### 4. Re: chi-square test for goodness of fit

yes, but i don't know even  how to best catogerize the bins, i.e what bin size is best for my data

• ###### 5. Re: chi-square test for goodness of fit

Could you share a sample set of the data and the link you are following for the Chi Test again and I can have a look at replicating this for you

• ###### 6. Re: chi-square test for goodness of fit

Attached is the sample data , i have the score data and two catogeries A and B, i want to compare the distribution of the two catogeries.

The example also attached

• ###### 7. Re: chi-square test for goodness of fit

Dear Mr. Khalid , did you have a chance to look at the sample data and the example

• ###### 8. Re: chi-square test for goodness of fit

Hi Zainab,

Sorry for the delay, I've been a little unwell so only back in the office today.

I'm going to have a look at this now.

Have you got any links explaining the chi squared not to do with tableau.

If you do would definitely help me understand what the tableau report should be doing.

Kind Regards,

Khalid

• ###### 9. Re: chi-square test for goodness of fit

Hi Zainab,

After looking at this I need further understanding of what your data is and what you are trying to achieve with Chi Squared.

From my understanding Chi Squared is used to compute the variance of a population.

What are you considering of your population.

We should be using counts of the population how does the score fit into this.

Is the score value a count.

Unfortunately counting the score value does not work.

Applying the chi squared logic isn't too difficult. I just need you to explain more about your dataset.

Kind Regards,

Khalid

• ###### 10. Re: chi-square test for goodness of fit

Thank you Mr. Khalid

the dataset is a score for two experiment , experiment A and experiment B, I want to compare the score set or distribution in experiment A to experiment B. what I was thinking is to create bins for the score (like 5 bins) and then compare the distribution in A and B according to the bins. This what I was thinking but not sure if it is right or wrong. But definitely I want to compare distribution in experiment A to distribution in experiment B

regard,

and thank you

Zainab

• ###### 11. Re: chi-square test for goodness of fit

Hi Zainab,

Comparing the distribution of 2 experiments make sense but I'm not sure how the chi squared calculation will satisfy your requirement.

• ###### 12. Re: chi-square test for goodness of fit

Hi Mr. Khalid

the requirement is to compare the distribution of the two experiments, i searched the net how to compare distributions and i got the Chi-square test, Chi-square has two kind of tests, one of them is test for goodness of fit, which we can compare a sample of data to the whole population as i undestood, so i guss it might work to comapre two distributions

• ###### 13. Re: chi-square test for goodness of fit

Hi Zainab,

Unfortunately, Statistics is not my forte, If you can explain to me how the sets need to be compared within tableau I can assit in creating the tableau report.

I think what would help is if you apply the chi squared method (if this is indeed what you require) in an excel sheet so you know the desired outputs. Once you have this I can assist in creating this in tableau.

Unfortunately if you still have issues understanding how the chi squared calculation gets applied to your data I am unable to help with this.

What you require is a skilled statistician who can help you with this. Hopefully someone in the forum might have the required skills to be able to do this.

kind Regards,

Khalid

• ###### 14. Re: chi-square test for goodness of fit

I will try to get some help with the test and might get back if i found something

Thank you

1 2 Previous Next