Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 1

statsmodels.sandbox.sysreg.sur

Hi,

 

I am getting Error in while coding for Seemingly unrelated regressions using statsmodels.sandbox.sysreg.sur.

 

Please help me

 

 

import pandas as pd
import numpy as np
import statsmodels.api as sm
from statsmodels.sandbox.sysreg import SUR
df = pd.read_stata("C:/Users/203674/Desktop/10219/WD/FRINGE.dta")
df['const']=1

endog = df[['hrearn','vacdays', 'sicklve', 'insur', 'pension']]
exog = df[['educ','tenure','tenuresq','union','exper','expersq',
           'south','nrtheast','nrthcen','married','white', 'male','const']]
sys = [endog,exog]
reg1 = SUR(sys).fit

ValueError Traceback (most recent call last)
in 
1 #Regression Equation (1) on data files named as NSL80
2
----> 3 reg1 = SUR(sys).fit

E:\Local\Anaconda\lib\site-packages\statsmodels\sandbox\sysreg.py in init(self, sys, sigma, dfk)
109 self.exog = exog # 2d ndarray exog is better
110 # Endog, might just go ahead and reshape this?
--> 111 endog = np.asarray(sys[::2])
112 self.endog = endog
113 self.nobs = float(self.endog[0].shape[0]) # assumes all the same length

E:\Local\Anaconda\lib\site-packages\numpy\core\numeric.py in asarray(a, dtype, order)
536
537 """
--> 538 return array(a, dtype, copy=False, order=order)
539
540

ValueError: cannot copy sequence with size 616 to array axis with dimension 5

 

Date files and code zipped here...

https://github.com/axonrope/axon/files/3226042/10219-7-8P.2.zip