Regression Coefficients

excelV

New Member
Joined
Mar 19, 2011
Messages
8
I'm trying to build a macro with regression statistics for multivariables. I tried "recording" the regression button from data analysis and manipulating the code but continuously keep getting errors.

All I need are the coefficients so I can build an equation for new data. I need to do this almost 1000 times so I need to know an efficient way to do this.

I would really appreciate it if someone can help me out, thanks!
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Are you using the LinEst function ? - maybe post your code - is this a multivariate space or just a single array of X values - you said Coefficeents in pural - so sounds like you have several. Maybe post a sample sample set with the Y and Xs columns.
 
Upvote 0
No I am not familiar with the LinEst function, does it calculate the coefficients?

Yes I have one Y variable and two X variables




Date Y X1 X2
10/19/2007 0.046061508 0.045923219 0.064031621
10/23/2007 0.048873358 0.046061508 0.045923219
10/24/2007 0.048647755 0.048873358 0.046061508
11/2/2007 0.045373488 0.048647755 0.048873358
11/29/2007 0.047717659 0.045373488 0.048647755
 
Upvote 0
Code:
      ----A----- ---B--- ---C--- ---D--- ---E--- F G ---H---- ---I---- ---J---
  1      Date       Y      X1      X2      Fit                                
  2   10/19/2007 0.04606 0.04592 0.06403 0.04573     -0.15101 -0.38699 0.07317
  3   10/23/2007 0.04887 0.04606 0.04592 0.04841                              
  4   10/24/2007 0.04865 0.04887 0.04606 0.04730                              
  5   11/2/2007  0.04537 0.04865 0.04887 0.04696                              
  6   11/29/2007 0.04772 0.04537 0.04865 0.04827

The array formula in H2:J2 is

=LINEST(B2:B6, C2:D6)

The formula in E2 and own is

=$H$2*D2 + $I$2*C2 + $J$2
 
Upvote 0
If you look at help for LinEst - you will see you can set the stats to True - this gives you F-Constants - RSQ, SEE and so on - not sure if you just want coef
 
Upvote 0

Forum statistics

Threads
1,224,597
Messages
6,179,813
Members
452,945
Latest member
Bib195

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top