Announcement

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

  • Factor Analysis for Customer Segmentation

    I have done FA and identified the number of segments. However, I am unable to assign each respondent/customer to their respective segments. Which commands do I employ to know which customer belongs to which segment? Thank you!

  • #2
    This is a sample of the data. Any help?
    Factor Scores
    msisdn segment1 segment2 segment3
    2547XXX00089 -0.7061259 0.7561764 -0.5012773
    2547XXX00166 -0.5387881 -0.4082444 -0.3945845
    2547XXX00276 1.010173 -0.4363912 -0.8984265
    2547XXX00354 3.597936 -1.093228 -0.7263654
    2547XXX00870 2.114979 -0.8113762 -0.4151164
    2547XXX01098 0.4986656 -0.4553042 0.1930395

    Comment


    • #3
      It sounds like you have a bunch of indicators that you ran through a factor analysis. The unit of observation is the customer. You now have factor scores for each customer.

      As far as I know, exploratory factor analysis does not assign observations to factors. You can manually assign indicators to factors, or you can use the factor scores to calculate each person's score on each factor (as you did). The concept is not relevant as far as I know. What do you do if someone is high in two factors, or high in all 3, or low in all 3?

      I'm aware of a method called Q-methodology, which is qualitatively based but which does (I think) use traditional FA techniques to assign people to factors (actually, it was described to me as the subjects being the columns, and the themes being the rows). Alternatively, latent class analysis will assign observations to latent classes based on your indicators, and it's a rather different method.
      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


      • #4
        I am not an expert here, but from the following web page, you have:

        Factor Segmentation

        Factor segmentation is based on factor analysis. The first step is to factor-analyze or form groups of attributes that express some sort of common theme. The number of factors is determined using a combination of statistics and knowledge of the category. Once the number of factors has been determined, each respondent receives a score for each of the factors. Respondents are then assigned to the factor that has the highest score.
        This implies that you just place the respondent in the segment where the (absolute score) is highest.

        Code:
        *Example generated by -dataex-. To install: ssc install dataex
        clear
        input str12 msisdn float(segment1 segment2 segment3)
        "2547XXX00089" -.7061259  .7561764 -.5012773
        "2547XXX00166" -.5387881 -.4082444 -.3945845
        "2547XXX00276"  1.010173 -.4363912 -.8984265
        "2547XXX00354"  3.597936 -1.093228 -.7263654
        "2547XXX00870"  2.114979 -.8113762 -.4151164
        "2547XXX01098"  .4986656 -.4553042  .1930395
        end
        
         forval i=1/3{
         gen Segment`i'= abs(segment`i')
         }
        
        egen max= rowmax(Segment*)
        gen allocation=""
        foreach var of varlist Segment1- Segment3{
        replace allocation =lower("`var'") if max==`var'
        }
        
        drop Segment*

        Result:

        Code:
        . l, clean
        
                     msisdn    segment1    segment2    segment3        max   alloca~n  
          1.   2547XXX00089   -.7061259    .7561764   -.5012773   .7561764   segment2  
          2.   2547XXX00166   -.5387881   -.4082444   -.3945845   .5387881   segment1  
          3.   2547XXX00276    1.010173   -.4363912   -.8984265   1.010173   segment1  
          4.   2547XXX00354    3.597936   -1.093228   -.7263654   3.597936   segment1  
          5.   2547XXX00870    2.114979   -.8113762   -.4151164   2.114979   segment1  
          6.   2547XXX01098    .4986656   -.4553042    .1930395   .4986656   segment1

        Comment


        • #5
          You are right, I ran a number of indicators and after running some post-estimation tests like screeplot, Kaiser’s criterion and Jolliffe’s criterion, I settled on 3 customers segments. So I re-ran FA again but fixed it to pf(3) (pca, mle and ipf had issues) then ran “predict segment*” which generated the factor scores as you have mentioned. Then am stuck, can’t figure out how to assign the customers to their respective segments.

          By latent class analysis (LCA), you mean I try out structural equation modeling (SEM)? See below some of the indicators I used; not sure I have posted in right format


          Code:
          . dataex p2p_send_mnth p2p_receive_mnth airtime_self_mnth deposits_mnth c2b_pay_bill_mnth sms_revn_mnth
          copy starting from the next line -----------------------
          Code:
          * Example generated by -dataex-. To install: ssc install dataex
          clear
          input float(p2p_send_mnth p2p_receive_mnth airtime_self_mnth deposits_mnth c2b_pay_bill_mnth sms_revn_mnth)
          .8333333  3.166667  .8333333  .8333333       1.5  50.66667
          0         1  3.666667         0  .6666667 36.666668
          4       6.5  9.166667  .3333333  .8333333     250.5
          7.5  6.333333 22.333334  8.833333 2.1666667  77.33334
          6.666667 1.8333334  2.833333         2         0 244.66667
          24.833334 2.3333333  8.833333 1.3333334 1.1666666  410.3333
          7.8       7.4       6.6       4.2       9.2     221.3
          17.5       3.5 10.166667 2.1666667         2 146.33333
          2.833333  .8333333      14.5       2.5  .6666667 26.333334
          7.333333  8.166667  5.333333        .5  .3333333  480.6667
          4.833333       2.5 13.333333       1.5 11.166667  .8333333
          6.5      19.5 22.833334         1         0  409.6667
          64.333336 28.666666        25 2.1666667 21.833334  57.83333
          1.6666666         5        11         1         0         1
          1.5 4.6666665       2.5        .5 1.3333334  .8333333
          3.333333  6.333333  3.833333 19.166666        24  8.833333
          7.333333  6.166667 28.166666       3.5  .3333333    150.25
          8.5  3.833333       6.5  2.833333 12.166667 10.833333
          4       6.5  7.666667 2.3333333 2.1666667       159
          0         1      2.75       .25         0     73.75
          2.1666667  .3333333  4.833333         1         0  3.666667
          1.5       4.5         3  5.666667 31.666666     130.5
          1      1.25      4.25        .5      4.25        .5
          .6666667  .6666667         0  .6666667         0 4.3333335
          3.833333 4.3333335  8.666667  .3333333         0  6.833333
          3.166667  4.833333        18 1.8333334        .5 75.166664
          5.5  7.333333 1.3333334  2.833333       3.5  2.666667
          15.166667 11.166667        29 11.833333 18.166666 30.666666
          5.833333       2.5 11.166667  7.666667       1.5  3.333333
          1 2.1666667 1.3333334  .3333333         0  .3333333
          0         0 1.6666666         0         0 1.6666666
          8      3.75        .5       .25         0     10.25
          4.5       4.5       7.5 1.6666666         1  46.66667
          .6       1.4       5.4        .4         0      14.6
          9.5  5.833333 17.833334  2.666667         0 18.666666
          .3333333  .3333333  .3333333  .3333333         0        74
          15 27.166666      46.5         0         0  547.1667
          4.1666665         2 .16666667         1         0  .3333333
          7.833333  .8333333  5.166667 1.1666666 .16666667         2
          1.5         2        15        16 17.666666 17.333334
          6.833333  2.666667  2.833333  3.166667 2.1666667  89.33334
          11  9.666667         3  3.166667 1.8333334  3.166667
          1.2        .8         1        .8         0       7.8
          0  .3333333         3  5.333333         0  3.666667
          3.666667 10.833333       3.5        15  53.33333  6.166667
          .8       1.2        .2        .8         0       4.6
          3  .6666667 13.166667 1.3333334         0        88
          31.166666  6.833333 23.166666 4.6666665 13.833333     168.5
          .8       1.4         0        .2         0        .2
          0       1.4       1.2         0         0      16.2
          9.666667 13.833333  6.833333 1.3333334       1.5  98.16666
          15.166667  7.166667      15.5       3.5 12.666667      10.5
          5.333333         4  4.833333 1.1666666  .6666667  95.66666
          0       3.6       1.8         0         0      26.2
          9.5 13.833333 69.166664         0 1.1666666 73.166664
          0        25         0         0         0         0
          2         2         2  .6666667         0  6.666667
          2.2        .6       3.4       1.6       2.4         3
          8.833333  6.333333        36 4.1666665 1.1666666 12.333333
          .75        .5         1         0         0         0
          7.333333         3         2         4         0    189.25
          .8333333 1.6666666         2 1.6666666         2       2.5
          1.1666666 1.3333334  5.666667  .6666667  .3333333 25.666666
          .8       1.4       1.8        .6         0        .8
          .3333333         3         5         0         0         5
          20.5  5.333333 13.666667  7.666667         0  5.833333
          1.75       4.5      9.25      2.25         4      6.75
          8.5       3.5  4.833333 2.1666667         0 10.833333
          3.5  2.666667  7.166667  3.333333  3.666667       124
          0  5.333333  .3333333  .3333333         0  .3333333
          4       2.5        .5 1.6666666         0 116.66666
          0 1.6666666 1.6666666         0         0         1
          5        32      17.5         1        12        53
          4  6.666667  7.333333         0         0 161.66667
          11.833333        13        21 2.3333333         9  46.33333
          .5         0  6.666667 .16666667         0  9.333333
          4.3333335  8.333333        16       1.5 1.8333334  51.16667
          1 13.666667  8.666667 1.6666666       3.5     243.5
          1 1.8333334  2.666667         1  .3333333 20.333334
          .4       3.8       6.8       3.6         6      89.6
          14.666667 10.166667      49.5  .6666667        .5  99.33334
          6.166667  5.166667 13.833333 2.3333333      16.5 11.333333
          4  5.166667  3.666667         0         0         1
          1.5      2.75      10.5      5.75      11.5    262.25
          4.3333335         0         1  .3333333         0  95.33334
          5.166667         3  3.666667  5.333333         6  9.666667
          .5  6.833333  .3333333         0 .16666667 .16666667
          2.5  3.833333  2.833333       2.5         0  56.83333
          4.5       1.5  41.16667         6      10.5     328.5
          1  .6666667 2.1666667 1.3333334 1.6666666       195
          .6666667 11.333333  5.166667 .16666667         0 36.333332
          .16666667       5.5 1.3333334 .16666667         0         1
          .4       3.2        .4         0         0        .2
          26.333334 4.6666665        19  6.333333         3 65.666664
          5.5 4.6666665      14.5  .6666667         0 1.8333334
          1.2       1.2         2        .8         0      21.4
          0         0 15.166667 12.666667        19        10
          0  .6666667         0  .3333333         0 4.3333335
          1.6      10.2       2.2        .2         0       3.2
          7.333333       2.5  8.166667  8.833333         4  7.333333
          end
          copy up to and including the previous line ------------------

          Listed 100 out of 138342 observations
          Use the count() option to list more

          .

          Comment


          • #6
            @Weiwen, You are right, I ran a number of indicators and after running some post-estimation tests like screeplot, Kaiser’s criterion and Jolliffe’s criterion, I settled on 3 customers segments. So I re-ran FA again but fixed it to pf(3) (pca, mle and ipf had issues) then ran “predict segment*” which generated the factor scores as you have mentioned. Then am stuck, can’t figure out how to assign the customers to their respective segments.

            By latent class analysis (LCA), you mean I try out structural equation modeling (SEM)? See below some of the indicators I used; not sure I have posted in right format


            Code:
            . dataex p2p_send_mnth p2p_receive_mnth airtime_self_mnth deposits_mnth c2b_pay_bill_mnth sms_revn_mnth
            copy starting from the next line -----------------------
            Code:
            * Example generated by -dataex-. To install: ssc install dataex
            clear
            input float(p2p_send_mnth p2p_receive_mnth airtime_self_mnth deposits_mnth c2b_pay_bill_mnth sms_revn_mnth)
            .8333333  3.166667  .8333333  .8333333       1.5  50.66667
            0         1  3.666667         0  .6666667 36.666668
            4       6.5  9.166667  .3333333  .8333333     250.5
            7.5  6.333333 22.333334  8.833333 2.1666667  77.33334
            6.666667 1.8333334  2.833333         2         0 244.66667
            24.833334 2.3333333  8.833333 1.3333334 1.1666666  410.3333
            7.8       7.4       6.6       4.2       9.2     221.3
            17.5       3.5 10.166667 2.1666667         2 146.33333
            2.833333  .8333333      14.5       2.5  .6666667 26.333334
            7.333333  8.166667  5.333333        .5  .3333333  480.6667
            4.833333       2.5 13.333333       1.5 11.166667  .8333333
            6.5      19.5 22.833334         1         0  409.6667
            64.333336 28.666666        25 2.1666667 21.833334  57.83333
            1.6666666         5        11         1         0         1
            1.5 4.6666665       2.5        .5 1.3333334  .8333333
            3.333333  6.333333  3.833333 19.166666        24  8.833333
            7.333333  6.166667 28.166666       3.5  .3333333    150.25
            8.5  3.833333       6.5  2.833333 12.166667 10.833333
            4       6.5  7.666667 2.3333333 2.1666667       159
            0         1      2.75       .25         0     73.75
            2.1666667  .3333333  4.833333         1         0  3.666667
            1.5       4.5         3  5.666667 31.666666     130.5
            1      1.25      4.25        .5      4.25        .5
            .6666667  .6666667         0  .6666667         0 4.3333335
            3.833333 4.3333335  8.666667  .3333333         0  6.833333
            3.166667  4.833333        18 1.8333334        .5 75.166664
            5.5  7.333333 1.3333334  2.833333       3.5  2.666667
            15.166667 11.166667        29 11.833333 18.166666 30.666666
            5.833333       2.5 11.166667  7.666667       1.5  3.333333
            1 2.1666667 1.3333334  .3333333         0  .3333333
            0         0 1.6666666         0         0 1.6666666
            8      3.75        .5       .25         0     10.25
            4.5       4.5       7.5 1.6666666         1  46.66667
            .6       1.4       5.4        .4         0      14.6
            9.5  5.833333 17.833334  2.666667         0 18.666666
            .3333333  .3333333  .3333333  .3333333         0        74
            15 27.166666      46.5         0         0  547.1667
            4.1666665         2 .16666667         1         0  .3333333
            7.833333  .8333333  5.166667 1.1666666 .16666667         2
            1.5         2        15        16 17.666666 17.333334
            6.833333  2.666667  2.833333  3.166667 2.1666667  89.33334
            11  9.666667         3  3.166667 1.8333334  3.166667
            1.2        .8         1        .8         0       7.8
            0  .3333333         3  5.333333         0  3.666667
            3.666667 10.833333       3.5        15  53.33333  6.166667
            .8       1.2        .2        .8         0       4.6
            3  .6666667 13.166667 1.3333334         0        88
            31.166666  6.833333 23.166666 4.6666665 13.833333     168.5
            .8       1.4         0        .2         0        .2
            0       1.4       1.2         0         0      16.2
            9.666667 13.833333  6.833333 1.3333334       1.5  98.16666
            15.166667  7.166667      15.5       3.5 12.666667      10.5
            5.333333         4  4.833333 1.1666666  .6666667  95.66666
            0       3.6       1.8         0         0      26.2
            9.5 13.833333 69.166664         0 1.1666666 73.166664
            0        25         0         0         0         0
            2         2         2  .6666667         0  6.666667
            2.2        .6       3.4       1.6       2.4         3
            8.833333  6.333333        36 4.1666665 1.1666666 12.333333
            .75        .5         1         0         0         0
            7.333333         3         2         4         0    189.25
            .8333333 1.6666666         2 1.6666666         2       2.5
            1.1666666 1.3333334  5.666667  .6666667  .3333333 25.666666
            .8       1.4       1.8        .6         0        .8
            .3333333         3         5         0         0         5
            20.5  5.333333 13.666667  7.666667         0  5.833333
            1.75       4.5      9.25      2.25         4      6.75
            8.5       3.5  4.833333 2.1666667         0 10.833333
            3.5  2.666667  7.166667  3.333333  3.666667       124
            0  5.333333  .3333333  .3333333         0  .3333333
            4       2.5        .5 1.6666666         0 116.66666
            0 1.6666666 1.6666666         0         0         1
            5        32      17.5         1        12        53
            4  6.666667  7.333333         0         0 161.66667
            11.833333        13        21 2.3333333         9  46.33333
            .5         0  6.666667 .16666667         0  9.333333
            4.3333335  8.333333        16       1.5 1.8333334  51.16667
            1 13.666667  8.666667 1.6666666       3.5     243.5
            1 1.8333334  2.666667         1  .3333333 20.333334
            .4       3.8       6.8       3.6         6      89.6
            14.666667 10.166667      49.5  .6666667        .5  99.33334
            6.166667  5.166667 13.833333 2.3333333      16.5 11.333333
            4  5.166667  3.666667         0         0         1
            1.5      2.75      10.5      5.75      11.5    262.25
            4.3333335         0         1  .3333333         0  95.33334
            5.166667         3  3.666667  5.333333         6  9.666667
            .5  6.833333  .3333333         0 .16666667 .16666667
            2.5  3.833333  2.833333       2.5         0  56.83333
            4.5       1.5  41.16667         6      10.5     328.5
            1  .6666667 2.1666667 1.3333334 1.6666666       195
            .6666667 11.333333  5.166667 .16666667         0 36.333332
            .16666667       5.5 1.3333334 .16666667         0         1
            .4       3.2        .4         0         0        .2
            26.333334 4.6666665        19  6.333333         3 65.666664
            5.5 4.6666665      14.5  .6666667         0 1.8333334
            1.2       1.2         2        .8         0      21.4
            0         0 15.166667 12.666667        19        10
            0  .6666667         0  .3333333         0 4.3333335
            1.6      10.2       2.2        .2         0       3.2
            7.333333       2.5  8.166667  8.833333         4  7.333333
            end
            copy up to and including the previous line ------------------

            Listed 100 out of 138342 observations
            Use the count() option to list more

            .

            Comment


            • #7
              Originally posted by Nambuwani Wasike View Post
              You are right, I ran a number of indicators and after running some post-estimation tests like screeplot, Kaiser’s criterion and Jolliffe’s criterion, I settled on 3 customers segments. So I re-ran FA again but fixed it to pf(3) (pca, mle and ipf had issues) then ran “predict segment*” which generated the factor scores as you have mentioned. Then am stuck, can’t figure out how to assign the customers to their respective segments.

              ...
              As I said, I don't think that this action is relevant in EFA, because the goal of EFA is to classify indicators, not persons. If that's not clear, can you say what isn't clear about my response in post #2? Alternatively, can you show me some papers where researchers assign observations to specific factors after EFA (or say that they are dominant in one factor)?

              Let's take an example from your first post:

              Factor Scores
              msisdn segment1 segment2 segment3
              Mrs Smith -0.7061259 0.7561764 -0.5012773
              Mrs Johnson -0.5387881 -0.4082444 -0.3945845
              Mrs Chen 1.010173 -0.4363912 -0.8984265
              Mrs Andersen 3.597936 -1.093228 -0.7263654
              Mrs Jensen 2.114979 -0.8113762 -0.4151164
              Mrs Kim 0.4986656 -0.4553042 0.1930395
              To challenge you to think a bit more about the question you're asking: Mrs Andersen and Mrs Jensen are clearly high in segment 1, and pretty low in the other two, and Mrs Chen is somewhat like them but lower in factor 1. Taking things just at face value, how would you characterize Mrs Smith, Mrs Johnson, and Mrs Kim? What do you expect to see?
              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


              • #8
                As Weiwen Ng wrote, you normally use exploratory factor analysis (EFA) for a "by-variable" factor analysis, which does not identify clusters of people but rather identifies clusters of related variables.

                You can, however, use "by-person" factor analysis (usually called Q-mode factor analysis) to identify clusters of people rather than of variables. To do that, you simply transpose the data set and then conduct EFA on the transposed data, as I show below. (You can google to learn about Q-mode factor analysis.)

                After you have performed Q-mode factor analysis by conducting an EFA on the tranposed data, you can assign cases to the factor on which they have the highest positive factor loading (perhaps requiring a minimum criterion loading such lambda >= .40 in order for a case to be classified). You may set whatever criteria serve your purpose if the simple maximum loading criterion is not sufficient for your needs.

                Here's an example with the data you provided.

                Code:
                * Example generated by -dataex-. To install: ssc install dataex
                clear
                input float(p2p_send_mnth p2p_receive_mnth airtime_self_mnth deposits_mnth c2b_pay_bill_mnth sms_revn_mnth)
                .8333333  3.166667  .8333333  .8333333       1.5  50.66667
                0         1  3.666667         0  .6666667 36.666668
                4       6.5  9.166667  .3333333  .8333333     250.5
                7.5  6.333333 22.333334  8.833333 2.1666667  77.33334
                6.666667 1.8333334  2.833333         2         0 244.66667
                24.833334 2.3333333  8.833333 1.3333334 1.1666666  410.3333
                7.8       7.4       6.6       4.2       9.2     221.3
                17.5       3.5 10.166667 2.1666667         2 146.33333
                2.833333  .8333333      14.5       2.5  .6666667 26.333334
                7.333333  8.166667  5.333333        .5  .3333333  480.6667
                4.833333       2.5 13.333333       1.5 11.166667  .8333333
                6.5      19.5 22.833334         1         0  409.6667
                64.333336 28.666666        25 2.1666667 21.833334  57.83333
                1.6666666         5        11         1         0         1
                1.5 4.6666665       2.5        .5 1.3333334  .8333333
                3.333333  6.333333  3.833333 19.166666        24  8.833333
                7.333333  6.166667 28.166666       3.5  .3333333    150.25
                8.5  3.833333       6.5  2.833333 12.166667 10.833333
                4       6.5  7.666667 2.3333333 2.1666667       159
                0         1      2.75       .25         0     73.75
                2.1666667  .3333333  4.833333         1         0  3.666667
                1.5       4.5         3  5.666667 31.666666     130.5
                1      1.25      4.25        .5      4.25        .5
                .6666667  .6666667         0  .6666667         0 4.3333335
                3.833333 4.3333335  8.666667  .3333333         0  6.833333
                3.166667  4.833333        18 1.8333334        .5 75.166664
                5.5  7.333333 1.3333334  2.833333       3.5  2.666667
                15.166667 11.166667        29 11.833333 18.166666 30.666666
                5.833333       2.5 11.166667  7.666667       1.5  3.333333
                1 2.1666667 1.3333334  .3333333         0  .3333333
                0         0 1.6666666         0         0 1.6666666
                8      3.75        .5       .25         0     10.25
                4.5       4.5       7.5 1.6666666         1  46.66667
                .6       1.4       5.4        .4         0      14.6
                9.5  5.833333 17.833334  2.666667         0 18.666666
                .3333333  .3333333  .3333333  .3333333         0        74
                15 27.166666      46.5         0         0  547.1667
                4.1666665         2 .16666667         1         0  .3333333
                7.833333  .8333333  5.166667 1.1666666 .16666667         2
                1.5         2        15        16 17.666666 17.333334
                6.833333  2.666667  2.833333  3.166667 2.1666667  89.33334
                11  9.666667         3  3.166667 1.8333334  3.166667
                1.2        .8         1        .8         0       7.8
                0  .3333333         3  5.333333         0  3.666667
                3.666667 10.833333       3.5        15  53.33333  6.166667
                .8       1.2        .2        .8         0       4.6
                3  .6666667 13.166667 1.3333334         0        88
                31.166666  6.833333 23.166666 4.6666665 13.833333     168.5
                .8       1.4         0        .2         0        .2
                0       1.4       1.2         0         0      16.2
                9.666667 13.833333  6.833333 1.3333334       1.5  98.16666
                15.166667  7.166667      15.5       3.5 12.666667      10.5
                5.333333         4  4.833333 1.1666666  .6666667  95.66666
                0       3.6       1.8         0         0      26.2
                9.5 13.833333 69.166664         0 1.1666666 73.166664
                0        25         0         0         0         0
                2         2         2  .6666667         0  6.666667
                2.2        .6       3.4       1.6       2.4         3
                8.833333  6.333333        36 4.1666665 1.1666666 12.333333
                .75        .5         1         0         0         0
                7.333333         3         2         4         0    189.25
                .8333333 1.6666666         2 1.6666666         2       2.5
                1.1666666 1.3333334  5.666667  .6666667  .3333333 25.666666
                .8       1.4       1.8        .6         0        .8
                .3333333         3         5         0         0         5
                20.5  5.333333 13.666667  7.666667         0  5.833333
                1.75       4.5      9.25      2.25         4      6.75
                8.5       3.5  4.833333 2.1666667         0 10.833333
                3.5  2.666667  7.166667  3.333333  3.666667       124
                0  5.333333  .3333333  .3333333         0  .3333333
                4       2.5        .5 1.6666666         0 116.66666
                0 1.6666666 1.6666666         0         0         1
                5        32      17.5         1        12        53
                4  6.666667  7.333333         0         0 161.66667
                11.833333        13        21 2.3333333         9  46.33333
                .5         0  6.666667 .16666667         0  9.333333
                4.3333335  8.333333        16       1.5 1.8333334  51.16667
                1 13.666667  8.666667 1.6666666       3.5     243.5
                1 1.8333334  2.666667         1  .3333333 20.333334
                .4       3.8       6.8       3.6         6      89.6
                14.666667 10.166667      49.5  .6666667        .5  99.33334
                6.166667  5.166667 13.833333 2.3333333      16.5 11.333333
                4  5.166667  3.666667         0         0         1
                1.5      2.75      10.5      5.75      11.5    262.25
                4.3333335         0         1  .3333333         0  95.33334
                5.166667         3  3.666667  5.333333         6  9.666667
                .5  6.833333  .3333333         0 .16666667 .16666667
                2.5  3.833333  2.833333       2.5         0  56.83333
                4.5       1.5  41.16667         6      10.5     328.5
                1  .6666667 2.1666667 1.3333334 1.6666666       195
                .6666667 11.333333  5.166667 .16666667         0 36.333332
                .16666667       5.5 1.3333334 .16666667         0         1
                .4       3.2        .4         0         0        .2
                26.333334 4.6666665        19  6.333333         3 65.666664
                5.5 4.6666665      14.5  .6666667         0 1.8333334
                1.2       1.2         2        .8         0      21.4
                0         0 15.166667 12.666667        19        10
                0  .6666667         0  .3333333         0 4.3333335
                1.6      10.2       2.2        .2         0       3.2
                7.333333       2.5  8.166667  8.833333         4  7.333333
                end
                
                
                * Put variable names into local
                ds
                local vlist = r(varlist)
                di "`vlist'"
                
                
                * Transpose the data set so that cases become variables and variables become cases.
                xpose, clear
                
                
                * Rename case variables.
                rename v* case*
                
                
                * Create variable name variable.
                cap drop indicator
                gen str18 indicator = ""
                tokenize "`vlist'"
                forval i = 1/`=wordcount("`vlist'")' {
                  replace indicator = "``i''" in `i'
                  }
                order indicator
                list indicator, sep(0) noobs
                  
                
                * Factor analyze the transposed data set,
                * retaining factors with eigenvalues GE 1.
                factor case*, mineigen(1)
                
                
                * Rotate the factor loadings orthogonally using varimax with Kaiser normalization.
                rotate, varimax norm
                
                
                * Assign cases to factor on which they have the highest loading or using some other classification criteria.

                Hope that helps.

                Red Owl
                Stata/IC 15.1, Windows 10 (64-bit)

                Comment


                • #9
                  Originally posted by Andrew Musau View Post
                  I am not an expert here, but from the following web page, you have:



                  This implies that you just place the respondent in the segment where the (absolute score) is highest.

                  Code:
                  *Example generated by -dataex-. To install: ssc install dataex
                  clear
                  input str12 msisdn float(segment1 segment2 segment3)
                  "2547XXX00089" -.7061259 .7561764 -.5012773
                  "2547XXX00166" -.5387881 -.4082444 -.3945845
                  "2547XXX00276" 1.010173 -.4363912 -.8984265
                  "2547XXX00354" 3.597936 -1.093228 -.7263654
                  "2547XXX00870" 2.114979 -.8113762 -.4151164
                  "2547XXX01098" .4986656 -.4553042 .1930395
                  end
                  
                  forval i=1/3{
                  gen Segment`i'= abs(segment`i')
                  }
                  
                  egen max= rowmax(Segment*)
                  gen allocation=""
                  foreach var of varlist Segment1- Segment3{
                  replace allocation =lower("`var'") if max==`var'
                  }
                  
                  drop Segment*

                  Result:

                  Code:
                  . l, clean
                  
                  msisdn segment1 segment2 segment3 max alloca~n
                  1. 2547XXX00089 -.7061259 .7561764 -.5012773 .7561764 segment2
                  2. 2547XXX00166 -.5387881 -.4082444 -.3945845 .5387881 segment1
                  3. 2547XXX00276 1.010173 -.4363912 -.8984265 1.010173 segment1
                  4. 2547XXX00354 3.597936 -1.093228 -.7263654 3.597936 segment1
                  5. 2547XXX00870 2.114979 -.8113762 -.4151164 2.114979 segment1
                  6. 2547XXX01098 .4986656 -.4553042 .1930395 .4986656 segment1
                  @Musau, thank you for this. I have used this and it has worked. Now trying out the Q-methodology as suggested by @Weiwen and Red Owl. Thanks!

                  Comment


                  • #10
                    One correction to the code in #4 that I should point out is that you should assign respondents to the factor that has the highest positive score and not highest absolute score. Thinking about it, absolute score makes no sense because you will be grouping respondents who are most satisfied with an attribute with those who are least satisfied. Therefore, the code simply reduces to:

                    Code:
                    * Example generated by -dataex-. To install: ssc install dataex
                    clear
                    input str12 msisdn float(segment1 segment2 segment3)
                    "2547XXX00089" -.7061259  .7561764 -.5012773
                    "2547XXX00166" -.5387881 -.4082444 -.3945845
                    "2547XXX00276"  1.010173 -.4363912 -.8984265
                    "2547XXX00354"  3.597936 -1.093228 -.7263654
                    "2547XXX00870"  2.114979 -.8113762 -.4151164
                    "2547XXX01098"  .4986656 -.4553042  .1930395
                    end
                    
                    egen max= rowmax(segment*)
                    gen allocation=""
                    foreach var of varlist segment1- segment3{
                    replace allocation ="`var'" if max==`var'
                    }

                    Comment


                    • #11
                      Originally posted by Andrew Musau View Post
                      One correction to the code in #4 that I should point out is that you should assign respondents to the factor that has the highest positive score and not highest absolute score. Thinking about it, absolute score makes no sense because you will be grouping respondents who are most satisfied with an attribute with those who are least satisfied. Therefore, the code simply reduces to:

                      Code:
                      * Example generated by -dataex-. To install: ssc install dataex
                      clear
                      input str12 msisdn float(segment1 segment2 segment3)
                      "2547XXX00089" -.7061259 .7561764 -.5012773
                      "2547XXX00166" -.5387881 -.4082444 -.3945845
                      "2547XXX00276" 1.010173 -.4363912 -.8984265
                      "2547XXX00354" 3.597936 -1.093228 -.7263654
                      "2547XXX00870" 2.114979 -.8113762 -.4151164
                      "2547XXX01098" .4986656 -.4553042 .1930395
                      end
                      
                      egen max= rowmax(segment*)
                      gen allocation=""
                      foreach var of varlist segment1- segment3{
                      replace allocation ="`var'" if max==`var'
                      }
                      Noted, but what happens to respondents who have negative factor scores on all the factors, like respondent 2547XXX00166 in my example above?

                      Comment


                      • #12
                        The syntax does not change, you assign the respondent to the factor whose score is least negative. The implication is that the respondent expresses dissatisfaction with attributes of all factors, but she is dissatisfied with attributes of some factors less than others. We thus assign her to the factor that has the lowest negative score.

                        Comment

                        Working...
                        X