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]

Re: st: Actor-partner Interdependence Model data structure (redo)


From   Carter Rees <[email protected]>
To   [email protected]
Subject   Re: st: Actor-partner Interdependence Model data structure (redo)
Date   Sat, 28 Apr 2012 16:51:31 -0700

Thank you Scott. This seems to do the trick and I should be able to tweak it as needed. 

Very much appreciated.

Carter 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Carter Rees, Ph.D.
Assistant Professor
Arizona State University
School of Criminology and Criminal Justice
602-496-0495
[email protected] (mailto:[email protected])



On Saturday, April 28, 2012 at 3:53 PM , Scott Merryman wrote:

> clear
> input egoid egodelinq egoattach altid altdelinq altattach
> 111 3 4 222 8 9
> 444 5 1 333 2 7
> end
> 
> gen dyad = _n
> rename (egoid altid) (person1 person2)
> reshape long person,i(dy)
> order dy person egod altd egoa alta
> 
> bys dy: replace egodel = altdel[_n-1] if _j ==2
> bys dy: replace altdel = egodel[_n-1] if _j ==2
> gen attachment = egoa if _j ==1
> replace attach = alta if _j ==2
> drop egoa alta _j
> l
> 
> Scott
> 
> 
> On Sat, Apr 28, 2012 at 1:30 PM, Carter Rees <[email protected] (mailto:[email protected])> wrote:
> > 
> > Sorry for the messy format of the previous post.
> > 
> > Hi Statalisters,
> > 
> > I am trying to structure my data as a pairwise data set (see Kenny,
> > Kashy, Cook (2006) Dyadic Data Analysis) and then run a multilevel
> > APIM model.
> > 
> > My data set is currently at the individual level as follows:
> > 
> > egoid egodelinq egoattach altid altdelinq altattach
> > 111 3 4 222 8 9
> > 444 5 1 333 2 7
> > 
> > What I would like it to look like (also individual level):
> > 
> > dyad person egodelinq altdelinq attachment
> > 1 111 3 8 4
> > 1 222 8 3 9
> > 2 444 5 2 1
> > 2 333 2 5 7
> > 
> > The outcome variable is friendship attachment level. The predictor
> > variables are ego delinquency and alter (friend) delinquency. Each
> > individual's outcome score is associated with both his or her own
> > predictor scores and his or her partner's scores.
> > 
> > Much appreciated,
> > 
> > Carter
> 
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/



*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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