-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOLS_summaries.py
More file actions
48 lines (35 loc) · 1 KB
/
OLS_summaries.py
File metadata and controls
48 lines (35 loc) · 1 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 1 15:54:08 2022
This script loads the pickled OLS models to print model summaries.
@author: waeiski
"""
import statsmodels.api as sm
import pandas as pd
import geopandas as gpd
import glob
import argparse
# Set up the argument parser
ap = argparse.ArgumentParser()
# Get path to input folder
ap.add_argument("-if", "--inputfolder", required=True,
help="Path to folder containing pickled model files.")
# parse arguments
args = vars(ap.parse_args())
# list all pickled models
mdls = glob.glob(args['inputfolder'] + '*.pkl')
# read models, the order might be different for you
mo = sm.load(mdls[1])
no = sm.load(mdls[3])
af = sm.load(mdls[0])
ev = sm.load(mdls[4])
ni = sm.load(mdls[2])
fu = sm.load(mdls[5])
# print model summaries as latex
print(mo.summary().as_latex())
print(no.summary().as_latex())
print(af.summary().as_latex())
print(ev.summary().as_latex())
print(ni.summary().as_latex())
print(fu.summary().as_latex())