Announcement

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

  • sdtest using dummy variables

    Hi, everyone, I am a relatively new user of stata. Well, I'm trying to make a 'sdtest' for two groups for a variable. I'm using a survey which has 24 regions. These regions have a id or a number to identify them. I built a variable called "state_confidence" that is an indicator of confidence in institutions. I am analyzing this indicator across regions and I want to make a sdtest for just those two regions.
    Thus, I just want to compare the variance between those individuals that belong to those regions.

    * 'depto' is a numeric variable which put a number in a specific order between 1 to 24 for each of these regions. Then, I built two dummies for just two of them and so compare using sdtest.

    gen conf_puno=0
    replace conf_puno=1 if depto==21
    label var conf_puno "Individuo from region 21"

    gen conf_lima=0
    replace conf_lima=1 if depto==15
    label var conf_lima "Individuo from region 15"

    *Variance test

    sdtest stateconf if conf_puno==1 & conf_lima==1

    The problem is that Stata notify that an error which says "by() option required"

    How I fix this problem??

    Thank you for your help. Seriously, I tried to solve this by myself, but I consider that this forum would have new ideas to do that.
    Thanks again.

    Last edited by Jorge Conde; 04 Nov 2018, 01:16.

  • #2
    your -sdtest- syntax is not legal; see
    Code:
    help sdtest

    Comment


    • #3
      To get a valid estimate of the standard deviation in each region, you need to svyset your data with the design information (sampling weight, primary sampling units, strata). Then:

      Code:
      svy: mean if  depto ==15
      estat sd
      svy: mean if  depto==21
      estat sd
      You want to test that the standard deviations are different. However, without doing the test I can tell you that they are different. Why? Because the two regions are specific finite populations, not theoretical ones. If you were to enumerate all the subjects in each region (i.e. do a census) and estimate the two standard deviations,, they would never be identical numbers. Neither would any other descriptive statistic calculated for the entire population.

      Steve Samuels
      Statistical Consulting
      [email protected]

      Stata 14.2

      Comment

      Working...
      X