Solved

Is there a formula for simple linear regression

Posted on 2011-09-09
9
360 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 500 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
Independent Software Vendors: 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!

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
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…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

749 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