I have generalized gamma distribution with the following equation:

$$ f(x) = \frac{\lambda^{a\tau}\tau x^{a\tau - 1}}{\Gamma(a)}e^ {{(x\lambda)}^\tau} $$

and log-likelihood function

$$ l(a, \lambda, \tau) = a \tau n \log{\lambda} + n \log{\tau} - n \log{\Gamma(a)} + (a \tau - 1) \displaystyle\sum_{i=1}^{n} \log{x_i} - \lambda^\tau \displaystyle\sum_{i=1}^{n} x^\tau_i $$

I have several related questions in two topics. I want to test the hypothesis $ H_0: \tau = 1 $ vs. $ H_1: \tau \neq 1 $. I also have to generate the distribution of the test statistic when $ H_0 $ holds (question regarding this has been moved to another topic).

By my understanding, Wilks lambda (the test statistic) in this case should be:

$$ \lambda = 2 (l(\hat{a}, \hat{\lambda}, \hat{\tau}) - l(\tilde{a}, \tilde{\lambda}, 1)) = \\ 2 ( \hat{a} \hat{\tau} n \log{\hat{\lambda}} + n \log{\hat{\tau}} - n \log{\Gamma(\hat{a})} + (\hat{a} \hat{\tau} - 1) \displaystyle\sum_{i=1}^{n} \log{x_i} - \hat{\lambda}^{\hat{\tau}} \displaystyle\sum_{i=1}^{n} x^{\hat{\tau}}_i \\ - \tilde{a} n \log{\tilde{\lambda}} - n \log{\Gamma(\tilde{a})} + (\tilde{a} - 1) \displaystyle\sum_{i=1}^{n} \log{x_i} - \tilde{\lambda} \displaystyle\sum_{i=1}^{n} x_i ) $$

My question now is, is this correct? Is the Wilks statistic for generalized gamma distribution in this case surely chi-square distributed (and if not, why not?)? I am asking, because I am trying to generate the distribution of this statistic under the null hypothesis and I am not getting chi-square distribution (see another topic).

  • $\begingroup$ Can you explain what makes you say you're doing something wrong? Please note that we are not a code review site; the question needs to be clearly seeking advice on an issue of statistical expertise rather than whether you correctly coded the resulting algorithm (i.e. if your question is just "what's wrong with my code" it will almost certainly be off topic on several grounds). Please clearly explain what you're trying to do rather than leave us to infer it from your code (which may not correctly convey what you were trying to achieve, since it conflates intent with attempted implementation). $\endgroup$ – Glen_b Jul 31 '18 at 2:34
  • $\begingroup$ While identifying implementation bugs in code is off topic, general strategies should be fairly obvious (indeed standard), such as careful testing of the components (e.g. make sure your MLEs are actually maximizing the likelihood -- that it's converging to a global maximum even in the tough cases), and so forth. Note that it might possible be the case that everything is correct - you're finding MLEs, you're computing the statistic correctly and so on, but the sample size is not large enough (I don't think that's it but we can't rule it out yet). $\endgroup$ – Glen_b Jul 31 '18 at 3:32
  • $\begingroup$ One suggestion would be to use your program to work on a simpler problem (maybe an ordinary gamma) and see that it works in that case. If that works it limits the places you can have a mistake, and if it doesn't the mistake for a simpler case will be easier to identify. You might also try swapping some components for an alternative way of doing the same thing; if that changes the outcome substantively it's a likely source of your problem. $\endgroup$ – Glen_b Jul 31 '18 at 3:34
  • $\begingroup$ I've currently closed as too broad but it could as easily have closed for other reasons (unclear -- since you don't say why you think it's wrong, or off-topic as what appears to be a 'what's wrong with my implementation' question). Please take the opportunity to edit/refocus the question. $\endgroup$ – Glen_b Jul 31 '18 at 3:38
  • $\begingroup$ @Glen_b Thank you for your suggestions. I added some clarifications and answers to your suggestions. If you think that I should ask this somewhere else, could you please direct me to appropriate site? $\endgroup$ – hippocampus Jul 31 '18 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.