macrosynergy.visuals.multiple_reg_scatter#
- multiple_reg_scatter(cat_rels, ncol=0, nrow=0, figsize=(20, 15), title='', title_xadj=0.5, title_yadj=0.99, title_fontsize=20, xlab='', ylab='', label_fontsize=12, fit_reg=True, reg_ci=95, reg_order=1, reg_robust=False, coef_box=None, coef_box_size=(0.4, 2.5), coef_box_font_size=12, prob_est='pool', separator=None, single_chart=False, subplot_titles=None, subplot_title_fontsize=14, color_cids=False)[source]#
Displays multiple regression scatter plots across categories. The categories are passed as a list of CategoryRelations objects, where the regression calculations take place.
- Parameters:
cat_rels (List[CategoryRelations]) – list of CategoryRelations objects.
ncol (int) – number of columns in the grid. Default is 0, which will be set to the length of cat_rels.
nrow (int) – number of rows in the grid. Default is 0, which will be set to 1.
figsize (Tuple[float]) – size of the figure. Default is (20, 15).
title (str) – title of the figure. Default is an empty string.
xlab (str) – label of the x-axis. Default is an empty string.
ylab (str) – label of the y-axis. Default is an empty string.
fit_reg (bool) – if True (default) a linear regression line is fitted to the data.
reg_ci (int) – confidence interval for the regression line. Default is 95.
reg_order (int) – order of the regression line. Default is 1.
reg_robust (bool) – if True (default is False) robust standard errors are used.
coef_box (str) – if not None, a box with the coefficients of the regression is displayed. Default is None.
coef_box_font_size (int) – font size of the coefficients box. Default is 12. If set to 0 it automatically sets the fontsize according to matplotlib.
prob_est (str) – method to estimate the probability. Default is ‘pool’.
separator (int) – allows categorizing the scatter analysis by integer. This is done by setting it to a year [2010, for instance] which will subsequently split the time-period into the sample before (not including) that year and from (including) that year.
single_chart (bool) – if True (default is False) all the data is plotted in a single chart. If False, a grid of charts is created.
subplot_titles (List[str]) – list of titles for each subplot. Default is None.
color_cids (bool) – if True (default is False) each cross section is given a distinct color in the scatter plot.