Skip to content

Commit 717808b

Browse files
authored
Merge pull request statsmodels#5957 from bashtage/issue-3122
DOC: Clarify xname length and purpose
2 parents 0170e81 + 18994e8 commit 717808b

19 files changed

+124
-104
lines changed

statsmodels/base/model.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2419,11 +2419,12 @@ def summary(self, yname=None, xname=None, title=None, alpha=.05):
24192419
24202420
Parameters
24212421
----------
2422-
yname : string, optional
2422+
yname : str, optional
24232423
Default is `y`
2424-
xname : list of strings, optional
2425-
Default is `var_##` for ## in p the number of regressors
2426-
title : string, optional
2424+
xname : list[str], optional
2425+
Names for the exogenous variables, default is "var_xx".
2426+
Must match the number of parameters in the model
2427+
title : str, optional
24272428
Title for the top table. If not None, then this replaces the
24282429
default title
24292430
alpha : float

statsmodels/discrete/conditional_models.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -423,11 +423,12 @@ def summary(self, yname=None, xname=None, title=None, alpha=.05):
423423
424424
Parameters
425425
----------
426-
yname : string, optional
426+
yname : str, optional
427427
Default is `y`
428-
xname : list of strings, optional
429-
Default is `var_##` for ## in p the number of regressors
430-
title : string, optional
428+
xname : list[str], optional
429+
Names for the exogenous variables, default is "var_xx".
430+
Must match the number of parameters in the model
431+
title : str, optional
431432
Title for the top table. If not None, then this replaces the
432433
default title
433434
alpha : float

statsmodels/discrete/discrete_model.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3602,11 +3602,12 @@ def summary(self, yname=None, xname=None, title=None, alpha=.05,
36023602
36033603
Parameters
36043604
----------
3605-
yname : string, optional
3605+
yname : str, optional
36063606
Default is `y`
3607-
xname : list of strings, optional
3608-
Default is `var_##` for ## in p the number of regressors
3609-
title : string, optional
3607+
xname : list[str], optional
3608+
Names for the exogenous variables, default is "var_xx".
3609+
Must match the number of parameters in the model
3610+
title : str, optional
36103611
Title for the top table. If not None, then this replaces the
36113612
default title
36123613
alpha : float
@@ -3671,16 +3672,17 @@ def summary2(self, yname=None, xname=None, title=None, alpha=.05,
36713672
36723673
Parameters
36733674
----------
3674-
xname : List of strings of length equal to the number of parameters
3675-
Names of the independent variables (optional)
3676-
yname : string
3675+
yname : str
36773676
Name of the dependent variable (optional)
3678-
title : string, optional
3677+
xname : list[str], optional
3678+
List of strings of length equal to the number of parameters
3679+
Names of the independent variables (optional)
3680+
title : str, optional
36793681
Title for the top table. If not None, then this replaces the
36803682
default title
36813683
alpha : float
36823684
significance level for the confidence intervals
3683-
float_format: string
3685+
float_format : str
36843686
print format for floats in parameters summary
36853687
36863688
Returns
@@ -4157,7 +4159,7 @@ def summary2(self, alpha=0.05, float_format="%.4f"):
41574159
----------
41584160
alpha : float
41594161
significance level for the confidence intervals
4160-
float_format: string
4162+
float_format : str
41614163
print format for floats in parameters summary
41624164
41634165
Returns

statsmodels/duration/hazard_regression.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,11 +1546,13 @@ def summary(self, yname=None, xname=None, title=None, alpha=.05):
15461546
15471547
Parameters
15481548
----------
1549-
yname : string, optional
1549+
yname : str, optional
15501550
Default is `y`
1551-
xname : list of strings, optional
1552-
Default is `x#` for ## in p the number of regressors
1553-
title : string, optional
1551+
xname : list[str], optional
1552+
Names for the exogenous variables, default is `x#` for ## in p the
1553+
number of regressors. Must match the number of parameters in
1554+
the model
1555+
title : str, optional
15541556
Title for the top table. If not None, then this replaces
15551557
the default title
15561558
alpha : float

statsmodels/genmod/generalized_estimating_equations.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2063,16 +2063,18 @@ def summary(self, yname=None, xname=None, title=None, alpha=.05):
20632063
20642064
Parameters
20652065
----------
2066-
yname : string, optional
2066+
yname : str, optional
20672067
Default is `y`
2068-
xname : list of strings, optional
2069-
Default is `var_##` for ## in p the number of regressors
2070-
title : string, optional
2068+
xname : list[str], optional
2069+
Names for the exogenous variables, default is `var_#` for ## in
2070+
the number of regressors. Must match the number of parameters in
2071+
the model
2072+
title : str, optional
20712073
Title for the top table. If not None, then this replaces
20722074
the default title
20732075
alpha : float
20742076
significance level for the confidence intervals
2075-
cov_type : string
2077+
cov_type : str
20762078
The covariance type used to compute the standard errors;
20772079
one of 'robust' (the usual robust sandwich-type covariance
20782080
estimate), 'naive' (ignores dependence), and 'bias

statsmodels/genmod/generalized_linear_model.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,11 +1804,13 @@ def summary(self, yname=None, xname=None, title=None, alpha=.05):
18041804
18051805
Parameters
18061806
----------
1807-
yname : string, optional
1807+
yname : str, optional
18081808
Default is `y`
1809-
xname : list of strings, optional
1810-
Default is `var_##` for ## in p the number of regressors
1811-
title : string, optional
1809+
xname : list[str], optional
1810+
Names for the exogenous variables, default is `var_#` for ## in
1811+
the number of regressors. Must match the number of parameters in
1812+
the model
1813+
title : str, optional
18121814
Title for the top table. If not None, then this replaces the
18131815
default title
18141816
alpha : float
@@ -1870,16 +1872,18 @@ def summary2(self, yname=None, xname=None, title=None, alpha=.05,
18701872
18711873
Parameters
18721874
----------
1873-
yname : string
1875+
yname : str
18741876
Name of the dependent variable (optional)
1875-
xname : List of strings of length equal to the number of parameters
1876-
Names of the independent variables (optional)
1877-
title : string, optional
1877+
xname : list[str], optional
1878+
Names for the exogenous variables, default is `var_#` for ## in
1879+
the number of regressors. Must match the number of parameters in
1880+
the model
1881+
title : str, optional
18781882
Title for the top table. If not None, then this replaces the
18791883
default title
18801884
alpha : float
18811885
significance level for the confidence intervals
1882-
float_format: string
1886+
float_format : str
18831887
print format for floats in parameters summary
18841888
18851889
Returns

statsmodels/genmod/qif.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -443,11 +443,13 @@ def summary(self, yname=None, xname=None, title=None, alpha=.05):
443443
444444
Parameters
445445
----------
446-
yname : string, optional
446+
yname : str, optional
447447
Default is `y`
448-
xname : list of strings, optional
449-
Default is `var_##` for ## in p the number of regressors
450-
title : string, optional
448+
xname : list[str], optional
449+
Names for the exogenous variables, default is `var_#` for ## in
450+
the number of regressors. Must match the number of parameters in
451+
the model
452+
title : str, optional
451453
Title for the top table. If not None, then this replaces
452454
the default title
453455
alpha : float

statsmodels/imputation/bayes_mi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ def summary(self, title=None, alpha=.05):
392392
393393
Parameters
394394
----------
395-
title : string, optional
395+
title : str, optional
396396
Title for the top table. If not None, then this replaces
397397
the default title
398398
alpha : float

statsmodels/imputation/mice.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,7 @@ def summary(self, title=None, alpha=.05):
12891289
12901290
Parameters
12911291
----------
1292-
title : string, optional
1292+
title : str, optional
12931293
Title for the top table. If not None, then this replaces
12941294
the default title
12951295
alpha : float

statsmodels/iolib/summary.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,8 @@ def summary_return(tables, return_fmt='text'):
727727

728728

729729
class Summary(object):
730-
'''class to hold tables for result summary presentation
730+
"""
731+
Result summary
731732
732733
Construction does not take any parameters. Tables and text can be added
733734
with the `add_` methods.
@@ -737,10 +738,10 @@ class Summary(object):
737738
tables : list of tables
738739
Contains the list of SimpleTable instances, horizontally concatenated
739740
tables are not saved separately.
740-
extra_txt : string
741+
extra_txt : str
741742
extra lines that are added to the text output, used for warnings
742743
and explanations.
743-
'''
744+
"""
744745
def __init__(self):
745746
self.tables = []
746747
self.extra_txt = None
@@ -757,30 +758,27 @@ def _repr_html_(self):
757758

758759
def add_table_2cols(self, res, title=None, gleft=None, gright=None,
759760
yname=None, xname=None):
760-
'''add a double table, 2 tables with one column merged horizontally
761+
"""
762+
Add a double table, 2 tables with one column merged horizontally
761763
762764
Parameters
763765
----------
764766
res : results instance
765767
some required information is directly taken from the result
766768
instance
767-
title : string or None
769+
title : str, optional
768770
if None, then a default title is used.
769-
gleft : list of tuples
771+
gleft : list[tuple], optional
770772
elements for the left table, tuples are (name, value) pairs
771773
If gleft is None, then a default table is created
772-
gright : list of tuples or None
774+
gright : list[tuple], optional
773775
elements for the right table, tuples are (name, value) pairs
774-
yname : string or None
776+
yname : str, optional
775777
optional name for the endogenous variable, default is "y"
776-
xname : list of strings or None
777-
optional names for the exogenous variables, default is "var_xx"
778-
779-
Returns
780-
-------
781-
None : tables are attached
782-
783-
'''
778+
xname : list[str], optional
779+
optional names for the exogenous variables, default is "var_xx".
780+
Must match the number of parameters in the model.
781+
"""
784782

785783
table = summary_top(res, title=title, gleft=gleft, gright=gright,
786784
yname=yname, xname=xname)

0 commit comments

Comments
 (0)