ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How to use Excel to do likelihood ratio chi-squared test? (https://www.excelbanter.com/excel-worksheet-functions/130221-how-use-excel-do-likelihood-ratio-chi-squared-test.html)

Michael

How to use Excel to do likelihood ratio chi-squared test?
 
How to use Excel to do likelihood ratio chi-squared test?
I know I can use the "Chitest" function to do chi-squared test, but I have
no idea how to do likelihood ratio test using Exel functions.

ExcelBanter AI

Answer: How to use Excel to do likelihood ratio chi-squared test?
 
  1. First, calculate the log-likelihood of the null model and the alternative model. The null model is the model with fewer parameters, while the alternative model is the model with more parameters. You can use Excel's built-in functions to calculate the log-likelihoods.
  2. Next, calculate the test statistic, which is twice the difference between the log-likelihoods of the two models. You can do this by subtracting the log-likelihood of the null model from the log-likelihood of the alternative model, multiplying the result by -2, and storing it in a cell.
  3. Determine the degrees of freedom for the test. This is equal to the difference in the number of parameters between the null and alternative models.
  4. Finally, use Excel's built-in CHISQ.DIST.RT function to calculate the p-value for the test. This function takes the test statistic and degrees of freedom as inputs and returns the probability of obtaining a value as extreme or more extreme than the observed test statistic under the null hypothesis.

    Here's an example of how to perform a likelihood ratio chi-squared test in Excel:

    Suppose you have two models for predicting the probability of a customer buying a product: Model 1 includes only the customer's age as a predictor, while Model 2 includes both age and income. You want to test whether the addition of income to the model significantly improves its fit.

    1. Calculate the log-likelihoods of the two models. Let's say the log-likelihood of Model 1 is -100 and the log-likelihood of Model 2 is -90.

    2. Calculate the test statistic. The difference between the log-likelihoods is -10, so twice this value is 20. Multiply by -2 to get the test statistic, which is 40.

    3. Determine the degrees of freedom. Model 2 has one more parameter than Model 1 (income), so the degrees of freedom for the test are 1.

    4. Use the CHISQ.DIST.RT function to calculate the p-value. In a cell, enter "=CHISQ.DIST.RT(40,1)" (without the quotes). This will return the p-value for the test, which is approximately 2.2e-10 (very small).

    Based on this result, you can reject the null hypothesis that Model 1 is a better fit for the data than Model 2, and conclude that the addition of income to the model significantly improves its fit.

Jerry W. Lewis

How to use Excel to do likelihood ratio chi-squared test?
 
In general, Chi-square for the LRT is an asymptotic approximation
http://en.wikipedia.org/wiki/Likelihood_ratio_test

Using the information at that link, you can calculate the LRT and then use
CHIDIST to evaluate its significance.

Jerry

"Michael" wrote:

How to use Excel to do likelihood ratio chi-squared test?
I know I can use the "Chitest" function to do chi-squared test, but I have
no idea how to do likelihood ratio test using Exel functions.



All times are GMT +1. The time now is 07:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com