title: Multiple regression to extract the coefficients, intercept and R-Squared
body: <p>Could anyone please tell me how to extract the coefficients, intercept and R-Squared using VBA from the table below? </p>
  
  <pre><code>X     y       z
  1     2000    40000
  2     2100    3433
  3     2111    4333
  4     2122    2133
  5     3988    2311
  6     1232    2311
  7     1211    4322
  1     2343    2121
  2     2112    2222
  3     2543    2111
  4     3211    2321
  5     2322    1114
  6     2133    1223
  7     3455    4698  
  </code></pre>
  
  <p>Note (<code>X</code> and <code>y</code>) are the known variables and <code>z</code> the unknown. I have been able to do it in R but can't seem to replicate the idea with VBA.  </p>
  
  <p>(<em>Transferred from Comments</em>) This is the result of the same problem in R Coefficients:  </p>
  
  <pre><code>Estimate Std. Error t value Pr(&gt;|t|) (Intercept) -4949.5047 956.9503 -5.172 6.08e-06
  KA$DaysMon -288.6500 223.8454 -1.290 0.204279
  KA$DaysSat  837.1536 229.3117  3.651 0.000718
  KA$DaysSun -797.0467 241.3208 -3.303 0.001961
  KA$DaysThu -415.5882 227.5814 -1.826 0.074949
  KA$DaysTue  158.6132 225.7859  0.702 0.486247
  KA$DaysWed  125.3746 237.8353  0.527 0.600864
  KA$P.Avail    1.4648   0.1623  9.025 2.19e-11
  </code></pre>