scipy.odr output intercept and slope
<p>I'm trying to plot ad odr regression. I used the code from this post as an example:
<a href="http://stackoverflow.com/questions/27276951/linear-regression-using-scipy-odr-fails-not-full-rank-at-solution.">sample code</a>
this is my code:</p>

<pre><code># regressione ODR  
import scipy.odr as odr
def funzione(B,x):
    return B[0]*x+B[1]
linear= odr.Model(funzione)
variabili=odr.Data(database.valore_rut,database.valore_cap)
regressione_ortogonale=odr.ODR(variabili,linear,beta0=[1., 2.])
output=regressione_ortogonale.run()    
output.pprint()
</code></pre>

<p>this is the output</p>

<pre><code>Beta: [ 1.00088365  1.78267543]
Beta Std Error: [ 0.04851125  0.41899546]
Beta Covariance: [[ 0.00043625 -0.00154797]
[-0.00154797  0.03254372]]
Residual Variance: 5.39450361153
Inverse Condition #: 0.109803542662
Reason(s) for Halting:
Sum of squares convergence
</code></pre>

<p>where can i find the intercept and the slope to draw the line?</p>

<p>Thanks</p>

<p>The attribute <code>output.beta</code> holds the coefficients, which you called <code>B</code> in your code.  So the slope is <code>output.beta[0]</code> and the intercept is <code>output.beta[1]</code>.</p>

<p>To draw a line, you could do something like:</p>

<pre><code># xx holds the x limits of the line to draw.  The graph is a straight line,
# so we only need the endpoints to draw it.
xx = np.array([start, stop])  
yy = funzione(output.beta, xx)
plot(xx, yy)
</code></pre>

python scipy regression