title: How is the p value calculated for multiple variables in linear regression?
body: <p><a href="https://i.stack.imgur.com/O6Vhq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/O6Vhq.png" alt="enter image description here"></a></p>
  
  <p>I am wondering how the p value is calculated for various variables in a multiple linear regression. I am sure upon reading several resources that &lt;5% indicates the variable is significant for the model. But how is the p value calculated for each and every variable in the multiple linear regression?</p>
  
  <p>I tried to see the statsmodels summary using the summary() function. I can just see the values. I didn't find any resource on how p value for various variables in a multiple linear regression is calculated.</p>
  
  <pre><code>import statsmodels.api as sm
  nsample = 100
  x = np.linspace(0, 10, 100)
  X = np.column_stack((x, x**2))
  beta = np.array([1, 0.1, 10])
  e = np.random.normal(size=nsample)
  X = sm.add_constant(X)
  y = np.dot(X, beta) + e
  model = sm.OLS(y, X)
  results = model.fit() 
  print(results.summary())
  </code></pre>
  
  <p>This question has no error but requires an intuition on how p value is calculated for various variables in a multiple linear regression.</p>