A t-test is used to compare means between two groups, while a chi-square test is used to determine if there is a relationship between two categorical variables. The key difference is in the type of data being analyzed - t-tests are for continuous data, while chi-square tests are for categorical data. This impacts their applications as t-tests are used for comparing means, such as in experiments with control and experimental groups, while chi-square tests are used for analyzing relationships, such as in surveys or contingency tables.
Chi-square is a statistic used to assess the degree of the relationship and degree of association between two nominal variables
For goodness of fit test using Chisquare test, Expected frequency = Total number of observations * theoretical probability specified or Expected frequency = Total number of observations / Number of categories if theoretical frequencies are not given. For contingency tables (test for independence) Expected frequency = (Row total * Column total) / Grand total for each cell