Ejemplo n.º 1
0
    def checkFamaMacBethExtended(self, window_type, x, y, **kwds):
        window = 25

        result = fama_macbeth(y=y, x=x, window_type=window_type, window=window,
                              **kwds)

        index =  result._index
        time = len(index)

        for i in xrange(time - window + 1):
            if window_type == 'rolling':
                start = index[i]
            else:
                start = index[0]

            end = index[i + window - 1]

            x2 = {}
            for k, v in x.iteritems():
                x2[k] = v.truncate(start, end)
            y2 = y.truncate(start, end)

            reference = fama_macbeth(y=y2, x=x2, **kwds)

            assert_almost_equal(reference._stats, result._stats[:, i])
Ejemplo n.º 2
0
    def checkFamaMacBethExtended(self, window_type, x, y, **kwds):
        window = 25

        with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
            result = fama_macbeth(y=y, x=x, window_type=window_type, window=window,
                                  **kwds)
        self._check_stuff_works(result)

        index = result._index
        time = len(index)

        for i in range(time - window + 1):
            if window_type == 'rolling':
                start = index[i]
            else:
                start = index[0]

            end = index[i + window - 1]

            x2 = {}
            for k, v in compat.iteritems(x):
                x2[k] = v.truncate(start, end)
            y2 = y.truncate(start, end)

            with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
                reference = fama_macbeth(y=y2, x=x2, **kwds)
            assert_almost_equal(reference._stats, result._stats[:, i])

        with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
            static = fama_macbeth(y=y2, x=x2, **kwds)
        self._check_stuff_works(static)
Ejemplo n.º 3
0
    def checkFamaMacBethExtended(self, window_type, x, y, **kwds):
        window = 25

        result = fama_macbeth(y=y,
                              x=x,
                              window_type=window_type,
                              window=window,
                              **kwds)
        self._check_stuff_works(result)

        index = result._index
        time = len(index)

        for i in range(time - window + 1):
            if window_type == 'rolling':
                start = index[i]
            else:
                start = index[0]

            end = index[i + window - 1]

            x2 = {}
            for k, v in x.iterkv():
                x2[k] = v.truncate(start, end)
            y2 = y.truncate(start, end)

            reference = fama_macbeth(y=y2, x=x2, **kwds)
            assert_almost_equal(reference._stats, result._stats[:, i])

        static = fama_macbeth(y=y2, x=x2, **kwds)
        self._check_stuff_works(static)
Ejemplo n.º 4
0
    def checkFamaMacBethExtended(self, window_type, x, y, **kwds):
        window = 25

        with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
            result = fama_macbeth(y=y, x=x, window_type=window_type, window=window,
                                  **kwds)
        self._check_stuff_works(result)

        index = result._index
        time = len(index)

        for i in range(time - window + 1):
            if window_type == 'rolling':
                start = index[i]
            else:
                start = index[0]

            end = index[i + window - 1]

            x2 = {}
            for k, v in compat.iteritems(x):
                x2[k] = v.truncate(start, end)
            y2 = y.truncate(start, end)

            with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
                reference = fama_macbeth(y=y2, x=x2, **kwds)
            assert_almost_equal(reference._stats, result._stats[:, i])

        with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
            static = fama_macbeth(y=y2, x=x2, **kwds)
        self._check_stuff_works(static)