def summary(self, yname=None, xname=None, title=0, alpha=.05,
                return_fmt='text'):
        """
        This is for testing the new summary setup
        """
        from gwstatsmodels.iolib.summary import (summary_top,
                                            summary_params, summary_return)

##        left = [(i, None) for i in (
##                        'Dependent Variable:',
##                        'Model type:',
##                        'Method:',
##			'Date:',
##                        'Time:',
##                        'Number of Obs:',
##                        'df resid',
##		        'df model',
##                         )]
        top_left = [('Dep. Variable:', None),
                    ('Model:', None),
                    ('Method:', ['IRLS']),
                    ('Norm:', [self.fit_options['norm']]),
                    ('Scale Est.:', [self.fit_options['scale_est']]),
                    ('Cov Type:', [self.fit_options['cov']]),
                    ('Date:', None),
                    ('Time:', None),
                    ('No. Iterations:', ["%d" % self.fit_history['iteration']])
                    ]
        top_right = [('No. Observations:', None),
                     ('Df Residuals:', None),
                     ('Df Model:', None)
                     ]

        if not title is None:
            title = "Robust linear Model Regression Results"

        #boiler plate
        from gwstatsmodels.iolib.summary import Summary
        smry = Summary()
        smry.add_table_2cols(self, gleft=top_left, gright=top_right, #[],
                          yname=yname, xname=xname, title=title)
        smry.add_table_params(self, yname=yname, xname=xname, alpha=.05,
                             use_t=False)

        #diagnostic table is not used yet
#        smry.add_table_2cols(self, gleft=diagn_left, gright=diagn_right,
#                          yname=yname, xname=xname,
#                          title="")

#add warnings/notes, added to text format only
        etext =[]
        wstr = \
'''If the model instance has been used for another fit with different fit
parameters, then the fit options might not be the correct ones anymore .'''
        etext.append(wstr)

        if etext:
            smry.add_extra_txt(etext)

        return smry
Exemple #2
0
    def summary(self, yname=None, xname=None, title=None, alpha=.05):
        """Summarize the Regression Results

        Parameters
        -----------
        yname : string, optional
            Default is `y`
        xname : list of strings, optional
            Default is `var_##` for ## in p the number of regressors
        title : string, optional
            Title for the top table. If not None, then this replaces the
            default title
        alpha : float
            significance level for the confidence intervals

        Returns
        -------
        smry : Summary instance
            this holds the summary tables and text, which can be printed or
            converted to various output formats.

        See Also
        --------
        gwstatsmodels.iolib.summary.Summary : class to hold summary
            results

        """

        top_left = [
            ('Dep. Variable:', None),
            ('Model:', None),
            ('Model Family:', [self.family.__class__.__name__]),
            ('Link Function:', [self.family.link.__class__.__name__]),
            ('Method:', ['IRLS']),
            ('Date:', None),
            ('Time:', None),
            ('No. Iterations:', ["%d" % self.fit_history['iteration']]),
        ]

        top_right = [('No. Observations:', None), ('Df Residuals:', None),
                     ('Df Model:', None), ('Scale:', [self.scale]),
                     ('Log-Likelihood:', None),
                     ('Deviance:', ["%#8.5g" % self.deviance]),
                     ('Pearson chi2:', ["%#6.3g" % self.pearson_chi2])]

        if title is None:
            title = "Generalized Linear Model Regression Results"

        #create summary tables
        from gwstatsmodels.iolib.summary import Summary
        smry = Summary()
        smry.add_table_2cols(
            self,
            gleft=top_left,
            gright=top_right,  #[],
            yname=yname,
            xname=xname,
            title=title)
        smry.add_table_params(self,
                              yname=yname,
                              xname=xname,
                              alpha=.05,
                              use_t=True)

        #diagnostic table is not used yet:
        #smry.add_table_2cols(self, gleft=diagn_left, gright=diagn_right,
        #                  yname=yname, xname=xname,
        #                  title="")

        return smry
    def summary(self, yname=None, xname=None, title=None, alpha=.05):
        """Summarize the Regression Results

        Parameters
        -----------
        yname : string, optional
            Default is `y`
        xname : list of strings, optional
            Default is `var_##` for ## in p the number of regressors
        title : string, optional
            Title for the top table. If not None, then this replaces the
            default title
        alpha : float
            significance level for the confidence intervals

        Returns
        -------
        smry : Summary instance
            this holds the summary tables and text, which can be printed or
            converted to various output formats.

        See Also
        --------
        gwstatsmodels.iolib.summary.Summary : class to hold summary
            results

        """

        top_left = [('Dep. Variable:', None),
                  ('Model:', None),
                  ('Model Family:', [self.family.__class__.__name__]),
                  ('Link Function:', [self.family.link.__class__.__name__]),
                  ('Method:', ['IRLS']),
                  ('Date:', None),
                  ('Time:', None),
                  ('No. Iterations:', ["%d" % self.fit_history['iteration']]),
                  ]

        top_right = [('No. Observations:', None),
                     ('Df Residuals:', None),
                     ('Df Model:', None),
                     ('Scale:', [self.scale]),
                     ('Log-Likelihood:', None),
                     ('Deviance:', ["%#8.5g" % self.deviance]),
                     ('Pearson chi2:', ["%#6.3g" % self.pearson_chi2])
                     ]

        if title is None:
            title = "Generalized Linear Model Regression Results"

        #create summary tables
        from gwstatsmodels.iolib.summary import Summary
        smry = Summary()
        smry.add_table_2cols(self, gleft=top_left, gright=top_right, #[],
                          yname=yname, xname=xname, title=title)
        smry.add_table_params(self, yname=yname, xname=xname, alpha=.05,
                             use_t=True)

        #diagnostic table is not used yet:
        #smry.add_table_2cols(self, gleft=diagn_left, gright=diagn_right,
        #                  yname=yname, xname=xname,
        #                  title="")

        return smry
    def summary(self,
                yname=None,
                xname=None,
                title=0,
                alpha=.05,
                return_fmt='text'):
        """
        This is for testing the new summary setup
        """
        from gwstatsmodels.iolib.summary import (summary_top, summary_params,
                                                 summary_return)

        ##        left = [(i, None) for i in (
        ##                        'Dependent Variable:',
        ##                        'Model type:',
        ##                        'Method:',
        ##			'Date:',
        ##                        'Time:',
        ##                        'Number of Obs:',
        ##                        'df resid',
        ##		        'df model',
        ##                         )]
        top_left = [
            ('Dep. Variable:', None), ('Model:', None), ('Method:', ['IRLS']),
            ('Norm:', [self.fit_options['norm']]),
            ('Scale Est.:', [self.fit_options['scale_est']]),
            ('Cov Type:', [self.fit_options['cov']]), ('Date:', None),
            ('Time:', None),
            ('No. Iterations:', ["%d" % self.fit_history['iteration']])
        ]
        top_right = [('No. Observations:', None), ('Df Residuals:', None),
                     ('Df Model:', None)]

        if not title is None:
            title = "Robust linear Model Regression Results"

        #boiler plate
        from gwstatsmodels.iolib.summary import Summary
        smry = Summary()
        smry.add_table_2cols(
            self,
            gleft=top_left,
            gright=top_right,  #[],
            yname=yname,
            xname=xname,
            title=title)
        smry.add_table_params(self,
                              yname=yname,
                              xname=xname,
                              alpha=.05,
                              use_t=False)

        #diagnostic table is not used yet
        #        smry.add_table_2cols(self, gleft=diagn_left, gright=diagn_right,
        #                          yname=yname, xname=xname,
        #                          title="")

        #add warnings/notes, added to text format only
        etext = []
        wstr = \
'''If the model instance has been used for another fit with different fit
parameters, then the fit options might not be the correct ones anymore .'''
        etext.append(wstr)

        if etext:
            smry.add_extra_txt(etext)

        return smry