Function reference
Data and Parquet
| load_parquet | Scan a parquet table from a WRDS-style local data directory. |
| load_annual_betas | Load the December values of the 12-month daily beta. |
| load_monthly_betas | Estimate the 12-month daily beta for each common stock and formation month. |
| build_annual_panel | Join December stock characteristics to next-year excess returns. |
| build_sizes | Build monthly and June-based market capitalization for the BEM sample. |
| build_bm | Construct monthly book-to-market using prior-year fiscal book equity. |
| build_momentum | Build the seven BEM momentum signals from legacy CRSP monthly returns. |
| load_beta_universe | Select stock-month formation dates with common share codes. |
| get_ff_factors | Download and cache a vintage of Kenneth French’s US factors. |
| load_pastor_stambaugh_2013 | Load the December 2013 Pástor–Stambaugh liquidity data. |
| load_daily_beta_inputs | Prepare the daily factors and stock observations used to estimate beta. |
| monthly_panel | Join formation-month characteristics to next-month excess returns. |
| write_eap_table | Write a derived stock-month table to DATA_DIR/eap. |
| ptime | Display wall-clock time for a code block in notebook-friendly markdown. |
Cross-sectional statistics
| mean_cross_sections | Average each descriptive statistic across monthly cross-sections. |
| period_correlations | Compute cross-sectional correlations separately for each period. |
| correlation_matrix | Put Pearson correlations below the diagonal and Spearman above it. |
| winsorized_corr | Compute a Pearson correlation after pairwise finite-value filtering. |
| persistence | Average cross-sectional correlations with future observations. |
Time-series regressions
| rolling_ols | Fit rolling OLS with an intercept on a panel of numeric returns. |
Daily beta estimation
| daily_betas | Estimate ordinary, Scholes–Williams, and Dimson betas at each formation month. |
| monthly_moments | Sum daily returns and their cross-products by stock and month. |
| product_name | Name the sum of products of two return columns as left_x_right. |
| add_anchors | Add formation months to the return history before rolling the sums. |
| roll_moments | Sum monthly regression inputs over trailing calendar months. |
| daily_slope | Return the slope of retrf on market from sums of daily returns. |
| rolling_daily_beta | Estimate stock betas from daily returns over a rolling calendar window. |
| adjusted_window | Calculate twelve-month regression sums using market returns observable at formation. |
Portfolios and inference
| assign_portfolio | Assign stocks to portfolios using group-specific breakpoints. |
| univariate_panel | Summarize monthly characteristic deciles and the high-minus-low spread. |
| bivariate_months | Form monthly quintile portfolios on a control and a target. |
| bivariate_panel | Report means and quintile spreads from a monthly two-way sort. |
| fama_macbeth_table | Build a table of monthly Fama–MacBeth regressions. |
| hac | Fit a StatsPAI regression with six Newey–West lags. |
| format_fit | Format a coefficient and its t statistic for a book table. |
Plots
| plot_cumulative_returns | Plot compounded and cumulative log returns in separate panels. |
| plot_factor | Plot cumulative Fama–French factor returns from July 1926 to December 2012. |
Polars expression methods
| EAPExprNamespace.ntile | Assign observations to n approximately equal-sized buckets. |
| EAPExprNamespace.quantile | Estimate a sample quantile within the current group. |
| EAPExprNamespace.winsorize | Clip values to percentile cutoffs. |
| EAPExprNamespace.truncate | Set values outside percentile cutoffs to null. |
| EAPExprNamespace.div_if_pos | Divide by other only when the denominator is strictly positive. |
DataFrame methods
| EAPDataFrameNamespace.show_table | Display the DataFrame with Great Tables in a notebook or Quarto. |
| EAPDataFrameNamespace.show_grid | Display a pivoted portfolio grid with optional year headings. |
| EAPDataFrameNamespace.map_by | Apply fun to each group and preserve the grouping keys. |