'Why the p-value of my poisson regression model always very small?
I was trying to do some data analysis with youtube data and realized that since my dependent variable is the count of comments, I probably should use generalized linear regression with poisson family. However, it turns out that no matter what independent variable I input, the p-value(I suppose the P>|z| stands for p-value, am I wrong?) of the result will always be 0.000. Then I tried inputting random variables with the code below:
import pandas as pd
import numpy as np
import statsmodels.api as sm
y = df.commentCount
X = pd.DataFrame(np.random.randint(0,842,842))
X.index = df.commentCount.index
mod = sm.GLM(y,sm.add_constant(X),family=sm.families.Poisson())
res = mod.fit()
print(res.summary())
and the p-value again was 0.000.
Generalized Linear Model Regression Results
==============================================================================
Dep. Variable: commentCount No. Observations: 842
Model: GLM Df Residuals: 840
Model Family: Poisson Df Model: 1
Link Function: Log Scale: 1.0000
Method: IRLS Log-Likelihood: -3.0215e+05
Date: Tue, 29 Mar 2022 Deviance: 5.9785e+05
Time: 13:26:59 Pearson chi2: 9.07e+05
No. Iterations: 5 Pseudo R-squ. (CS): 0.5477
Covariance Type: nonrobust
==============================================================================
coef std err z P>|z| [0.025 0.975]
------------------------------------------------------------------------------
const 6.4723 0.003 2338.759 0.000 6.467 6.478
0 -0.0001 5.69e-06 -25.847 0.000 -0.000 -0.000
==============================================================================
What's wrong with my code?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
