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

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/genpseq.R

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

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
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");
}
 

Example output

Degree of Freedom =  6  Chi Square Statistic =  20.49612 
Degree of Freedom =  7  Chi Square Statistic =  21.36744 

GPseq documentation built on May 30, 2017, 3:11 a.m.