22
Restructuring Dyadic Data David A. Kenny January 9, 2015

Restructuring Dyadic Data David A. Kenny January 9, 2015

Embed Size (px)

Citation preview

Page 1: Restructuring Dyadic Data David A. Kenny January 9, 2015

Restructuring Dyadic DataDavid A. Kenny

January 9, 2015

Page 2: Restructuring Dyadic Data David A. Kenny January 9, 2015

Background• Dyadic Data Structures

– Individual• One record for each person• Own person’s variables

– Dyad• One record for the dyad• Both persons’ variables

– Pairwise• One record for each person• Both persons’ variables

• View: http://davidakenny.net/webinars/Dyad/General/DDS/DDS.html

2

Page 3: Restructuring Dyadic Data David A. Kenny January 9, 2015

The Problem• You have one data structure and you

want to convert to another.individual to dyadindividual to pairwisedyad to pairwise

• Other conversions are trivial and can be accomplished either by deleting cases or renaming variables.

3

Page 4: Restructuring Dyadic Data David A. Kenny January 9, 2015

Dyad ID• For restructuring individual data, a

unique identification number for each pair of persons is needed.

• For longitudinal standard design, the “DyadID” is for each time point for each dyad.

4

Page 5: Restructuring Dyadic Data David A. Kenny January 9, 2015

Usual Strategies to Restructure• Restructuring by entering the

data the “right” way.• Cut and paste• Computer programs

–Built in routines to restructure •SPSS:

davidakenny.net/webinars/powerpoints/Dyad/General/Restructuring.pdf

5

Page 6: Restructuring Dyadic Data David A. Kenny January 9, 2015

New Strategies to Restructure– R programs

• Individual to pairwise• Individual to dyad• Dyad to pairwise

– Apps• Individual to pairwise• Individual to dyad• Dyad to pairwise

– SPSS macro (no longer maintained)• Individual to pairwise• Individual to dyad

6

Page 7: Restructuring Dyadic Data David A. Kenny January 9, 2015

R Restructuring Programs• Written in R• Co-written with Thomas Ledermann of Utah

State University• Information available at

–http://davidakenny.net/doc/RDDD.pdf

7

Page 8: Restructuring Dyadic Data David A. Kenny January 9, 2015

Details• Installing R

–davidakenny.net/doc/InstallR.pdf• Three programs

–ItoP.R: Individual to pairwise• davidakenny.net/kkc/c1/ItoP.R

–ItoD.R: Individual to dyad• http://davidakenny.net/kkc/c1/ItoD.R

–DtoP.R: Dyad to pairwise• davidakenny.net/kkc/c1/DtoP.R

8

Page 9: Restructuring Dyadic Data David A. Kenny January 9, 2015

General R Program• RDDD

– Description: davidakenny.net/doc/RDDD.pdf– Program: davidakenny.net/progs/RDDD.R

9

Page 10: Restructuring Dyadic Data David A. Kenny January 9, 2015
Page 11: Restructuring Dyadic Data David A. Kenny January 9, 2015

  Descriptive Information for Dyad Dataset The dataset c:/ai.sav has been transformed from an individual to a dyad dataset called c:/dyad.csv. The distinguishing variable is Gender, and it has two levels, Wives (-1) and Husbands (1). There are 148 dyads and 296 individuals, 148 Wives and 148 Husbands. There are no missing data on any of the variables in the dataset. There are 7 variables, 1 between-dyad variable, 1 within-dyad variable, and 5 mixed variables. The one between-dyad variable is Years Married, and the one within-dyads variable is Gender. The within-dyads variable, Gender, is a dichotomy and could be used as a distinguishing variable. The descriptive statistics for the variables as individuals are contained in Table 1 and the descriptive and inferential statistics as dyads are contained in Table 2.

Page 12: Restructuring Dyadic Data David A. Kenny January 9, 2015

Table 1: Descriptive Statistics for Individuals (All Variables) Variable Mean sd Minimum Maximum Intra. r Years Married -0.000 7.707 -11.214 15.036 1.000 Gender 0.000 1.002 -1.000 1.000 -1.000 Self Positivity 4.186 0.412 2.600 5.000 0.087Other Positivity 4.264 0.498 2.600 5.000 0.235 Satisfaction 3.605 0.496 1.167 4.000 0.618 Tension 2.431 0.687 1.000 4.000 0.319 Similar Hobbies 0.078 0.646 -1.000 1.000 0.281  

Page 13: Restructuring Dyadic Data David A. Kenny January 9, 2015

  Table 2: Inferential and Descriptive Statistics for Dyads (Mixed Variables) Mean sd Variable Wives Husbands p Wives Husbands p r p Self Positivity 4.291 4.082 <.001 0.409 0.390 .568 .157 .056Other Positivity 4.246 4.281 .490 0.523 0.474 .225 .234 .004 Satisfaction 3.591 3.618 .451 0.530 0.462 .034 .623 <.001 Tension 2.520 2.341 .006 0.709 0.655 .306 .340 <.001 Similar Hobbies 0.189 -0.034 <.001 0.587 0.684 .052 .321 <.001 All calculations are based on 148 cases. Degrees of freedom for the test of mean difference are 147 and for the test of standard deviation difference and the test of the correlation are 146.

Page 14: Restructuring Dyadic Data David A. Kenny January 9, 2015

Restructuring Apps• Uses the Ledermann & Kenny R programs• Adaptation to apps done with the assistance of

Robert Ackerman• Web-based, no need to download R or to install

R.• Answer prompts• Results

– Text on the screen– Restructured data that can be downloaded

• Link: http://davidakenny.net/RDDD.htm14

Page 15: Restructuring Dyadic Data David A. Kenny January 9, 2015

ItoP Illustration

Page 16: Restructuring Dyadic Data David A. Kenny January 9, 2015
Page 17: Restructuring Dyadic Data David A. Kenny January 9, 2015
Page 18: Restructuring Dyadic Data David A. Kenny January 9, 2015
Page 19: Restructuring Dyadic Data David A. Kenny January 9, 2015

SPSS Macros• Steps

– Download the macro.– Run the macro.– Open the dataset.– Create the call.– Run the call.

• Macros– pairwise.sps

• http://davidakenny.net/kkc/c1/pairwise.sps– indtodyad.sps

• http://davidakenny.net/kkc/c1/indtodyad.sps19

Page 20: Restructuring Dyadic Data David A. Kenny January 9, 2015

Calls (red is required)

• pairwise.spsPairwise dyadid = dyad i1 = 'A' i2 = 'P' directory = 'c:\'.

• indtodyad.spsIndToDyad dyadid = dyad distvar = gender i1 = 'F' i2 = 'M' directory = 'c:\'.

20

Page 21: Restructuring Dyadic Data David A. Kenny January 9, 2015

Issues• 2 records per dyad• No string variables for most methods• The “Individual to Dyad” restructuring

programs always produce a new variable called “partnum” (one member is given a “1” and the other a “2”) which can be useful in analyses.

21

Page 22: Restructuring Dyadic Data David A. Kenny January 9, 2015

Additional ReadingsKenny, D. A., Kashy, D. A., & Cook, W. L.

Dyadic data analysis. New York: Guilford Press, Chapter 1.

Ledermann, T., & Kenny, D. A. (2014). A toolbox with programs to restructure and describe dyadic data. Journal of Social and Personal Relationships, online.

View as a webinar (small charge)Special thanks to

Thomas Ledermann & Rob Ackerman!22