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
Solved

Is there a formula for simple linear regression

Posted on 2011-09-09
9
355 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
  • 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
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…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

856 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