Skip to main content
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
Source Link

Summary of whuber's answeranswer with J. M's comment with another example data of 3x2 matrix about

data = {{58, 35}, {11, 25}, {10, 23}}; 
rc = {{"agree", "neutral", "disgaree"}, {"men", "women"}};
TableForm[data, TableHeadings -> rc]
fit = Outer[Times, Total[data, {2}], Total[data]]/Total[data, 2];
TableForm[fit // N, TableHeadings -> rc]
residual = data - fit;
TableForm[residual // N, TableHeadings -> rc]
\[Chi]2array = residual^2/fit;
TableForm[\[Chi]2array // N, TableHeadings -> rc]
\[Chi]2 = Total[\[Chi]2array, 2];
\[Chi]2 // N
df = (Times @@ # - Total[#] + 1) &[Dimensions[data]]; 
1 - CDF[ChiSquareDistribution[df], \[Chi]2] // N

Summary of whuber's answer with J. M's comment with another example data of 3x2 matrix about

data = {{58, 35}, {11, 25}, {10, 23}}; 
rc = {{"agree", "neutral", "disgaree"}, {"men", "women"}};
TableForm[data, TableHeadings -> rc]
fit = Outer[Times, Total[data, {2}], Total[data]]/Total[data, 2];
TableForm[fit // N, TableHeadings -> rc]
residual = data - fit;
TableForm[residual // N, TableHeadings -> rc]
\[Chi]2array = residual^2/fit;
TableForm[\[Chi]2array // N, TableHeadings -> rc]
\[Chi]2 = Total[\[Chi]2array, 2];
\[Chi]2 // N
df = (Times @@ # - Total[#] + 1) &[Dimensions[data]]; 
1 - CDF[ChiSquareDistribution[df], \[Chi]2] // N

Summary of whuber's answer with J. M's comment with another example data of 3x2 matrix about

data = {{58, 35}, {11, 25}, {10, 23}}; 
rc = {{"agree", "neutral", "disgaree"}, {"men", "women"}};
TableForm[data, TableHeadings -> rc]
fit = Outer[Times, Total[data, {2}], Total[data]]/Total[data, 2];
TableForm[fit // N, TableHeadings -> rc]
residual = data - fit;
TableForm[residual // N, TableHeadings -> rc]
\[Chi]2array = residual^2/fit;
TableForm[\[Chi]2array // N, TableHeadings -> rc]
\[Chi]2 = Total[\[Chi]2array, 2];
\[Chi]2 // N
df = (Times @@ # - Total[#] + 1) &[Dimensions[data]]; 
1 - CDF[ChiSquareDistribution[df], \[Chi]2] // N
Source Link

Summary of whuber's answer with J. M's comment with another example data of 3x2 matrix about

data = {{58, 35}, {11, 25}, {10, 23}}; 
rc = {{"agree", "neutral", "disgaree"}, {"men", "women"}};
TableForm[data, TableHeadings -> rc]
fit = Outer[Times, Total[data, {2}], Total[data]]/Total[data, 2];
TableForm[fit // N, TableHeadings -> rc]
residual = data - fit;
TableForm[residual // N, TableHeadings -> rc]
\[Chi]2array = residual^2/fit;
TableForm[\[Chi]2array // N, TableHeadings -> rc]
\[Chi]2 = Total[\[Chi]2array, 2];
\[Chi]2 // N
df = (Times @@ # - Total[#] + 1) &[Dimensions[data]]; 
1 - CDF[ChiSquareDistribution[df], \[Chi]2] // N
Post Made Community Wiki by Léo Léopold Hertz 준영