Announcement

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

  • Dichotomous Independent variable

    Hi

    I am working on the following data set and in order to determine my model, I have TOTALINVESTMENTas dependent variable. However, for independent variable I have CSR scores. For companies with standalone reports, these scores have been calculated as CSR category and for others (with no standlaone reports), these are taken from annual reports. I have to take both these scores (otherwise data will be missing for some companies). But i dont understand how do I incorporate both these at the same time in the model as independent variable?

    . dataex Country company Years codes TOTALINVESTMENT CSR annualreports in 1/10

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str11 Country str32 company int Years str4 codes double TOTALINVESTMENT byte(CSR annualreports)
    "China" "BANK OF NINGBO "      2015 "6021"  .010933639572114294  . 13
    "China" "BANK OF NINGBO "      2016 "6021"  .009347256772364393  . 11
    "China" "BANK OF NINGBO "      2017 "6021"   .00385117213766614  . 12
    "China" "BAOSHAN IRON & STE "  2015 "3312" .0031958269707133805 27  .
    "China" "BAOSHAN IRON & STE "  2016 "3312" -.007174386418397924 23  .
    "China" "BAOSHAN IRON & STE "  2017 "3312" -.010593375958482509 23  .
    "China" "BEIJING TONGRENTANG " 2015 "2833"   .11930943954195489  . 19
    "China" "BEIJING TONGRENTANG " 2016 "2833"   .04654752071069721 18  .
    "China" "BEIJING TONGRENTANG " 2017 "2833"   .03692235818603396  . 30
    "China" "BOE TECHNOLOGY "      2015 "3679"  .005138664742455748  . 10
    end
    Thankyou in anticipation

  • #2
    I am trying to run the following code on the above data, but it gives the error "No observations r(2000)"
    Code:
     xtreg Investment_res CSR annualreports Size Tangibility TobinsQ ROA_SD i.Years, fe vce( cluster value_code)

    Comment


    • #3
      As I understand your data CSR is missing when annualreports is observed and vice versa. Stata will ignore any observation if one or more variables in the model are missing. So if you include both in your model, all observations will be ignored, and that is what your error message states. As I understand your question, these are two measures of the same thing. In that case I would combine them in the same variable. Optionally, you could include an indicator (dummy) variable that indicates the source of that variable, and maybe even an interaction.

      Code:
      // create an indicator variable for source of CSR
      gen fromar = !missing(annualreports)
      label define fromar 0 "from stand alone" 1 "from annual reports"
      label value fromar fromar
      label var fromar "source of CSR"
      
      // copy values of annualreports in CSR when CSR is missing
      replace CSR = annualreport if missing(CSR)
      
      // treat both sources as equal
      xtreg Investment_res CSR Size Tangibility TobinsQ ROA_SD i.Years, fe vce( cluster value_code)
      
      // allow different levels of investment for different sources
      xtreg Investment_res CSR fromar Size Tangibility TobinsQ ROA_SD i.Years, fe vce( cluster value_code)
      
      // allow level of investment and the effect of CSR to differ depending on the source
      xtreg Investment_res c.CSR##i.fromar Size Tangibility TobinsQ ROA_SD i.Years, fe vce( cluster value_code)
      ---------------------------------
      Maarten L. Buis
      University of Konstanz
      Department of history and sociology
      box 40
      78457 Konstanz
      Germany
      http://www.maartenbuis.nl
      ---------------------------------

      Comment


      • #4
        Farah:
        how did you -xtset- your data?
        Is the -panelvar- in numeric format?
        Is the -timevar- in numeric format?
        Have you checked whether missing values (via listwise deletion) can explain -r(2000)-?
        Besides, the example/excerpt of data you laudably shared via -dataex- is inconsistent with the following regression code (some variables are not found).
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment

        Working...
        X