Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Is there a formula for simple linear regression

Posted on 2011-09-09
9
Medium Priority
?
372 Views
Last Modified: 2012-05-12
I have two columns data like below
A        B
1.2     0.518
4.6     0.776
5.6     0.805

3.8       ?(should be between 0.518 and 0.776, any formula I can use?)

Now I want to calculate data B when A = 3.8 and suppose it is linear relation
0
Comment
Question by:jjxia2001
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
9 Comments
 
LVL 24

Accepted Solution

by:
StephenJR earned 2000 total points
ID: 36512900
If 3.8 is in A4 then I think this works

=B1+(A4-A1)/(A2-A1)*(B2-B1)

Btw this is interpolation, not regression.
0
 

Author Comment

by:jjxia2001
ID: 36512943
I used the similar formula, but I want to know if there is a function built inside Excel that I can use.
0
 
LVL 24

Expert Comment

by:StephenJR
ID: 36512962
Nothing built in.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 50

Expert Comment

by:barry houdini
ID: 36513134
of course that formula assumes that you already know that 3.8 falls between A1 and A2. If that you need the formula to work unaltered for other values, e.g. if A4 = 4.8 then you can use this formula

=FORECAST(A4,OFFSET(B1:B3,MATCH(A4,A1:A3)-1,0,2,1),OFFSET(A1:A3,MATCH(A4,A1:A3)-1,0,2,1))

A4 must be >=A1 and < A3

regards, barry
0
 
LVL 81

Expert Comment

by:byundt
ID: 36513139
Is there a function built into Excel? Of course there is--the TREND function. You use like this:
=TREND(B2:B4,A2:A4,D2)
=TREND(KnownX, KnownY, NewX)         returns Predicted Y

TREND does a linear regression to make its prediction, and can handle more than one X variable if necessary.
TrendFunctionQ27300562.xlsx
0
 

Author Comment

by:jjxia2001
ID: 36513178
This is great! This is what I'm looking for!  
0
 
LVL 81

Expert Comment

by:byundt
ID: 36513204
I misspoke. The format for TREND is:
=TREND(KnownY, KnownX, NewX)         returns Predicted Y

The sample workbook and suggested formula with addresses were both correct, however.
0
 
LVL 50

Expert Comment

by:barry houdini
ID: 36513222
Hi Brad,

Surely TREND doesn't give your linear interpolation (unless the known Xs and known Ys are only 2 value ranges)? If you use 4.6 in D2, i.e. one of the A2:A4 values then wouldn't you expect the result to be the corresponding B2:B4 value, i.e. 0.776 - with TREND you get 0.754

For the original sample you can also use LOOKUP for linear interpolation, i.e. this will do the same as the FORECAST function I posted

=LOOKUP(A4,A1:A2,B1:B2+(B2:B3-B1:B2)*(A4-A1:A2)/(A2:A3-A1:A2))

regards, barry
0
 
LVL 50

Expert Comment

by:barry houdini
ID: 36513410
See attached file which demonstrates the different results obtained. There are random X and Y values in A2:B9 and (mostly) random "lookup values" in D2:D6. Press F9 key to re-generate random numbers

regards, barry
interpolation.xlsx
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question