# Looking for guidance - statistical test to use for survey data

Would like some guidance on what kind of statistical test to use for survey data I want to look at two things: • Is there statistical difference between how groups have answered? • Is there a correlation between two questions?

For example, difference between how groups have answered. I have the demographic age group against favourite colour, I want to calculate if there is a significance difference in the colour chosen and if so which ones. This is random numbers below

I will also be running this on scale questions if this makes a difference. E.g. how satisfied are you with our products?

Finally, I am not sure if you would use the same test for this but I want to look at intra question analysis. For example, if one question is, Where did you first buy one of our products? And How satisfied are you with how products? I want like to see any connections so it might be that people who first brought a product at a shopping centre are more satisfied with the products then those who brought online

I will be conducting the analysis in tableau but first want to ensure I use the right statistical tools Thanks for your help

Possibly subject to late night typing errors, I put your first table into R:

g = c( 21, 321, 312, 335, 355)
b = c(354,  34,   3, 875, 345)
p = c(345, 635, 384,  53, 395)
TBL = rbind(g,b,p)
TBL
[,1] [,2] [,3] [,4] [,5]
g   21  321  312  335  355
b  354   34    3  875  345
p  345  635  384   53  395


Here is output from chisq.test in R. Very highly significant result with P-value near $$0.$$ So colors are not selected homogeneously across age groups.

chi.out = chisq.test(TBL);  chi.out

Pearson's Chi-squared test

data:  TBL
X-squared = 1897.7, df = 8, p-value < 2.2e-16


The large chi-sq statistic 1898 is the sum of squares of Pearson residuals. It's often useful to look at residuals with absolute values greater than 3 as guidance towards which ad hoc tests might be worthwhile.

round(chi.out\$resi, 2)
[,1]   [,2]   [,3]   [,4]  [,5]
g -12.77   2.51   8.19  -1.12  2.63
b   7.10 -16.43 -15.17  21.69 -1.30
p   4.31  13.34   7.26 -19.49 -1.04


Popularity of blue seems very low for ages 18-54, then very popular at ages 55-74. Also 55 seems to be a time for changing opinions on colors. And green seems unpopular overall. [Maybe these are fake data for illustration so I won't speculate why. Or suggest other patterns.] I do wonder why there are so many subjects in older age groups.

Similar chi-squared tests seem appropriate for the other two tables. Column headers are missing on last table.

Most statistical software does chi-squared tests on tables such as the ones you show. But beyond showing the chi-squared statistic and the P-value, there are differences in the details of output.

Note: If you have particular questions that you want answered for the different tables you show, you might be more specific about your goals. And that might prompt some useful comments and suggestions.

You seem to be looking at categorical data, so would need to be using a pearson chi-square test or similar (after checking for various assumptions). This is a good basic resource and includes a test of association example.

https://www3.nd.edu/~rwilliam/stats1/x51.pdf

I'm not familiar with Tableau-but any basic stats package should have this sort of test.

**@BruceET

Yes, it is fake data, but in saying that the responses will be weighted towards old age brackets

So I understand using chi-squared will give me an overall look

But I also want to look at the individual parts.

For example is there a colour that is being answered lower or higher in an age bracket, and is the difference statistically significant

The information you touched on regarding Pearson residuals interests me

So in the original table I can see blue is lower for 35-54, with only three responses but is it a statistically significant difference, compared to the number of people in other age groups that selected blue?

Does the value you provide here of -15.17 define this?

I have put together some real data, demographic across the top, answer on the left

I want to identify if any answers are significantly higher or lower than expected

For example there seems to be a high number of 66-80 who have selected Q10 01, but is this significant?

Thanks Toby