.._ClassFunctions:
Auto Class Functions
- class CompustatControls.CompustatControls(df, variables=None)
A class to compute common control variables used in corporate finance studies from the Compustat database.
- dfpd.DataFrame
The dataframe containing company data from the Compustat database.
- variableslist, optional
A list of variable names to consider from the Compustat database.
- control_methodsdict
A dictionary registering all functions available to compute control variables.
- CapexToAssets()
Computes the Capital Expenditure to Assets ratio for the firm.
- Formula:
CapexToAssets = capx / at
Compustat variables: - capx: Capital Expenditure - at: Total assets
- CompustatControls:
Updated object with the ‘CapexToAssets’ column added to its dataframe.
- CurrentRatio()
Computes the Current Ratio for the firm.
- Formula:
CurrentRatio = act / lct
Compustat variables: - act: Current assets - Total - lct: Current liabilities - Total
- CompustatControls:
Updated object with the ‘CurrentRatio’ column added to its dataframe.
- DividendPayout()
Computes the Dividend Payout ratio of the firm.
- Formula:
DividendPayout = dvc / ni
Compustat variables: - dvc: Dividends - Common/Ordinary - ni: Net income
- CompustatControls:
Updated object with the ‘DividendPayout’ column added to its dataframe.
- EarningsVolatility()
Computes the Earnings Volatility based on rolling standard deviation of the firm’s net income.
- Formula:
EarningsVolatility = rolling standard deviation of ‘ni’
Compustat variable: - ni: Net income
- CompustatControls:
Updated object with the ‘EarningsVolatility’ column added to its dataframe.
- FirmAge()
Computes the age of the firm since its IPO.
- Formula:
FirmAge = fyear - ipodate
Compustat variables: - fyear: Fiscal Year - ipodate: IPO date
- CompustatControls:
Updated object with the ‘FirmAge’ column added to its dataframe.
- MTB()
Computes the Market-to-Book ratio of the firm.
- Formula:
MTB = (prcc_f * csho) / ceq
Compustat variables: - prcc_f: Price close annual - Fiscal - csho: Common shares outstanding - ceq: Common/Ordinary Equity - Total
- CompustatControls:
Updated object with the ‘MTB’ column added to its dataframe.
- RDIntensity()
Computes the Research and Development Intensity for the firm.
- Formula:
RDIntensity = xrd / sale
Compustat variables: - xrd: Research and Development Expense - sale: Sales/Turnover (Net)
- CompustatControls:
Updated object with the ‘RDIntensity’ column added to its dataframe.
- ROA()
Computes the Return on Assets (ROA) of the firm.
- Formula:
ROA = ni / at
Compustat variables: - ni: Net income - at: Total assets
- CompustatControls:
Updated object with the ‘ROA’ column added to its dataframe.
- SalesGrowth()
Computes the Sales Growth for the firm.
- Formula:
SalesGrowth = sale(t) / sale(t-1) - 1
Compustat variable: - sale: Sales/Turnover (Net)
- CompustatControls:
Updated object with the ‘SalesGrowth’ column added to its dataframe.
- TobinsQ()
Computes Tobin’s Q for the firm.
- Formula:
TobinsQ = (prcc_f * csho + dltt) / at
Compustat variables: - prcc_f: Price close annual - Fiscal - csho: Common shares outstanding - dltt: Long-term debt - at: Total assets
- CompustatControls:
Updated object with the ‘TobinsQ’ column added to its dataframe.
- asset_turnover()
Computes the Asset Turnover for the firm.
- Formula:
AssetTurnover = sale / at
Compustat variables: - sale: Sales/Turnover (Net) - at: Total Assets
- CompustatControls:
Updated object with the ‘AssetTurnover’ column added to its dataframe.
- bulk_compute(controls_list)
Computes control variables based on the provided list of control names.
- controls_listlist of str
List of control variable names.
- pd.DataFrame:
Updated dataframe with new computed control variables.
- cash_ratio()
Computes the Cash Ratio for the firm.
- Formula:
CashRatio = che / at
Compustat variables: - che: Cash and Short-Term Investments - at: Total Assets
- CompustatControls:
Updated object with the ‘CashRatio’ column added to its dataframe.
- debt_maturity()
Computes the Debt Maturity ratio for the firm.
- Formula:
DebtMaturity = dltt / (dltt + dlc)
Compustat variables: - dltt: Long-Term Debt - Total - dlc: Debt in Current Liabilities
- CompustatControls:
Updated object with the ‘DebtMaturity’ column added to its dataframe.
- diversification()
Placeholder method for computing the Diversification metric.
Note: Proper computation would require detailed data on a firm’s product/service portfolio.
Compustat variables: - (To be determined based on the specifics of the implementation)
- CompustatControls:
Potentially updated object with the ‘Diversification’ column added, once the method is fully implemented.
- effective_tax_rate()
Computes the Effective Tax Rate for the firm.
- Formula:
EffectiveTaxRate = txp / pi
Compustat variables: - txp: Income Taxes - Total - pi: Pretax Income
- CompustatControls:
Updated object with the ‘EffectiveTaxRate’ column added to its dataframe.
- firm_size()
Computes the firm size based on total assets.
- CompustatControls:
An instance of the class with the ‘FirmSize’ column added to its dataframe.
- gross_margin()
Computes the Gross Margin for the firm.
- Formula:
GrossMargin = (sale - cogs) / sale
Compustat variables: - sale: Sales/Turnover (Net) - cogs: Cost of Goods Sold
- CompustatControls:
Updated object with the ‘GrossMargin’ column added to its dataframe.
- hhi()
Placeholder method for computing the Herfindahl-Hirschman Index (HHI).
Note: Proper computation would require market share or industry-related data.
Compustat variables: - (To be determined based on the specifics of the implementation)
- CompustatControls:
Potentially updated object with the ‘HHI’ column added, once the method is fully implemented.
- interest_coverage()
Computes the Interest Coverage for the firm.
- Formula:
InterestCoverage = ebit / xint
Compustat variables: - ebit: Earnings Before Interest and Taxes - xint: Interest and Related Expense - Total
- CompustatControls:
Updated object with the ‘InterestCoverage’ column added to its dataframe.
- inventory_turnover()
Computes the Inventory Turnover for the firm.
- Formula:
InventoryTurnover = cogs / invt
Compustat variables: - cogs: Cost of Goods Sold - invt: Inventory - Total
- CompustatControls:
Updated object with the ‘InventoryTurnover’ column added to its dataframe.
- leverage()
Computes the leverage of the firm.
- Formula:
Leverage = dltt / at
Compustat variables: - dltt: Long-term debt - at: Total assets
- CompustatControls:
Updated object with the ‘Leverage’ column added to its dataframe.
- net_working_capital()
Computes the Net Working Capital for the firm.
- Formula:
NetWorkingCapital = act - lct
Compustat variables: - act: Current assets - Total - lct: Current liabilities - Total
- CompustatControls:
Updated object with the ‘NetWorkingCapital’ column added to its dataframe.
- operating_margin()
Computes the Operating Margin for the firm.
- Formula:
OperatingMargin = ebit / sale
Compustat variables: - ebit: Earnings Before Interest and Taxes - sale: Sales/Turnover (Net)
- CompustatControls:
Updated object with the ‘OperatingMargin’ column added to its dataframe.
- operational_efficiency()
Computes the Operational Efficiency for the firm.
- Formula:
OpEfficiency = cogs / sale
Compustat variables: - cogs: Cost of Goods Sold - sale: Sales/Turnover (Net)
- CompustatControls:
Updated object with the ‘OpEfficiency’ column added to its dataframe.
- pe_ratio()
Computes the Price-to-Earnings (PE) Ratio for the firm.
- Formula:
PE_Ratio = prcc_f / (ni / csho)
Compustat variables: - prcc_f: Price Close - Annual - Fiscal - ni: Net Income (Loss) - csho: Common Shares Outstanding
- CompustatControls:
Updated object with the ‘PE_Ratio’ column added to its dataframe.
- product_market_competition()
Placeholder method for computing the Product Market Competition metric.
Note: Proper computation would require detailed product or market data.
Compustat variables: - (To be determined based on the specifics of the implementation)
- CompustatControls:
Potentially updated object with the ‘ProductMarketCompetition’ column added, once the method is fully implemented.
- rd_to_assets()
Computes the Research and Development (R&D) to Assets ratio for the firm.
- Formula:
RD_to_Assets = xrd / at
Compustat variables: - xrd: Research and Development Expense - at: Total Assets
- CompustatControls:
Updated object with the ‘RD_to_Assets’ column added to its dataframe.
- receivables_turnover()
Computes the Receivables Turnover for the firm.
- Formula:
ReceivablesTurnover = sale / rect
Compustat variables: - sale: Sales/Turnover (Net) - rect: Receivables - Total
- CompustatControls:
Updated object with the ‘ReceivablesTurnover’ column added to its dataframe.
- z_score()
Computes the Altman Z-Score, a measure of bankruptcy risk.
- Formula:
Z_Score = 1.2A + 1.4B + 3.3C + 0.6D + 0.999E
Where: - A, B, C, D, and E are intermediate calculations based on Compustat variables
Compustat variables used include: - act: Current assets - Total - lct: Current liabilities - Total - re: Retained Earnings - ebit: Earnings Before Interest and Taxes - prcc_f: Price Close - Annual - Fiscal - csho: Common Shares Outstanding - lt: Liabilities - Total - sale: Sales/Turnover (Net)
- CompustatControls:
Updated object with the ‘Z_Score’ column added to its dataframe.