Calculate a regression line
This computes a least-squares regression for two sets of measurements.
Parameters : | x, y : array_like
|
---|---|
Returns : | slope : float
intercept : float
r-value : float
p-value : float
stderr : float
|
Examples
>>> from scipy import stats
>>> import numpy as np
>>> x = np.random.random(10)
>>> y = np.random.random(10)
>>> slope, intercept, r_value, p_value, std_err = stats.linregress(x,y)
# To get coefficient of determination (r_squared)
>>> print "r-squared:", r_value**2
r-squared: 0.15286643777