## simple linear regression

This is the place for queries that don't fit in any of the other categories.

### simple linear regression

Write a program that calculates the equation of a straight line that best fits a given set of data points.

Inputs:n number of data points {xi,yi}, where i = 1, 2,…, n.

Outputs:The equation of the straight line that best fits to the given set of data points:
y=ax+b
where a is the slope of the line, and b is the intercept. The square of the correlation coefficient, r2.

Hint: Use simple linear regression.
tolgaa

Posts: 2
Joined: Sun Apr 07, 2013 9:45 am

### Re: simple linear regression

Hi,

You forgot to add the code you have created so far and which part of it is going you a problem.
http://python-forum.org/viewtopic.php?f=6&t=145
Due to the reasons discussed here we will be moving to python-forum.io/ on October 1 2016
This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.

Yoriz

Posts: 1672
Joined: Fri Feb 08, 2013 1:35 am
Location: UK

### Re: simple linear regression

tolgaa wrote:Write a program that calculates the equation of a straight line that best fits a given set of data points.

Inputs:n number of data points {xi,yi}, where i = 1, 2,…, n.

Outputs:The equation of the straight line that best fits to the given set of data points:
y=ax+b
where a is the slope of the line, and b is the intercept. The square of the correlation coefficient, r2.

Hint: Use simple linear regression.

Quoted for reference
Due to the reasons discussed here we are moving to python-forum.net on October 1, 2016.

This forum will be closed. Please create an account at the new site to continue discussion.

IRC://irc.freenode.net/python-forum
Kebap

Posts: 689
Joined: Thu Apr 04, 2013 1:17 pm
Location: Germany, Europe