Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How i do Regressions using dummy variable

    How I write a code for Regressions using dummy variable, cross sectional regression





    Click image for larger version

Name:	rer.jpg
Views:	1
Size:	188.7 KB
ID:	1605665

  • #2
    Hi Asma,

    You're going to need to provide some more info on what exactly you want to do and the dataset you are using. Please see the forum FAQ for details on how to share data.

    Best,
    Rhys

    Comment


    • #3
      How i do do Regressions using dummy variables for: Cross-sectional regression Fixed-sectional regression

      Code:
       table 1
      //Measuring of variables//
      
       ** 1. Cash/assets 
      ** Assets in the denominators of variables are calculated as assets "at" less cash and marketable securities "che"
      
      gen assets = at - che 
      *(12,114 missing values generated)
      drop if assets<0  //drop when assets is negative
      *(1 observation deleted)
      
      **Cash/assets 
      gen cash_assets= ch/assets
      *(32,755 missing values generated)
      
      ** 2. Generate variable Truncated/assets 
      generate byte truncated_assets = cash_assets > 1
      
      
      ** 3. Generate Size is defined as the natural logarithm of assets
      gen size = ln(assets)
      * (12,161 missing values generated)
      
      ** 4. Generate variable The market-to-book ratio is measured as the book value of assets (at) , less the book value of equity (ceq), plus the market value of equity (csho*prcc_f), divided by assets
      
      gen market_to_book = (at - ceq + (csho*prcc_f) )/ assets
      
      *(43,195 missing values generated)
      ** 5. Generate variable R&D/sales
      gen R_D_sales = xrd/sale 
      
      *(79,628 missing values generated)
      
      ** 6.  Generate variable Cash flow is defned as earnings before interest and taxes, but before depreciation and amortization, less interest, taxes, and common dividends.  
      
      gen cashflow_asset = (ebit - xint - txt - dvt)
      * (16,343 missing values generated)
      
      ** 7.  Generate variable Net working capital without cash 
      gen net_working_capital = (wcap-ch)/assets
      *(35,931 missing values generated)
      
      
      ** 8. Generate variable Capital expenditures/assets
      gen capital_expenditures = capx/ assets
      * (14,521 missing values generated)
      
      ** 9. Generate variable Acquisitions/assets
      gen Acquisitions_assets= aqc / assets
      * (22,255 missing values generated)
      ** 10. Generate variable Payout to shareholders is the sum of cash dividends over assets and stock repurchases over assets
      gen payout_to_shareholders = (dv/assets) + (prstkcc/assets)
      *(146,466 missing values generated)
      
      ** 11. Generate variable  Industry sigma  Industry sigma is a measure of the volatility of an industry's cash #ow for a 20-year period. Industries are defined by 2-digit SIC codes.
      egen SD = sd(scf), by(sic_2)
      gen industry_sigma = SD
      
      ** 12.Total leverage is total debt over total assets.
      gen total_leverage = (dltt + dlc - che) /at
      *(12,391 missing values generated)
      
      // table 4 
      /*Table 4 presents panel regressions predicting liquidity levels in the 1971}1994
      period, using the independent variables described earlier. */
      
      ** 1. The dependent variable in all regressions is the natural log of cash/assets, which is calculated as cash divided by assets less cash holdings
      gen cash_asset_dep = log( cash_assets)
      drop if cash_asset_dep < 0
      
      ** 2. Dividend dummy 
      generate byte  Dividend_dummy = dvt > 0 & !mi(dvt)

      Comment

      Working...
      X