Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Creating Peer Scores


From   Bobby Jo Otto <[email protected]>
To   [email protected]
Subject   st: Creating Peer Scores
Date   Tue, 30 Jul 2013 10:51:28 -0400

-----------------------------
Hello,

I have data in which a primary respondent (RESPID) has listed up to
ten friends who have each been assigned their own individual ID scores
(FRID1, FRID2, FRID3...). Like the primary respondent, the friends
have all answered questions about their behavior and activities, and I
created a score called DELINQ to measure these activities.  I would
like to combine the scores for all of the friends (as many as ten) to
develop a "peer" score for the primary respondent on the DELINQ
variable, presumably by summing the DELINQ variable for all of the
friends listed by the primary respondent.

I tried a loop code (see below), but since some of the primary
respondents have not listed friends, the code didn't work (the error
message was that the DELINQ variable wasn't found). Below I provide an
example of what the data looks like and the code that I tried to use.

RESPID    FR1ID   FR2ID   FR3ID     DELINQ
1                    7       10         2              3
2                    5         .          .              1
3                     8       5          .              6
4                     .       .          10             0
5                     4       7          1            14
6                         .       .        5            8
7                     10      3          5            11
8                       .       .          8            13
9                       .       .          4             5
10                    9       .          7              2

As you can see, not everyone nominated a friend.  Does anyone know how
I can create this peer score?  A second issue is that I need to weight
the peer delinquency scores based on the number of friends included in
the score?  How could the code be adjusted for this?  Any help would
be much appreciated. I am using Stata version 11.2.

Previous Coding:

gen PEER_DELINQ = .
forvalues i=1/`=_N' {

        local f1 = FR1ID[`i']
        local f2 = FR2ID[`i']
        local f3 = FR3ID[`i']

        replace PEER_DELINQ = DELINQ[`f1'] + DELINQ[`f2'] + DELINQ[`f3'] in `i'

}



Thanks in advance.
------------------------------
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index