How to use the pysal.model.spglm.utils.cache_readonly function in pysal

To help you get started, we’ve selected a few pysal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pysal / pysal / pysal / model / spglm / glm.py View on Github external
    @cache_readonly
    def null(self):
        y = np.reshape(self.y, (-1,1))
        model = self.model
        X = np.ones((len(y), 1))
        null_mod =  GLM(y, X, family=self.family, offset=self.offset, constant=False)
        return null_mod.fit().mu
github pysal / pysal / pysal / model / mgwr / gwr.py View on Github external
    @cache_readonly
    def df_model(self):
        return None
github pysal / pysal / pysal / model / spglm / glm.py View on Github external
    @cache_readonly
    def llnull(self):
        return self.family.loglike(self.y, self.null, scale=self.scale)
github pysal / pysal / pysal / model / spglm / glm.py View on Github external
    @cache_readonly
    def normalized_cov_params(self):
        return la.inv(spdot(self.w.T, self.w))
github pysal / pysal / pysal / model / mgwr / gwr.py View on Github external
    @cache_readonly
    def resid_working(self):
        return None
github pysal / pysal / pysal / model / gwr / gwr.py View on Github external
    @cache_readonly
    def sigma2_v1(self):
        """
        residual variance

        Methods: p214, (9.6),
        Fotheringham, A. S., Brunsdon, C., & Charlton, M. (2002).
        Geographically weighted regression: the analysis of spatially varying
        relationships.

        only use v1
        """
        return (self.resid_ss/(self.n-self.tr_S))
github pysal / pysal / pysal / model / gwr / gwr.py View on Github external
    @cache_readonly
    def resid_working(self):
        raise NotImplementedError('Not implemented for GWR')
github pysal / pysal / pysal / model / mgwr / gwr.py View on Github external
    @cache_readonly
    def ENP(self):
        """
        effective number of parameters

        Defaults to tr(s) as defined in :cite:`yu:2019`

        but can alternatively be based on 2tr(s) - tr(STS)

        and the form depends on the specification of sigma2
        """
        if self.model.sigma2_v1:
            return self.tr_S
        else:
            return 2 * self.tr_S - self.tr_STS
github pysal / pysal / pysal / model / spglm / glm.py View on Github external
    @cache_readonly
    def resid_deviance(self):
        return (self.family.resid_dev(self.y, self.mu))
github pysal / pysal / pysal / model / gwr / gwr.py View on Github external
    @cache_readonly
    def sigma2_v1v2(self):
        """
        residual variance

        Methods: p55 (2.16)-(2.18)
        Fotheringham, A. S., Brunsdon, C., & Charlton, M. (2002).
        Geographically weighted regression: the analysis of spatially varying
        relationships.

        use v1 and v2 #used in GWR4
        """
        if isinstance(self.family, (Poisson, Binomial)):
            return self.resid_ss/(self.n - 2.0*self.tr_S +
                self.tr_STS) #could be changed to SWSTW - nothing to test against
        else:
            return self.resid_ss/(self.n - 2.0*self.tr_S +