Announcement

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

  • Wald Test for two different samples

    Hello everyone,

    I am running WALD test for two different samples which means do different codes. I ran OLS in each sample and i get one coefficient in each equation. I want to test to whether both coefficients are equal or not but problem comes later when i use test command. Here comes the procedure i ran the regression, store the estimates and ran the second regression, i restore the estimates of first regression and use

    Code:
    suest father=father1, coefl
    father is coefficient from first regression and father1 is coefficient from second regression. Stata gives me error father1 not found. How can i test the whether these coefficients are same or not. Thanks

  • #2
    See this example where I am testing the equality of the coefficients on mpg from the two regressions

    Code:
    sysuse auto
    qui reg price mpg
    est sto mod1
    qui reg price mpg weight
    est sto mod2
    suest mod1 mod2
    test _b[mod1_mean:mpg] =  _b[mod2_mean:mpg]

    Comment


    • #3
      Andrew Musau This does not work. I am running two different do files, means two different samples so it gives me an error at this command suest "estimation sample of the model saved under mod1 could not be restored"

      Comment


      • #4
        Originally posted by Syed Raza View Post
        Andrew Musau This does not work. I am running two different do files, means two different samples so it gives me an error at this command suest "estimation sample of the model saved under mod1 could not be restored"
        That is the problem. I would append both files, e.g.

        Code:
        use file1.dta
        append using file2.dta, generate(file)
        
        reg outcome father if file == 0
        estimates store model1
        
        reg outcome father1 if file == 1
        estimates store model2
        
        suest model1 model2
        test _b[model1_mean:father] = _b[model2_mean:father1]
        Basically, Stata has to be able to mark the estimation sample in both datasets for suest to work. Stata can only hold one dataset in memory at a time. So, when you referred to your first model, Stata could not find the estimation sample. It needs to see that to run suest.
        Be aware that it can be very hard to answer a question without sample data. You can use the dataex command for this. Type help dataex at the command line.

        When presenting code or results, please use the code delimiters format them. Use the # button on the formatting toolbar, between the " (double quote) and <> buttons.

        Comment

        Working...
        X