+ Reply to Thread
Results 1 to 2 of 2

Thread: Help with Stata

  1. #1
    Points: 1,150, Level: 18
    Level completed: 50%, Points required for next Level: 50

    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with Stata



    Hi Guys,

    I'm trying to run a regression on price of online books against a set of book dummy variables (corresponding to the title of the book) and the book condition. I created the book dummy variables by:

    tab bnum, g(bdummy)

    where 'bnum' is a unique identifier for a title of a book. There are 400 bdummy variables and around 8000 thousand observations so we have numerous observations with the same title.

    I next ran the regression:
    reg oprice ocond bdummy*, noconstant.

    where oprice is the price of the book and ocond is the condition of the book. I'm interested in grabbing the coefficients on the dummies from the previous regression and merging it to my existing dataset. However, if I use the command:

    matrix b = e(b)'
    svmat b
    summ b1

    I get a new column b1 in my dataset with all the regression coefficients but it doesn't group them by the variable 'bnum'. In other words, observations with the same title should have the same dummy coefficient but Stata just lists each unique coefficient so many observations are paired with the wrong dummy coefficient. Therefore, instead of getting 8000 coefficients with 400 unique coefficients, Stata just lists the 400 unique coefficients so I can't merge the dataset. Is there a way to fix this problem?

    Thanks

  2. #2
    Points: 2,352, Level: 29
    Level completed: 35%, Points required for next Level: 98

    Location
    Paris
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Help with Stata


    Hey there,

    It seems to me that what you want to do is to obtain the predicted value with ocond set equal to 0. So what you should do is:

    reg oprice ocond bdummy*, noconstant.
    replace ocond = 0
    predict pdummy, xb

    and then pdummy will be the variable you want to obtain.

    Hope this helps,

    Etienne

+ Reply to Thread

Similar Threads

  1. Stata project help
    By conchur in forum Stata
    Replies: 0
    Last Post: 04-30-2010, 06:59 AM
  2. Stata
    By gihund in forum Stata
    Replies: 0
    Last Post: 05-12-2009, 10:45 AM
  3. Replies: 0
    Last Post: 05-12-2009, 10:44 AM
  4. Stata Help!!
    By Caoltan in forum Stata
    Replies: 2
    Last Post: 05-07-2009, 05:15 AM
  5. help with using STATA
    By indiguy in forum Stata
    Replies: 0
    Last Post: 09-24-2007, 04:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts








Advertise on Talk Stats