2016-09-14 2 views
0

광고 회귀 분석을 계획하려고합니다. 이 출력 내가 절편과 선을 그어야하는 경사를 찾을 수 있습니다scipy.odr 출력 절편과 기울기

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 

에게 있습니다

# 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() 

: sample code 이 내 코드입니다 : 내가 예를 들어이 게시물의 코드를 사용 ?

감사

답변

0

output.beta이 코드에서 B라고 계수를 보유 속성. 따라서 기울기는 output.beta[0]이고 요격은 output.beta[1]입니다.

# 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) 
:

선을 그리려면처럼 뭔가를 할 수