File: test_robust.py

package info (click to toggle)
python-scipy 0.5.2-0.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 33,888 kB
  • ctags: 44,231
  • sloc: ansic: 156,256; cpp: 90,347; python: 89,604; fortran: 73,083; sh: 1,318; objc: 424; makefile: 342
file content (27 lines) | stat: -rw-r--r-- 613 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import scipy.sandbox.models as S
import unittest
import numpy.random as R
import numpy as N

W = R.standard_normal

class RegressionTest(unittest.TestCase):

    def testRobust(self):
        X = W((40,10))
        Y = W((40,))
        model = S.rlm(design=X)
        results = model.fit(Y)
        self.assertEquals(results.df_resid, 30)

    def testRobustdegenerate(self):
        X = W((40,10))
        X[:,0] = X[:,1] + X[:,2]
        Y = W((40,))
        model = S.rlm(design=X)
        results = model.fit(Y)
        self.assertEquals(results.df_resid, 31)


if __name__ == '__main__':
    unittest.main()