Announcement

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

  • Intra-household Data Analysis

    Hello All!
    I am analyzing an intra-household survey where a HUSBAND AND WIFE in the SAME HOUSEHOLD were asked the same question about adoption of agricultural technology separately. What I want is a command to get the various responses from the husband and wife in the same household. That is, (i) if both- husband and wife adopted (ii) husband adopted, but wife did not (iii) wife adopted, but husband did not adopt.
    dataex hhid genderid agroadopt fenceadopt terradopt chanadopt mintadopt FYMadopt I appreciate your wonderful support. Thanks
    Last edited by Kodwo Mensah; 29 Apr 2017, 10:53.

  • #2
    Without seeing the data example it isn't possible to help. It appears that you made some attempt to use -dataex-, for which thanks, but apparently it was not done quite correctly. Please re-post with the data example.

    Comment


    • #3
      @ Clyde,
      Thanks.. kindly assist me on how to use the -dataex- since what i
      know failed to upload my data. thanks

      Comment


      • #4
        First, make sure you have the -dataex- command installed. Run -ssc install dataex-. Then run -help dataex-: read and follow the instructions. They are simple and clear.

        Comment


        • #5
          Ok .. i have already installed -dataex-
          Last edited by Kodwo Mensah; 29 Apr 2017, 12:44.

          Comment


          • #6
            Code:
            * Example generated by -dataex-. To install: ssc install dataex
            clear
            input int hhid byte genderid float(agroadopt fenceadopt terradopt chanadopt mintadopt FYMadopt)
             1 1 1 1 0 0 0 0
             1 0 0 0 0 0 0 0
             2 1 0 0 0 0 0 0
             2 0 0 0 0 0 0 0
             3 1 0 0 0 0 0 0
             4 1 0 1 0 0 1 1
             4 0 0 0 0 1 0 0
             5 1 0 0 0 0 1 0
             5 0 0 0 0 1 0 0
             6 1 0 0 0 0 0 0
             6 0 0 1 0 0 0 0
             7 1 0 0 0 0 0 0
             7 0 0 0 0 0 1 0
             8 1 0 0 0 1 0 1
             8 0 0 0 0 1 0 0
             9 1 0 0 0 0 0 0
             9 0 0 0 0 0 0 0
            10 1 0 0 0 0 0 0
            10 0 0 0 0 1 0 0
            11 1 0 0 0 0 0 0
            11 0 0 0 0 0 0 0
            12 1 0 0 0 0 0 0
            12 0 0 0 0 0 0 0
            13 1 0 0 0 1 0 0
            13 0 0 0 0 0 0 0
            14 1 0 0 0 0 0 0
            14 0 0 0 0 0 0 1
            15 1 0 0 0 0 0 0
            15 0 0 0 0 0 0 0
            16 1 0 0 0 0 0 0
            16 0 0 0 1 0 0 0
            17 1 0 0 0 0 0 0
            17 0 0 0 0 0 1 0
            18 1 0 0 0 0 0 0
            18 0 0 0 0 0 0 0
            19 1 0 0 0 1 0 0
            19 0 0 0 0 0 0 0
            20 1 0 1 0 0 0 1
            20 0 0 0 1 0 0 1
            21 1 0 0 0 0 1 0
            21 0 0 0 1 1 1 0
            22 1 0 1 0 0 0 0
            22 0 1 0 0 0 0 0
            23 1 0 1 0 1 0 0
            23 0 0 0 0 1 0 0
            24 0 0 0 0 1 0 0
            25 1 0 0 0 0 0 0
            25 0 0 0 0 0 0 0
            26 1 0 0 0 0 0 0
            26 0 0 0 0 0 0 0
            27 1 1 1 0 0 1 0
            27 0 0 1 0 0 0 0
            28 1 0 0 0 0 0 0
            29 1 0 0 0 0 0 0
            29 0 0 0 0 1 1 1
            30 1 0 0 0 1 0 0
            31 1 0 0 0 1 0 0
            31 0 0 0 0 0 0 0
            32 0 0 0 0 0 1 1
            33 0 0 0 0 0 0 0
            34 1 0 0 0 0 0 0
            34 0 0 0 0 0 0 0
            35 1 1 0 0 0 0 0
            35 0 0 0 0 0 0 0
            36 1 1 0 0 0 1 0
            36 0 1 0 0 0 0 0
            37 1 1 1 0 0 0 0
            37 0 0 0 0 0 0 0
            38 1 0 0 0 0 0 0
            38 0 0 0 0 0 0 0
            39 1 0 1 0 1 0 0
            39 0 0 0 0 1 0 0
            40 1 0 1 0 0 0 0
            40 0 0 0 0 1 0 0
            41 1 0 0 0 0 0 0
            41 0 1 0 0 1 0 0
            42 1 0 0 0 0 0 0
            42 0 0 0 0 0 1 0
            43 1 0 0 0 0 0 0
            43 0 0 0 0 0 0 0
            44 1 0 0 0 0 1 0
            44 0 0 0 0 1 0 0
            45 1 0 0 0 0 0 0
            45 0 0 1 0 0 0 0
            46 1 1 0 0 0 0 0
            46 0 1 1 0 0 0 0
            47 1 0 1 0 0 0 0
            47 0 0 1 0 0 0 0
            48 1 0 0 0 0 0 0
            48 0 0 0 0 0 0 0
            49 1 0 1 0 0 1 0
            49 0 0 0 0 0 0 0
            50 1 0 1 0 0 1 0
            50 0 0 0 0 0 0 0
            51 1 0 0 0 0 1 1
            51 0 0 0 0 1 0 0
            52 0 0 0 0 1 1 0
            53 1 0 1 0 1 0 0
            54 1 0 0 0 1 0 0
            54 0 0 0 0 0 0 0
            end
            ------------------
            NB: hhid is the Household id, genderid= 1 if man/husband, 0 woman/wife, agroadopt and other -adopt- 1 = adopted, 0 = didnt adopt

            Comment


            • #7
              @ Clyde, please find the data produced from -dataex- and assist. Thanks

              Comment


              • #8
                So, there is a problem. Within your example data, there are 8 households in which there is only a husband or only a wife. So it is unclear how to apply "both husband and wife adopt" or "husband only" or "wife only" in these situations. The code below returns missing values for those households.

                Code:
                //    VERIFY ONLY ONE OF EACH GENDER PER HOUSEHOLD
                isid hhid genderid, sort
                
                //    CALCULATE REQUESTED VARIABLES
                foreach v of varlist *adopt {
                    by hhid (genderid): egen byte both_`v' = min(`v')
                    by hhid (genderid): replace both_`v' = . if _N < 2
                    by hhid (genderid): gen byte h_only_`v' = `v'[2] & !`v'[1] if _N == 2
                    by hhid (genderid): gen byte w_only_`v' = `v'[1] & !`v'[2] if _N == 2
                }

                Comment


                • #9
                  Clyde Schechter Your code worked...... Thanks very much. You have really helped me with this code and I AM VERY GRATEFUL.

                  Yea.. I know of the problem you have indicated, however, I will do the analysis for only _N== 2.
                  THANKS AGAIN

                  Comment


                  • #10
                    Here is another approach. With the data example, we can go

                    Code:
                    foreach v in agro fence terr chan mint { 
                         bysort hhid (genderid) : gen `v' = `v'adopt[1] + 2 * `v'adopt[2] 
                    } 
                    
                    tabdisp hhid , c(agro fence terr chan mint) 
                    
                    ----------------------------------------------------------------------
                         hhid |       agro       fence        terr        chan        mint
                    ----------+-----------------------------------------------------------
                            1 |          2           2           0           0           0
                            2 |          0           0           0           0           0
                            3 |                                                           
                            4 |          0           2           0           1           2
                            5 |          0           0           0           1           2
                            6 |          0           1           0           0           0
                            7 |          0           0           0           0           1
                            8 |          0           0           0           3           0
                            9 |          0           0           0           0           0
                           10 |          0           0           0           1           0
                           11 |          0           0           0           0           0
                           12 |          0           0           0           0           0
                           13 |          0           0           0           2           0
                           14 |          0           0           0           0           0
                           15 |          0           0           0           0           0
                           16 |          0           0           1           0           0
                           17 |          0           0           0           0           1
                           18 |          0           0           0           0           0
                           19 |          0           0           0           2           0
                           20 |          0           2           1           0           0
                           21 |          0           0           1           1           3
                           22 |          1           2           0           0           0
                           23 |          0           2           0           3           0
                           24 |                                                           
                           25 |          0           0           0           0           0
                           26 |          0           0           0           0           0
                           27 |          2           3           0           0           2
                           28 |                                                           
                           29 |          0           0           0           1           1
                           30 |                                                           
                           31 |          0           0           0           2           0
                           32 |                                                           
                           33 |                                                           
                           34 |          0           0           0           0           0
                           35 |          2           0           0           0           0
                           36 |          3           0           0           0           2
                           37 |          2           2           0           0           0
                           38 |          0           0           0           0           0
                           39 |          0           2           0           3           0
                           40 |          0           2           0           1           0
                           41 |          1           0           0           1           0
                           42 |          0           0           0           0           1
                           43 |          0           0           0           0           0
                           44 |          0           0           0           1           2
                           45 |          0           1           0           0           0
                           46 |          3           1           0           0           0
                           47 |          0           3           0           0           0
                           48 |          0           0           0           0           0
                           49 |          0           2           0           0           2
                           50 |          0           2           0           0           2
                           51 |          0           0           0           1           2
                           52 |                                                           
                           53 |                                                           
                           54 |          0           0           0           2           0
                    ----------------------------------------------------------------------
                    This produces a slightly arbitrary coding

                    0 if neither husband and wife adopt
                    1 if wife adopts only
                    2 if husband adopts only
                    3 if both adopt

                    and ignores households without two spouses as for such households any references to variables with subscript [2] return missing.

                    For more in this territory, see http://www.stata-journal.com/sjpdf.h...iclenum=dm0043 and reference here to dm0043

                    Comment


                    • #11
                      @Cox, thanks very much... APPRECIATED

                      Comment

                      Working...
                      X