Skip to content

Commit

Permalink
Merge pull request #14 from jvivian/add-factor-analysis
Browse files Browse the repository at this point in the history
Add factor analysis resolves #11
  • Loading branch information
jvivian authored Feb 6, 2024
2 parents b91f477 + 126dd50 commit c17c9b9
Show file tree
Hide file tree
Showing 257 changed files with 22,206 additions and 26 deletions.
Binary file removed .coverage
Binary file not shown.
17 changes: 11 additions & 6 deletions coverage.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" ?>
<coverage version="7.3.1" timestamp="1707084314193" lines-valid="164" lines-covered="146" line-rate="0.8902" branches-valid="54" branches-covered="49" branch-rate="0.9074" complexity="0">
<coverage version="7.3.1" timestamp="1707114797177" lines-valid="169" lines-covered="151" line-rate="0.8935" branches-valid="56" branches-covered="51" branch-rate="0.9107" complexity="0">
<!-- Generated by coverage.py: https://coverage.readthedocs.io/en/7.3.1 -->
<!-- Based on https://raw.githubusercontent.com/cobertura/web/master/htdocs/xml/coverage-04.dtd -->
<sources>
<source>/home/jvivian/covid19-drDFM/covid19_drdfm</source>
</sources>
<packages>
<package name="." line-rate="0.8902" branch-rate="0.9074" complexity="0">
<package name="." line-rate="0.8935" branch-rate="0.9107" complexity="0">
<classes>
<class name="cli.py" filename="cli.py" complexity="0" line-rate="1" branch-rate="1">
<methods/>
Expand Down Expand Up @@ -36,10 +36,15 @@
<methods/>
<lines>
<line number="1" hits="1"/>
<line number="56" hits="1"/>
<line number="112" hits="1"/>
<line number="127" hits="1"/>
<line number="146" hits="1"/>
<line number="3" hits="1"/>
<line number="58" hits="1"/>
<line number="114" hits="1"/>
<line number="115" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="116" hits="1"/>
<line number="117" hits="1"/>
<line number="119" hits="1"/>
<line number="134" hits="1"/>
<line number="153" hits="1"/>
</lines>
</class>
<class name="dfm.py" filename="dfm.py" complexity="0" line-rate="0.913" branch-rate="0.7917">
Expand Down
7 changes: 7 additions & 0 deletions covid19_drdfm/constants.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from collections import defaultdict

NAME_MAP = {
"Pandemic_1": "Cases1",
"Pandemic_2": "Cases2",
Expand Down Expand Up @@ -109,6 +111,11 @@
"FFR": ("Global", "Uncat"),
}

FACTORS_GROUPED = defaultdict(list)
for key, (_, second) in FACTORS.items():
FACTORS_GROUPED[second].append(key)
FACTORS_GROUPED = dict(FACTORS_GROUPED)

DIFF_COLS = [
"Cases1",
"Cases2",
Expand Down
132 changes: 132 additions & 0 deletions covid19_drdfm/data/example-output/AK/df.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
Time GDP Prod UI UR
2012-02-01 0.6164068416721536 0.6709307585010981 0.14408609899874242 0.4
2012-03-01 0.621369126268051 0.6709307585010981 0.1122897721076911 0.4
2012-04-01 0.6823715730082882 0.6709307585010981 0.10745429985693361 0.3866666666666666
2012-05-01 0.7201480508129824 0.6709307585010981 0.05512905676990382 0.3866666666666666
2012-06-01 0.7105015615464281 0.6709307585010981 0.10152608225421311 0.3866666666666666
2012-07-01 0.6525811755071577 0.6709307585010981 0.09407286549104771 0.3733333333333333
2012-08-01 0.6060805420880557 0.6709307585010981 0.13148584303806 0.3733333333333333
2012-09-01 0.6109846329278866 0.6709307585010981 0.10724131326754076 0.36
2012-10-01 0.5879194573625603 0.6709307585010981 0.19793929163453194 0.36
2012-11-01 0.6442164614911825 0.6709307585010981 0.3061360621220456 0.36
2012-12-01 0.6359996657102006 0.6709307585010981 0.2255652297550041 0.36
2013-01-01 0.6770921850179689 0.0 0.2280251376141953 0.36
2013-02-01 0.6502556855926304 0.6709307585010981 0.06453636226351153 0.3466666666666667
2013-03-01 0.7273742772258296 0.6709307585010981 0.12402012267763596 0.3466666666666667
2013-04-01 0.5873098952179144 0.6709307585010981 0.10163260059686605 0.3466666666666667
2013-05-01 0.5641802033850231 0.6709307585010981 0.08932505371864924 0.3466666666666667
2013-06-01 0.5400082867983307 0.6709307585010981 0.10892330834058091 0.3466666666666667
2013-07-01 0.7805034209619559 0.6709307585010981 0.058616256863757696 0.3466666666666667
2013-08-01 0.7751568136713394 0.6709307585010981 0.12618532851950226 0.3466666666666667
2013-09-01 0.7921401658634863 0.6709307585010981 0.0963279929210932 0.3466666666666667
2013-10-01 0.5602705796001579 0.6709307585010981 0.2421768902759835 0.3466666666666667
2013-11-01 0.5616119572896627 0.6709307585010981 0.2947229178095876 0.33333333333333337
2013-12-01 0.5542663252114519 0.6709307585010981 0.19469741894968798 0.33333333333333337
2014-01-01 0.6771956025949474 0.6901305918451194 0.1804486979513476 0.33333333333333337
2014-02-01 0.6975406611789488 0.6709307585010981 0.12704767042921158 0.33333333333333337
2014-03-01 0.6755643557920494 0.6709307585010981 0.12013359515407576 0.33333333333333337
2014-04-01 0.7029687401246343 0.6709307585010981 0.07921217235477812 0.33333333333333337
2014-05-01 0.706220521880068 0.6709307585010981 0.10122406242086271 0.33333333333333337
2014-06-01 0.7153292372930169 0.6709307585010981 0.10429100328676819 0.33333333333333337
2014-07-01 0.6111041377250467 0.6709307585010981 0.07000526180675472 0.31999999999999995
2014-08-01 0.6361962443248149 0.6709307585010981 0.11144976711107096 0.31999999999999995
2014-09-01 0.6301351633293351 0.6709307585010981 0.09578990577042812 0.30666666666666664
2014-10-01 0.5295629292596407 0.6709307585010981 0.17172887274118998 0.28
2014-11-01 0.5357992890571851 0.6709307585010981 0.27729655144008725 0.2666666666666667
2014-12-01 0.5459360694544858 0.6709307585010981 0.21581261480659364 0.2533333333333333
2015-01-01 0.4933860342845025 0.8591709228043908 0.16073436663761825 0.24
2015-02-01 0.39133278422322626 0.6709307585010981 0.13190219897612218 0.2533333333333333
2015-03-01 0.38228674950566927 0.6709307585010981 0.11903691401997843 0.2533333333333333
2015-04-01 0.6819479128400981 0.6709307585010981 0.07275719059816861 0.2533333333333333
2015-05-01 0.656809246632998 0.6709307585010981 0.05308076206967416 0.2533333333333333
2015-06-01 0.6638021090385847 0.6709307585010981 0.12400004158428166 0.2533333333333333
2015-07-01 0.5757505992860273 0.6709307585010981 0.06637858167142739 0.24
2015-08-01 0.5877020937600063 0.6709307585010981 0.13545413241968687 0.24
2015-09-01 0.6101593227730051 0.6709307585010981 0.1258471948126747 0.24
2015-10-01 0.6166005006397922 0.6709307585010981 0.23933194307069197 0.2533333333333333
2015-11-01 0.6045189410425847 0.6709307585010981 0.2982344488436959 0.2533333333333333
2015-12-01 0.6262390898640361 0.6709307585010981 0.2411146563540022 0.2666666666666667
2016-01-01 0.6218268913301505 0.774400728555791 0.18108697818826558 0.2666666666666667
2016-02-01 0.6391815304710607 0.6709307585010981 0.14504921089698053 0.28
2016-03-01 0.5934462590949157 0.6709307585010981 0.11681255138832379 0.28
2016-04-01 0.7080970658943831 0.6709307585010981 0.09495281366725412 0.28
2016-05-01 0.7359868866891046 0.6709307585010981 0.08060951510601597 0.2933333333333332
2016-06-01 0.7291516259314216 0.6709307585010981 0.07851934698335698 0.2933333333333332
2016-07-01 0.7135596353022643 0.6709307585010981 0.07622147335176178 0.2933333333333332
2016-08-01 0.696689180193885 0.6709307585010981 0.14837293089556208 0.30666666666666664
2016-09-01 0.6929516378683822 0.6709307585010981 0.11420875801948155 0.30666666666666664
2016-10-01 0.7378023525807629 0.6709307585010981 0.22723791467456286 0.30666666666666664
2016-11-01 0.7656909454793792 0.6709307585010981 0.2675140607393116 0.30666666666666664
2016-12-01 0.7429254332089504 0.6709307585010981 0.17757016795080802 0.30666666666666664
2017-01-01 0.7323538767891067 0.7424185238188414 0.2248148594884905 0.2933333333333332
2017-02-01 0.7655461993424407 0.6709307585010981 0.1291275243538341 0.2933333333333332
2017-03-01 0.7972672935453989 0.6709307585010981 0.0980142795818802 0.28
2017-04-01 0.6656121123152663 0.6709307585010981 0.08969926805070813 0.28
2017-05-01 0.7040975319800307 0.6709307585010981 0.06547998092324661 0.28
2017-06-01 0.6848653951925091 0.6709307585010981 0.05171211129733437 0.28
2017-07-01 0.7631244529995055 0.6709307585010981 0.0996368679495716 0.28
2017-08-01 0.7299326898404672 0.6709307585010981 0.13290933317487585 0.28
2017-09-01 0.7081952081824725 0.6709307585010981 0.09028407413057055 0.28
2017-10-01 0.7249881364338913 0.6709307585010981 0.2330396301547218 0.28
2017-11-01 0.7218947361669726 0.6709307585010981 0.28592159802423317 0.28
2017-12-01 0.7249093672816266 0.6709307585010981 0.20955735476028892 0.2666666666666667
2018-01-01 0.6609278851124062 0.28291726490376623 0.19160995328071823 0.2533333333333333
2018-02-01 0.6782284753078431 0.6709307585010981 0.16040635362514152 0.24
2018-03-01 0.6942504408829298 0.6709307585010981 0.09650908867588781 0.22666666666666657
2018-04-01 0.6701090731046015 0.6709307585010981 0.1089714030996026 0.21333333333333337
2018-05-01 0.6710208021234072 0.6709307585010981 0.029545735049214483 0.20000000000000007
2018-06-01 0.6826701985898324 0.6709307585010981 0.050453312885298834 0.20000000000000007
2018-07-01 0.7197686179088395 0.6709307585010981 0.12462263868773787 0.20000000000000007
2018-08-01 0.7217976974583994 0.6709307585010981 0.06500747782321484 0.18666666666666665
2018-09-01 0.7001108841853869 0.6709307585010981 0.1149935143650011 0.18666666666666665
2018-10-01 0.6507496823181886 0.6709307585010981 0.18384039909393668 0.20000000000000007
2018-11-01 0.6708553423466506 0.6709307585010981 0.32053003840755107 0.20000000000000007
2018-12-01 0.6741237090032509 0.6709307585010981 0.2166467015686408 0.20000000000000007
2019-01-01 0.6257482852633167 0.44803639182981514 0.21112718323323998 0.18666666666666665
2019-02-01 0.5994275175881978 0.6709307585010981 0.1460497254908808 0.17333333333333334
2019-03-01 0.581022867246383 0.6709307585010981 0.10700979780831327 0.15999999999999992
2019-04-01 0.6316208854271055 0.6709307585010981 0.053112317398643916 0.1466666666666666
2019-05-01 0.6685910221009247 0.6709307585010981 0.019136035127354928 0.1466666666666666
2019-06-01 0.6681686659419835 0.6709307585010981 0.1362984965529224 0.1466666666666666
2019-07-01 0.7282777117401232 0.6709307585010981 0.08302764632481906 0.1466666666666666
2019-08-01 0.7451096573892022 0.6709307585010981 0.12333359596158489 0.1466666666666666
2019-09-01 0.7396588655575723 0.6709307585010981 0.12254530468033834 0.13333333333333341
2019-10-01 0.6526932992257946 0.6709307585010981 0.2005696490265312 0.12
2019-11-01 0.676616113422199 0.6709307585010981 0.34357552224928156 0.10666666666666669
2019-12-01 0.6456108962880549 0.6709307585010981 0.20879061756490075 0.10666666666666669
2020-01-01 0.5518712805846355 1.0 0.1689552854503726 0.10666666666666669
2020-02-01 0.5626205813947409 0.6709307585010981 0.11383476269107125 0.10666666666666669
2020-03-01 0.6138800449416087 0.6709307585010981 0.1588027269158376 0.10666666666666669
2020-04-01 0.18548916976570584 0.6709307585010981 0.9999999999999999 1.0
2020-05-01 0.06373611065004237 0.6709307585010981 0.1308972280643041 1.0
2020-06-01 0.0 0.6709307585010981 0.10871474536952755 0.9200000000000002
2020-07-01 0.9957808963720891 0.6709307585010981 0.0958626373451043 0.9066666666666665
2020-08-01 0.986287117004685 0.6709307585010981 0.0358803669984015 0.45333333333333337
2020-09-01 0.997992660056092 0.6709307585010981 0.010946571110906522 0.43999999999999995
2020-10-01 0.8907890136135153 0.6709307585010981 0.02270134778887667 0.3866666666666666
2020-11-01 0.8904422706182485 0.6709307585010981 0.16707304289167973 0.3733333333333333
2020-12-01 0.8231783316580503 0.6709307585010981 0.16479839825098805 0.3866666666666666
2021-01-01 0.8532357987090885 0.36380931753505646 0.14377378887040357 0.36
2021-02-01 0.8578370890224951 0.6709307585010981 0.06560191823470822 0.3466666666666667
2021-03-01 0.8148460278859364 0.6709307585010981 0.08684425968862515 0.3466666666666667
2021-04-01 0.7908049676540101 0.6709307585010981 0.08858162541534628 0.3466666666666667
2021-05-01 0.7924606105483781 0.6709307585010981 0.06723860588676225 0.31999999999999995
2021-06-01 0.7829494782701982 0.6709307585010981 0.05680511272516202 0.31999999999999995
2021-07-01 0.8191143053132359 0.6709307585010981 0.0 0.28
2021-08-01 0.8261995895600249 0.6709307585010981 0.04715612640420984 0.2533333333333333
2021-09-01 0.8364256009224009 0.6709307585010981 0.3121435017940396 0.20000000000000007
2021-10-01 0.8730233769786331 0.6709307585010981 0.04351923620271793 0.17333333333333334
2021-11-01 0.8622525100974402 0.6709307585010981 0.1678222464745851 0.1466666666666666
2021-12-01 0.8687237521401663 0.6709307585010981 0.22231875551564176 0.1466666666666666
2022-01-01 0.6200002576047271 0.0 0.14472084152388168 0.15999999999999992
2022-02-01 0.609954600126257 0.0 0.09447220795576386 0.12
2022-03-01 0.5548641901343707 0.0 0.08647078820209839 0.06666666666666665
2022-04-01 1.0 0.0 0.04582352119832925 0.053333333333333344
2022-05-01 0.9297531507320034 0.0 0.05608747404409839 0.026666666666666616
2022-06-01 0.8634609793751494 0.0 0.08795774559793565 0.026666666666666616
2022-07-01 0.7021570233960444 0.0 0.11606828411491946 0.013333333333333308
2022-08-01 0.6461232398439661 0.0 0.10994696757944064 0.026666666666666616
2022-09-01 0.6343537641550312 0.0 0.08860265721166044 0.0
2022-10-01 0.5624905753281257 0.0 0.23839489848276382 0.0
2022-11-01 0.6056468360159089 0.0 0.31468257764404395 0.0
2022-12-01 0.6123202873230487 0.0 0.0 0.0
Binary file added covid19_drdfm/data/example-output/AK/df.xlsx
Binary file not shown.
Loading

0 comments on commit c17c9b9

Please sign in to comment.