Announcement

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

  • Finding mean (begginner stata help)

    I need to analyze the relationship between those who rent a detached house and if they spend more on rent than persons who rent a different type of housing?

    Ideally I am trying to find the mean if Rent ==1 and DetachedHouse ==1 and Rent ==1 and DetachedHouse=0

    The Variable SH003 is the quantitative value of the rent payments.

    If anyone knows how to make this work I would really appreciate it.

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input byte(Rent DetachedHouse) long SH003
    0 0     0
    0 0     0
    1 0 11460
    0 1     0
    1 0 15200
    1 0 10560
    1 1 14160
    0 0     0
    0 1     0
    1 0 10488
    1 0 10200
    1 0  7320
    1 0  9960
    0 1     0
    1 0 11640
    0 1     0
    0 1     0
    1 0 13440
    1 0  4920
    0 1     0
    0 0     0
    0 0     0
    1 0  5880
    1 0 19200
    1 0 20400
    0 1     0
    1 0  9480
    0 1     0
    1 0  9000
    1 0 10368
    1 0 17188
    0 1     0
    1 0  8520
    0 0     0
    1 0  8820
    0 1     0
    1 0 10344
    0 0     0
    1 1 16800
    0 0     0
    1 0  2280
    1 0  6984
    1 0  9996
    1 0  6840
    0 1     0
    1 0 11280
    1 0  9720
    1 0 22280
    0 1     0
    0 1     0
    0 0     0
    0 1     0
    0 0     0
    1 0  8400
    1 0  7320
    0 1     0
    0 0     0
    1 0 12240
    1 0 23160
    1 0  8976
    0 1     0
    0 1     0
    0 0     0
    0 0     0
    1 0  6360
    0 1     0
    0 1     0
    0 1     0
    1 0 45900
    0 1     0
    0 1     0
    1 0  3360
    1 0  4800
    1 0  9144
    0 1     0
    1 0  7920
    1 0  8280
    1 1 16836
    1 0 11100
    0 1     0
    1 0 11052
    0 1     0
    1 0  3560
    0 0     0
    0 1     0
    0 0     0
    1 0 15108
    0 0     0
    0 1     0
    0 0     0
    1 0  4800
    1 0 10344
    0 1     0
    0 1     0
    1 0  5520
    1 0 12674
    0 1     0
    0 1     0
    1 0 11640
    1 0  9960
    end
    I-------------------------+
    | Rent Detach~e SH003 |
    |-------------------------|
    1. | 0 0 0 |
    2. | 0 0 0 |
    3. | 1 0 11460 |
    4. | 0 1 0 |
    5. | 1 0 15200 |
    |-------------------------|
    6. | 1 0 10560 |
    7. | 1 1 14160 |
    8. | 0 0 0 |
    9. | 0 1 0 |
    10. | 1 0 10488 |
    -------------------------+
    | Rent Detach~e SH003 |
    |-------------------------|
    1. | 0 0 0 |
    2. | 0 0 0 |
    3. | 1 0 11460 |
    4. | 0 1 0 |
    5. | 1 0 15200 |
    |-------------------------|
    6. | 1 0 10560 |
    7. | 1 1 14160 |
    8. | 0 0 0 |
    9. | 0 1 0 |
    10. | 1 0 10488 |

  • #2
    Code:
    gen group = cond(Rent ==1 & DetachedHouse ==1, 1, cond(Rent ==1 & DetachedHouse=0, 0, .)) 
    
    ttest SH03, by(group)
    The warnings apply to check out that what is fed to a t test is good food for a t test.

    Comment

    Working...
    X