当前位置: 首页>>代码示例>>Python>>正文


Python regressionplots.abline_plot函数代码示例

本文整理汇总了Python中statsmodels.graphics.regressionplots.abline_plot函数的典型用法代码示例。如果您正苦于以下问题:Python abline_plot函数的具体用法?Python abline_plot怎么用?Python abline_plot使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了abline_plot函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_abline_remove

 def test_abline_remove(self, close_figures):
     mod = self.mod
     intercept, slope = mod.params
     fig = plt.figure()
     ax = fig.add_subplot(111)
     ax.scatter(self.X[:,1], self.y)
     abline_plot(intercept=intercept, slope=slope, ax=ax)
     abline_plot(intercept=intercept, slope=2*slope, ax=ax)
     lines = ax.get_lines()
     lines.pop(0).remove()
     close_or_save(pdf, fig)
开发者ID:ChadFulton,项目名称:statsmodels,代码行数:11,代码来源:test_regressionplots.py

示例2: plot_scatter_and_line

 def plot_scatter_and_line(self, result):
     '''(d)(f)'''
     fig = plt.figure()
     ax = fig.add_subplot(111)
     ax.scatter(self.x, self.y, c='w')
     ax.set_ylabel("y")
     ax.set_xlabel("x")
     rp.abline_plot(intercept=-1, slope=0.5, ax=ax, c='r', label="model fit")
     rp.abline_plot(model_results=result, ax=ax, c='g', label="pop.regression")
     plt.legend(loc='lower right', shadow=True, fontsize='medium')
     plt.show()
开发者ID:Aran00,项目名称:ISIRExerciseCode,代码行数:11,代码来源:Exec13.py

示例3: simple_regession

    def simple_regession(self):
        ''' The answer of exercise03-08:
        (a)
            (i)  Yes, from F-stat
            (ii) Explain it from RSE and R^2 stat
            (iii)negative
            (iv) Code, no prediction interval
        (b) Code
        (c) Residual/fitted: non-linearity
        '''

        # model = smf.ols(formula="mpg ~ horsepower", data=self.df)
        y = self.df['mpg']
        X = self.df[['horsepower']]
        X = sm.add_constant(X)
        print X
        res = sm.OLS(y, X).fit()
        # res = model.fit()
        print res.summary()

        print "The prediction is: ", res.predict(exog=[[1, 98]])
        print "The prediction interval is: "

        '''
        self.df.plot(kind="scatter", x='horsepower', y='mpg', c='w')
        graph_x = np.linspace(min(self.df['horsepower']), 200)
        graph_y = res.predict(sm.add_constant(graph_x))
        plt.plot(graph_x, graph_y)
        '''
        fig = rp.abline_plot(model_results=res)
        ax = fig.axes[0]
        ax.scatter(X['horsepower'], y, c='w')
        plt.show()
        lrplot.plot_R_graphs(res)
开发者ID:Aran00,项目名称:ISIRExerciseCode,代码行数:34,代码来源:Exec08.py

示例4: test_abline_ab_ax

 def test_abline_ab_ax(self):
     mod = self.mod
     intercept, slope = mod.params
     fig = plt.figure()
     ax = fig.add_subplot(111)
     ax.scatter(self.X[:,1], self.y)
     fig = abline_plot(intercept=intercept, slope=slope, ax=ax)
     plt.close(fig)
开发者ID:AnaMP,项目名称:statsmodels,代码行数:8,代码来源:test_regressionplots.py

示例5: test_abline_ab

 def test_abline_ab(self):
     mod = self.mod
     intercept, slope = mod.params
     fig = abline_plot(intercept=intercept, slope=slope)
     plt.close(fig)
开发者ID:AnaMP,项目名称:statsmodels,代码行数:5,代码来源:test_regressionplots.py

示例6: test_abline_model_ax

 def test_abline_model_ax(self):
     fig = plt.figure()
     ax = fig.add_subplot(111)
     ax.scatter(self.X[:,1], self.y)
     fig = abline_plot(model_results=self.mod, ax=ax)
     plt.close(fig)
开发者ID:AnaMP,项目名称:statsmodels,代码行数:6,代码来源:test_regressionplots.py

示例7: test_abline_model

 def test_abline_model(self):
     fig = abline_plot(model_results=self.mod)
     ax = fig.axes[0]
     ax.scatter(self.X[:,1], self.y)
     plt.close(fig)
开发者ID:AnaMP,项目名称:statsmodels,代码行数:5,代码来源:test_regressionplots.py

示例8: test_abline_ab

 def test_abline_ab(self, close_figures):
     mod = self.mod
     intercept, slope = mod.params
     fig = abline_plot(intercept=intercept, slope=slope)
     close_or_save(pdf, fig)
开发者ID:ChadFulton,项目名称:statsmodels,代码行数:5,代码来源:test_regressionplots.py

示例9: test_abline_model_ax

 def test_abline_model_ax(self, close_figures):
     fig = plt.figure()
     ax = fig.add_subplot(111)
     ax.scatter(self.X[:,1], self.y)
     fig = abline_plot(model_results=self.mod, ax=ax)
     close_or_save(pdf, fig)
开发者ID:ChadFulton,项目名称:statsmodels,代码行数:6,代码来源:test_regressionplots.py

示例10: test_abline_model

 def test_abline_model(self, close_figures):
     fig = abline_plot(model_results=self.mod)
     ax = fig.axes[0]
     ax.scatter(self.X[:,1], self.y)
     close_or_save(pdf, fig)
开发者ID:ChadFulton,项目名称:statsmodels,代码行数:5,代码来源:test_regressionplots.py

示例11: print

col_y = 'perMnd' #'mio' #'fasteUdg' #'perMnd'
#ax=df.plot(x='m2',y='perMnd', kind='scatter',s=1.0) #0.5)
ax=df.plot(x=col_x,y=col_y, kind='scatter',s=1.0) #0.5)

#155=16.000, 200=17.700
#45m2 = 1700, 38kr/m2. 26m2 for 1000 kr mere.

if 1:
  #X2 = sm.add_constant( df['m2'] )
  X2 = sm.add_constant( df[col_x] )
  mdl = sm.OLS(endog = df[col_y], exog = X2 )
  result=mdl.fit()
  print(result.summary())
  pprint.pprint(result.params)

  abline_plot(model_results=result, ax=ax)

#plt.xlim(100,350) #600)
=======
filename = 'C:\\Users\\jg.STATUSDK\\Downloads\\husudg - Sheet1.tsv'


df = pd.read_csv(
    filename,
    sep='\t',
    #nrows=2
    #chunksize=2,
    #iterator=True,
    )

#df = df.head(167)
开发者ID:pylgrym,项目名称:first_app,代码行数:31,代码来源:husUdgPlot1.py


注:本文中的statsmodels.graphics.regressionplots.abline_plot函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。