Announcement

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

  • Simple OLS Regression Question/Problem

    Hello -

    I am a basic/beginning STATA user and am having a some issues with performing a standard OLS regression.

    My project is attempting to evaluate a relationship between the cost of drugs prices pre-PPACA to post-PPACA (i.e. 2013, 2014 (PPACA is enacted), 2015 (one-year after PPACA).

    I am using a simple model with data received from Medicaid. In nominal $ terms, the model is: NADAC (National Average Drug Acquisition Cost) = b0 + b1 NADAC 2013 + b2 NADAC 2014 + b3 NADAC 2015 + e.

    I imported all of my data into STATA and have created a variable for NADAC 2013-2015.

    The issue is when I attempt to do reg NADAC NADAC2013 NADAC2014 NADAC2015:
    NADAC ambiguous abbreviation

    My hope was that the dependent variable (NADAC) would capture the $ changes in the beta coefficients for each of the years. For example: let's assume that the beta coefficients for NADAC2013 is 5 (assume statistical significance), that 5 would correspond stating that on average, the NADAC increased by $5 in 2013. Does this make sense?

    Is this possible and if so, what recommendations do you have to make this regression work?

    Thank you very much,

    Guest
    Last edited by sladmin; 15 May 2017, 07:14. Reason: anonymize original poster

  • #2
    Are NADAC2013 through NADAC2015 indicator variables (0/1) for the year? If not, then what's in these variables?

    Comment


    • #3
      To better help answer this question, it is important to know what the layout of your data is. It might also need some transformations.
      Please install dataex and post a snippet of your data, e.g., show the first 20 rows by doing:

      Code:
      ssc install dataex
      dataex in 1/20

      Comment


      • #4
        Welcome to Statalist!

        If I understand you correctly you issue the command
        Code:
        reg NADAC NADAC2013 NADAC2014 NADAC2015
        to which Stata replies
        Code:
        NADAC ambiguous abbreviation
        That suggests to me that Stata is unable to locate in your data a variable named NADAC. By default, Stata allows you to specify variables names with an abbreviated version of the name, so long as it identifies a single variable. When Stata fails to find a variable named NADAC, it attempts to use it as an abbreviation, but determines that NADAC is an abbreviated version of several variable names, and issues the error message. Here is an example on a toy dataset.
        Code:
        . list
        
             +-----------------------+
             | x   x1   x2   y3   y4 |
             |-----------------------|
          1. | 0    1    2    3    4 |
             +-----------------------+
        
        . list x x1 x2
        
             +-------------+
             | x   x1   x2 |
             |-------------|
          1. | 0    1    2 |
             +-------------+
        
        . list y y3 y4
        y ambiguous abbreviation
        r(111);

        Comment


        • #5
          NADAC contains 5000 drug names and prices for each of the three years.
          A single variable can't have both the drug names and the prices. Like William says, it sounds like you do not have a variable named NADAC. Rather there are assorted variables that start with NADAC and Stata doesn't know which one you want. If that isn't clear, then following Jorrit's suggestion of using dataex may help us to identify the problem.
          -------------------------------------------
          Richard Williams, Notre Dame Dept of Sociology
          StataNow Version: 19.5 MP (2 processor)

          EMAIL: [email protected]
          WWW: https://www3.nd.edu/~rwilliam

          Comment


          • #6
            The you have a fairly severe misunderstanding of the use of the reg command, and (as your other questions in post #1 led me to believe) a lack of understanding of linear regression. Addressing the latter is beyond what most of us can address in short online posts, beyond perhaps giving some accessible online references.

            With regard to better understanding Stata, when I began using Stata in a serious way, I started by reading my way through the Getting Started with Stata manual relevant to my setup. Chapter 18 then gives suggested further reading, much of which is in the Stata User's Guide, and I worked my way through much of that reading as well. All of these manuals are included as PDFs in the Stata installation (since version 11) and are accessible from within Stata - for example, through Stata's Help menu. The objective in doing this was not so much to master Stata as to be sure I'd become familiar with a wide variety of important basic techniques, so that when the time came that I needed them, I might recall their existence, if not the full syntax. With that sort of background, then you will then be more likely to find the output from help reg and the longer discussions in the PDF manuals more useful.

            Comment


            • #7
              First off rather than pasting an image it would be easier if you actually copied and pasted the output from Stata (limiting it to, say, 20 cases, as was suggested before). Then we could actually run the code and play around with your data.

              I have a feeling that what you want to do is -reshape long- and then run -xtreg-. The commands (not tested) would be something like

              Code:
              gen id = _n
              reshape long NADAC_, i(id) j(year)
              xtset id year
              xtreg NADAC i.year
              I suppose too you might use lagged values of NADAC.
              -------------------------------------------
              Richard Williams, Notre Dame Dept of Sociology
              StataNow Version: 19.5 MP (2 processor)

              EMAIL: [email protected]
              WWW: https://www3.nd.edu/~rwilliam

              Comment

              Working...
              X