R: Calculate Chi-square goodness of fit Statistic for...

calc_chisq_statistic {GPseq} | R Documentation

## Calculate Chi-square goodness of fit Statistic for Generalized Poisson and Poisson Models.

### Description

This function calculates the Chi-Square goodness of fit statistic for how well the input data fit a Generalized Poisson Model with given parameters theta and lambda and fit a Poisson Model with the MLE as the value for lambda.

### Usage

    calc_chisq_statistic(x, lambda, theta)

### Arguments

`x` | This is the vector of observations or counts
`lambda` | This is lambda for the Generalized Poisson Model
`theta` | This is theta for the Generalized Poisson Model

### Value

`mark1` | The Chi-Square test for the Generalized Poisson Model is valid only if mark1 = 1
`mark2` | The Chi-Square goodness of fit test for the Poisson model is valid only if mark2 = 1.
`df1` | Degrees of freedom for the chi-square statistic for the fit to the Generalized Poisson Model
`df2` | Degrees of freedom for the chi-square statistic for the fit to the Poisson Model
`chisq1` | Chi Square statistic for the fit to the Generalized Poisson Model
`chisq2` | Chi Square Statistic for the fit to the Poisson Model

### Author(s)

Sudeep Srivastava, Liang Chen

### References

Consul, P. C. (1989) Generalized Poisson Distributions: Properties and Applications. New York: Marcel Dekker.
Sudeep Srivastava, Liang Chen A two-parameter generalized Poisson model to improve the analysis of RNA-Seq data Nucleic Acids Research Advance Access published July 29,2010 doi : 10.1093/nar/gkq670

### See Also

`generalized_poisson_likelihood`

### Examples

    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");
    }

[Package GPseq version 0.5 Index]