【发布时间】:2016-03-28 21:41:40
【问题描述】:
我在 python 中将数据作为 x 和 y 变量存储为列表。我如何将它导入 python 以通过 statsmodels 运行。
from __future__ import print_function
import statsmodels.api as sm
import statsmodels.formula.api as smf
import pandas as pd
x = [1,1,2,3]
y=[1,0,0,0]
data = pd.DataFrame(x,y) #to merge the two side by side
star98 = sm.datasets.star98.load_pandas().data
formula = 'x ~ y'
pd.options.mode.chained_assignment = None # default='warn'
mod1 = smf.glm(formula=formula, data=data, family=sm.families.Binomial()).fit()
x = mod1.summary()
ValueError:对偏差函数的第一次猜测返回了一个 nan。这可能是一个边界问题,应该报告
【问题讨论】:
标签: python statistics statsmodels