y = rpois(100,10);
out = generalized_poisson_likelihood(y);
if(out$mark == 1)
{
chisq_out = calc_chisq_statistic(y,out$lambda,out$theta);
}
#Check for Goodness of Fit of Generalized Poisson Model
if(chisq_out$mark1 == 1)
{
cat("Degree of Freedom = ",chisq_out$df1," Chi Square Statistic = ",chisq_out$chisq1,"\n");
}
#Check for Goodness of FIt of Poisson Model
if(chisq_out$mark2 == 1)
{
cat("Degree of Freedom = ",chisq_out$df2," Chi Square Statistic = ",chisq_out$chisq2,"\n");
}
Run the code above in your browser using DataLab