# ChiSquaredTest expected values

David Klapheck shared this idea 1 year ago
Under Consideration

When using ChiSquaredTest( <Matrix> ), one should always check the expected value to determine the accuracy of approximation with the t-distribution. So can you add an optional parameter to this command to see the expected matrix?

Perhaps something like ChiSquaredTest( <Observed Matrix> , <string> ), where <Observed Matrix> is a matrix of observed counts and <string> is a valid name that will store the matrix of expected counts determined by the hypothesis of independence/homogeneity.

I know that one can see this matrix in probability view, but it is not formatted in a way that can easily be copied or displayed compactly. If there is a way to export the expected matrix easily please let me know.

1

Please can you give an example to help understand what you want? ie example input and output

1

Sure. In Graphing or CAS calculator.

Say I am running a homogeneity/independence test on {{10, 7, 10}, {10, 0, 10}, {10, 7, 10}}.

Input: ChiSquaredTest({{10, 7, 10}, {10, 0, 10}, {10, 7, 10}})

Desired output: { 0.17152,6.39506, M1={{10.9459, 5.1081, 10.9459}, {8.1081, 3.7838, 8.1081}, {10.9459, 5.1081, 10.9459}} }

So that later when I input M1, I get {{10.9459, 5.1081, 10.9459}, {8.1081, 3.7838, 8.1081}, {10.9459, 5.1081, 10.9459}}

Or if I input ChiSquaredTest({{10, 7, 10}, {10, 0, 10}, {10, 7, 10}},ExpectedCounts)

I get output { 0.17152,6.39506, ExpectedCounts={{10.9459, 5.1081, 10.9459}, {8.1081, 3.7838, 8.1081}, {10.9459, 5.1081, 10.9459}} }

I am not sure if naming one of the outputs is doable, but if it is that would be appreciated.

Alternatively another function could work. So my students could see something like,

Input: M1=Independence( {{10, 7, 10}, {10, 0, 10}, {10, 7, 10}} )

Output: {{10.9459, 5.1081, 10.9459}, {8.1081, 3.7838, 8.1081}, {10.9459, 5.1081, 10.9459}}

So they know that the chi-squared test could give inaccurate results because some of the expected counts are small.