I have a GLM model which has a quadratic term and looks like this.
glm(formula = tumor_count ~ exp_val + I(exp_val^2),
family = "poisson",
data = x)
tumor_count is the number of tumor cells in a region of tissue and exp_val is average expression of a gene in that region of a tissue.
While the tumor_count is represented as the dependent variable (is a counts data 0, 1... and so on) and the independent variable exp_val is a numeric value (which could be fraction or a normalized value > 1 like counts per millions)
I am doing this for multiple genes.
I am getting the following error when I tried the ideas presented here glm in R - which pvalue represents the goodness of fit of entire model?
When I do this I get the following error :
pchisq(
summary(count_glm_model$HOXA9)$deviance-
summary(count_glm_model$HOXA9)$null.deviance,
summary(count_glm_model$HOXA9)$df.residual-
summary(count_glm_model$HOXA9)$df.null,
lower.tail=FALSE)
[1] NaN
Warning message:
In pchisq(summary(count_glm_model$HOXA9)$deviance -
summary(count_glm_model$HOXA9)$null.deviance, :
NaNs produced
I was wondering what I am doing wrong and how can I get a p-value defining the fit of the model?