Hi, I think I'm late with the answer for 5 years, mb it will be useful for others.. I faced the same problem as you, my python didn't want to work with error "cannot reshape 9805 to size (1961,1) while I wanted to give 5 variables with following code:
KernelReg(X_train_new_1['goal1'], X_train_new_1[['field1','field12','field14','field16','field25']], 'c')
where y = X_train_new_1['goal1']
X = X_train_new_1[['field1','field12','field14','field16','field25']]
y.shape = 1961 (observations)
X.shape = (1961, 5) (5 variables of 1961 obs)
I was surprised, when I found that problem was in the third positional argument var_type. Because I wanted to pass 5 variables I should give as a var_type the list of types of vars for each varible, for example:
KernelReg(X_train_new_1['goal1'], X_train_new_1[['field1','field12','field14','field16','field25']], var_type = ['c', 'c', 'c', 'c', 'c'])
or
KernelReg(X_train_new_1['goal1'], X_train_new_1[['field1','field12','field14','field16','field25']], var_type = ['c', 'u', 'c', 'o', 'c'])
I think the main problem in using statsmodels is poor documentation
пятница, 7 марта 2014 г., 14:48:46 UTC+4 пользователь David Montgomery написал: