David
A. Kenny

May 22, 2023

DyadR: Web Programs

for Dyadic and Group Data Analysis

Currently there are 10 apps that others and I have written that are available on the web for dyadic and group data analysis:

APIM_MM (click to run): Actor-Partner Interdependence Model with Multilevel Modeling (both distinguishable and indistinguishable dyads) -- learn more

APIMeM (click to run): Actor-Partner Interdependence Mediation Model with Structural Equation Modeling (indistinguishable dyads only) -- learn more

APIMoM (click to run): Actor-Partner Interdependence Moderation Model with Structural Equation Modeling (indistinguishable dyads only) -- learn more

GAPIM_I (click to run): Group Actor-Partner Interdependence Model for Individuals -- learn more

SRM_R (click to run): Social Relations Analysis with Multilevel Modeling (mainly for round-robin data) -- learn more

Common_Fate (click to run): Common Fate Model with Indistinguishable Dyads -- learn more

Dyadic_CFA (click to run): Confirmatory Factor Analysis with Distinguishable and Indistinguishable Dyads (single-factor model) --

learn moreDingy (click to run): Tests of Distinguishability and Nonindependence -- learn more

BetweenO (click to run): Model with Between-Dyads Outcome -- learn more

All of these programs are written in R, but to run them, the user need not download R nor be at all familiar with R. One simply goes to the website (click on the name above) and is prompted about the data and the analysis that is desired. The results of the analysis -- computer output, tables, and text -- appear on the right side of the screen and for some programs the results can be downloaded to a file. These programs were written by myself with assistance from Thomas Ledermann, Robert Ackerman, Lara Stas, John Sakaluk, and Axel Mayer. Moreover, SRM_R was co-written with Man-Nok Wong. They all use RStudio's shiny web application framework. I eagerly looking for others to help me in this endeavor. Help is need not only in writing programs, but also in creating documentation.

**T****hese programs are all very much in development and there are likely bugs and errors. Results should be carefully checked!**

**T****hese programs have difficulty with very large datasets, i.e., those with hundreds of variables. It is advisable to create a smaller dataset before running these programs.**

To view a dated powerpoint that describes an application of two of the programs click here.

Other Web-based Shiny Apps

RDDD.htm (click to see these programs): Three programs written to re-structure dyadic data written by David A. Kenny and Thomas Ledermann.

apimpower (click to run): A program for power analyses for Actor-Partner Interdependence Model with both indistinguishable and indistinguishable dyads written by Rob Ackerman and David A. Kenny. To download a description of methods used in this program click here.

APIM_SEM: Actor-Partner Interdependence Model estimated by SEM written by Lara Stas of Ghent University.

Warning!

All of these apps, except apimpower, send the data to an external server. If there are restrictions about the dissemination of the data and privacy issues, I cannot guarantee to you that they are satisfied should you use the app. You may need to email me to obtain a copy of the app for you to run the app locally. There is a small charge for this service.

General Points about These Apps

(Not all the programs are currently written this way, but most are.) The opening screen contains at least two upper tabs. The one on the left is for the app itself and the next one on the right, called "Help and Contact," which some documentation, links to further documentation, and an email address for enquires. The apps, APIM_MM and SRM_R, contain an additional link that describes changes in the program. Finally, the app GAPIM_I has formulas used in the app.

The main page contains a set of vertical tabs on the right. The user begins by completing the green tabs. At the top always is the green "Select Data" tab which reads a dataset in either SPSS or csv format. One then proceeds down the green tabs completing them in order. After the green tabs is the set of black tabs, which contain optional information (e.g., change alpha). Once the run is set up, the user hits the blue tab and the blue button which says something like "Begin the Analysis" to run the analysis. Eventually, the results appear on the right side of screen and the user can select text, tables, or computer output. Some apps allow for the display of figures. If one wants to save the output, the user hits the bottom purple tab of "Download Output" that saves the text, tables, computer output, and figures (if there are any) in docx, html, or pdf formats. Finally, for some of the apps, the user can save the transformed dataset.

The apps are written to be "reactive." That is, after the run is completed and even after the files are downloaded, the user can make changes in the analysis. This feature is especially useful if the user has made an error in that the error can be corrected without having to start all over (e.g., read the dataset, enter the variables, and so on). Though not fully "idiot proofed," the programs do not always crash when the user makes an error; on the right-side of the screen a message may appear telling the user what the problem is.

**GAPIM_I**

This app conducts an Group Actor-Partner Interdependence Model Analysis of group data where each person is measured. I thank Randi Garcia who assisted me earlier on this project and T. M. L. Kaufman and Leon Mait who assisted me more recently. Man-Nok Wong also provided key technical advice. THIS PROGRAM IS EXPERIMENTAL AND ONE SHOULD BE VERY CAUTIOUS ABOUT THE RESULTS PRODUCED BY THIS APP. The estimation used is based on a method presented in Kenny, D. A., & Garcia, R. (2012), Using the Actor-Partner Interdependence Model to Study the Effects of Group Composition, *Small Group Research*, *43*, 468-496, which can be downloaded at disadvantages\doc\GAPIM.pdf.

The basic model analysis allows for four effects. Consider gender as the group composition variable. First, there is X, the gender of the actor or respondent or the Actor Effect. Second, there is X' the gender of the other members in the group or the Others Effect. Third, there is I, the match between the gender of the actor and the others in the group or Actor-Others Similarity. Fourth, there is the similarity of the others in the group or Others Similarity. Each variable is scaled when 1 is the maximum and -1 the theoretical minimum. The program allow for non-dichotomous X variables and covariates. Groups must contain at least three persons.

Besides the Complete Model with the four above terms, 14 different submodels can be estimated. Among these models are the Contrast (aka as the *frogpond effect*), Group, Diversity, and Person Fit Models.

When a non-dichotomous group composition variable is used, it is rescaled where the largest is coded as +1 and the smalles at -1. In this case, Actor-Others Similarity can be measured by squared, absolute, or square root of the absolute difference averaged across all others. The product of Actor and each Other can also be used. For Others Similarity, the options are squared, absolute, and square root of the absolute difference. The program allows for nonindependence in members' responses.

When GAPIM_I is opened, one begins by completing in order the first three green tabs on the left. At the top is the "Select Data" tab which reads a dyad dataset in either SPSS or csv format. One can analyze, the data gathered by Randi Garcia, in which Gender is the distinguishing variable and outcome is Group Identification. One selects "Garcia Example."

To learn more about the program's options, open the program and click on the blue "Help and Contact" tab.

The Garcia example dataset can be downloaded at davidakenny.net\doc\GAPIM.csv and the GAPIM-I output for that dataset can be downloaded at davidakenny.net\doc\GAPIM_I_Example.pdf.

**SRM_R**

A paper describing this app,, written with ManNok Wong and Andrew Knight, can be downloaded here. This app conducts an Social Relations Analysis of directed dyadic data and estimates the fixed and random effects for that model. The code that estimates the SRM variances and covariance and creates the necessary codes for that analysis was written by Andrew Knight of Washington University (code at http:\\apknight.or\pdSRM.R). The estimation algorithm is slow and has difficulty converging with small datasets, datasets with a lot of missing data, and models with small actor or partner variances or large actor-partner correlations. The hope is to improve the algorithm in the near future.

The method involves the Snijders and Kenny (1999). The social relations model for family data: A multilevel approach. *Personal Relationships, 6*, 471-486) approach which creates dummy variables for each actor and partner. The presumption is that the design is round robin, everyone paired with everyone. There can be missing data and the symmetric block design can be estimated with this this app. The program can analyze the half block design, i.e., a design in which the perceivers rate targets, but the targets do not rate the perceivers.

The input file must be for each score or a "narrow format." For instance assuming no missing data, if there were a round-robin with 5 persons, 20 records would be read. On the record is the outcome variable, the actor number, partner number, and group number. Note the actor and partner numbers should refer to the same person. Thus, for person 521 should have both an actor and partner number of 521. The SRM with indistinguishable dyads is discussed in Chapter 8 of *Dyadic Data Analysis,* (Kenny, Kashy, & Cook, 2006). For an webinar (small charge) introduction to the SRM view a webinar and for SRM designs view another webinar.

When SRM_R is opened, one begins by completing in order the first two green tabs on the left. At the top is the "Select Data" tab which reads a dyad dataset in either SPSS or csv format. Next one goes to green "SRM Variables and Terms" tab and gives the name from the dataset of the outcome variable, actor number, partner number, and group number (see above paragraph). SRM_R creates the necessary dummy variables for analysis. One can also change "Actor" to "Perceiver" and "Partner" to "Target" or to whatever names the user desires, e.g., "Receiver and Sender" or "Victim and Aggressor." One can change the name of group to team or whatever the user prefers.

The next three black tabs are optional. Then first is the "Predictor Variables" which can be used to pick and name the covariates or fixed variables for the analysis. The black "Group Effect" tab allows the user to pick how group effects are modeled. They can be treated as random as is done in TripleR, not included in the model, or fixed as is done in SOREMO which is similar to "group-mean centering" the data. The black "Miscellaneous" tab allows the user to change the alpha and the estimation method.

Once the run is set up, one hits on the top the blue tab labelled "Run Estimation of SRM Now." The results appear on the left side of screen and the user can select text, tables, or computer output. Finally, if one wants to save the output to file (docx, html, or pdf formats), one hits the bottom purple tab on the left labelled "Download Output" and selects the options on the left.

The program displays in text, tables, and computer output. All of the output can be saved in an output in either docx, html, or pdf formats.

This program conducts an Actor-Partner Interdependence analysis of dyadic data. Data must be in a pairwise structure. There must be a numeric dyad identification variable on each record and no more than two records can have the same score on the dyad identification variable. The program is NOT for the analysis of longitudinal dyadic analysis nor does it allow for non-normal outcomes. There is 30 pages of documentation for this program with screenshots and three examples (click here).

For details on the APIM, read Chapter 7 of Dyadic Data Analysis by Kenny, Kashy, and Cook (2006). Also webinars (small charge) on the APIM and APIM Estimated by Multilevel Modeling might be helpful. The defining feature of the APIM is measuring the effect of one mixed variable on another mixed variable: Measured is the effect of a person's own X on his or her Y (the actor effect) and the effect of a person's partner's X on his or her Y (the partner effect).

The program requires at least one predictor mixed variable and one outcome mixed variable. Multiple mixed predictors are allowed. Dyad members can be distinguishable or indistinguishable. Covariates can be included and an analysis of actor-partner interactions for each mixed variable can be estimated using either a product score or a discrepancy score. With distinguishability, pooled actor and partner effects across members are presented, as well as tests of distinguishability.

The residuals in the outcome variable are assumed to be normally distributed, and outliers can be removed. The user can specify removing from the analysis standardized residuals values that exceed a certain value.

The program can be relatively easily adapted to test for between-dyads moderators of actor and partner effects. Consult the third example of the documentation.

The program displays in text, tables, computer output, and figures. All of the output can be saved in an output in either docx, html, or pdf formats.

The program conducts an APIM mediation analysis using structural equation modeling. It requires three mixed variables in a dyad dataset. One variable, X, is presumed to cause M which in turn is presumed to cause Y. Estimates and tests of direct, indirect, and total effects are estimated and tested. The structural equation modeling program lavaan is used to estimate mediation models. One can use Monte Carlo or traditional non-parametric bootstrap confidence intervals for indirect effects. The structural equation modeling program lavaan is used to estimate mediation models. Brief documentation of the program is available here.

To use APIMeM, one goes through the tabs on the left of the opening screen:

First the green "Select Data" tab is clicked. Either an SPSS or csv (comma separated variables) can be read.

Next the green "Basic Information" tab is clicked. The user names the X, Y, and M variables, as well as the the two members. The defaults can be accepted. The user also decides whether to allow for mean and variances differences between the members.

The green "Variables" tab selects the six variables for the analysis from the dataset. They are chosen from a variable list. (Sometimes one may need to click the "Check to View Variable List" box to be able to see the entire list.

The optional black tab of "Miscellaneous" allows the user to either change alpha or the bootstrapping method. Moreover, the user can set k, the ratio of the partner effect to actor effect, for both the M and Y equations to estimate a simpler model.

To begin the run, the blue "Run Analysis" tab is clicked and then the "Click Here to Begin the APIM Mediation Analysis" button. If one runs a non-parametric bootstrap, it may take several minutes before the results appear on the right.

To download the results, the text, tables, computer output, and figure(s), the user clicks the purple "Download Output" and then chooses the name of the file and its format. The output can be saved in an output in either docx, html, or pdf formats. An example of such pdf output can be viewed here.

The program is currently limited to indistinguishable dyads but the user can allow mean and variances to differ. The user can enter k values (the ratio of partner to actor effects) to test specialized models. For instance, there might be only actor effects from X to M (k_{M} = 0), and the actor and partner effects from M to Y might be equal (k_{Y} = 1).

Currently no covariates are permitted and again dyad members must be indistinguishable. THIS PROGRAM HAS NOT BEEN FULLY TESTED.

**APIMoM**

The program conducts an APIM moderation analysis using SEM. It requires three mixed variables in a dyad dataset. One variable, X, is presumed to cause Y and those effects are presumed to vary (i.e., to moderate) due to M. Simple effects of the effect of X on Y at various levels of M are estimated. The structural equation modeling program lavaan is used to estimate moderation models. Brief documentation of the program is available here.

The program is currently limited to indistinguishable dyads but the user can allow mean and variances to differ. The user can estimate specialized models that place constraints on the four interaction effects. The constraints involve k which is the ratio of partner to actor interaction effects. One approach is to use the k ratios from the X and M main effects to constrain the interaction effects. A second approach is to estimate the k ratios from the interaction effects. For both of these approaches, a test of the constraints is provided, as well as a Monte Carlo estimate of the confidence interval for the k's. The third approach is have the user specify the k values. (See the technical appendix of Garcia et al. for more details on k and tests of moderation.)

Currently no covariates are permitted. THIS PROGRAM HAS NOT BEEN FULLY TESTED.

To use APIMoM, one goes through the tabs on the left of the opening screen:

First the green "Select Data" tab is clicked. Either an SPSS or csv (comma separated variables) can be read.

Next the green "Basic Information" tab is clicked. The user names the X or the predictor, Y of the outcome , and M or the moderator variables, as well as the the two members. The defaults can be accepted. The user also decides whether to allow for mean and variances differences between the members.

The green "Variables" tab selects the six variables for the analysis from the dataset. They are chosen from a variable list. (Sometimes one may need to click the "Check to View Variable List" box to be able to see the entire list.

The optional black tab of "Miscellaneous" allows the user to change alpha. Moreover, the user can set k, the ratio of the partner to actor variables, for both the X and M variables. One can empirically estimate the k's, input a priori k values, or use the main effect k values. (See the technical appendix of Garcia et al. for more details.) A statistical test is used to evaluate whether the k's, however chosen, can explain the pattern of moderation effects. (It is advisable to only use this option if there is detectable interaction in the data.)

To begin the run, the blue "Run Analysis" tab is clicked and then the "Click Here to Begin the APIM Moderation Analysis" button.

To download the results, the text, tables, computer output, and figure(s), the user clicks the purple "Download Output" and then chooses the name of the file and its format. The output can be saved in an output in either docx, html, or pdf formats. An example of such pdf output can be viewed here.

The program is currently limited to indistinguishable dyads but the user can allow mean and variances to differ.

**Common_Fate**

The program conducts a Common Fate Analysis. The measures from the dyad members are presumed to be indicators of a latent variable. One latent variable, X, is presumed to cause the other, Y. Data must be in a dyad data structure. The errors of the X and Y are correlated across members, as assumption which is tested. To be able to estimate this model, the two X and the two Y measures must inter-correlate. A dyad dataset is entered and both X and Y must be mixed variables. Models are estimated using the structural equation modeling program lavaan.

The program is currently limited to indistinguishable dyads which yields a saturated model and so the program does not provide fit indices. The model is estimated by lavann. Currently no covariates are permitted. THIS PROGRAM HAS NOT BEEN FULLY TESTED.

The program displays in the text, tables, computer output, and a figure.

**Dyadic_CFA**

This program estimates a confirmatory factor analysis model using lavaan for both members of dyad. This program was recently revised and it combines discontinued apps of CFA_I and CFA_D.

A minimum of two indicators per member are needed, but three or more is recommended. A dyad dataset is read. Each indicator is assumed to load on a single factor and errors of the same indicator are allowed to be correlated across the two members.

For distinguishable dyads, two models are estimated. One is the configural model in which there are no constraints are made across members, but a single factor model is estimated. The second is a model in which constraints are made on the model. Possible constraints are equal loadings across members, equal intercepts, equal error variances, equal factor means, equal factor variances, equal slopes from the between-dyads variables (if there are any) to the latent variables, and zero correlation of errors. The user can choose a model of complete invariance which treats dyad members as indistinguishable. Again, the app is limited to single latent variable and there can be no correlated errors within a latent variable.

For indistinguishable dyads, two models are estimated. One is the I-SAT model, which places all the equality constraints needed for indistinguishable dyads. The other is the specified CFA model. One can constrain this model to have no correlated errors.

CFA outputs text, tables, lavaan code and output, and a figure.

**DINGY**

This program tests the null hypothesis that dyad members are indistinguishable. For instance, if the dataset is for heterosexual couples, the the test is that for each mixed variable the mean and variance are the same for men and women and that correlation between any pair of variables is the same for men and women. In addition the program evaluates whether scores are correlated across members. A dyad dataset must be used as input.

The program allows for between-dyads variables and determines if the correlations of those variables are the same for the two members. The program also allows for a second within-dyads variable, besides the one used to distinguish dyad members and in tests distinguishability constrains the mean of this variable to be half of the sum of the two scores and the correlations with mixed variables to be equal but opposite sign.

The program also tests whether scores across the two members are correlated which can be useful if one wants to claim that scores are independent. Additionally, it gives the I-SAT chi square and degrees of freedom, as well as the chi square and degrees of freedom for null model.

One can download the output, the text, tables, and computer output (the indistinguishable run) to a file. An example file is contained here.

**BETWEENO**

This program estimates models with a between-dyads outcome variables. The program was written for indistinguishable dyads but can be adapted for distinguishable dyads. A dyad dataset must be used as input. The outcome must be a between-dyads variables, and must be measured at the interval level of measurement (i.e., no dichotomies).

Fairly extensive documentation for the program can be obtained by clicking the "Help and Contact" tab. The program was extensively revised in the spring of 2023.

Nonetheless, the program is VERY PRELIMINARY and results should be viewed with CAUTION.

The program outputs text, tables, and computer output.

**Data Preparation**

Data must must be in the proper format. APIM_MM requires a pairwise dataset and the other programs require a dyad dataset. You may need to restructure your data before running the program. Most programs accept as input a SPSS "sav" or text file in which the data are separated by commas (a "csv" file). For the csv file variable names are in the first line of the dataset.

For APIM_MM, it is helpful (but not required) to have the first variable in the dataset be the dyad identification variable.

**Entering Parallel Lists of Variables**

Several of these programs expect parallel lists of variables: APIM_MM expects the name of actor and partner variables in the dataset and CFA, Dingy, and BetweenO expect two lists of mixed variables, one for each member. (APIMeM and Common_Fate only use the "check" option.) Three different options are offered to enter these parallel lists:

Check: This is perhaps the most familiar option. If chosen, the user is given the entire list of variables in the dataset and the user checks those that are appropriate for the set. The set of variables need not be checked in the same order for the two members, but they must be in the same order in the dataset itself. For instance for CFA, if the variables were HSat, WSat, HAge, and WAge (H being husband and W being wife), the user might check (in any order) HSat and HAge for husbands and then WSat and WAge for wives (again in any order). However in the dataset, if HSat comes before HAge, then WSat must also come before WAge. If this is not the case (WAge comes before WSat), this option cannot be used unless one reorders the variables in the datafile.

Lists: For this method, the user needs to type the complete names of both set of variables. So for Husband the list would be "HSat,HAge" and for Wife it would be "WSat,WAge". Order within a list does not matter, but the order needs to be the same across lists, in this case with Sat ahead of Age for both husband and wife. Variables on the list are separated by commas.

Suffix: This is least obvious but often the simplest strategy and because it the simplest, it the default option. Presume that the variables are Sat_W, Age_W,Sat_H, and Age_H. The member is designated by a suffix, H or W. With this method, the user gives a single list without the suffix of "Sat,Age" and then tells the program what suffix is, in this case "H" and "W". Note for APIM_MM the suffix defaults to "A" and "P" but there is no default for CFA, CFA, or Dingy.

The user is free to decide which option is best. It is always advisable to check in the output that the correct set of variables are chosen. The Common_Fate app only allows the check option.

**Program Output**

All output is to the screen, but it can be copied. Some programs do allow for the output to outputted to a file.

APIM_MM: Four different tabs are presented: Text, Tables, Computer Output, and Figures. This program does allow output to a file.

Text: If there are any warnings, they are presented first. Then a description of the sample the purpose of the study is given. Then for each mixed predictor, the actor and partner effects, and k ratios. If requested, there a test of the actor-partner interaction.

Tables: The descriptive statistics for the outcome, mixed predictors variables, and covariates are presented. Then a table of intercepts, actor and partner effects, k ratios, and effects of the covariates. For distinguishable dyads overall effect are presented as well as results of tests of distinguishability.

Computer Output: The basic gls run is presented.

Figures: The basic APIM diagram is given for up to eight predictor variables. Although different figures are given, they are all from the same analysis.

APIMeM, APIMoM & SRM_R: The output is very much like APIM_MM except that SRM_R does not provide a figure.

Common_Fate: Four different tabs are presented: Text, Tables, Computer Output, and Figure.

Text: A brief description of the sample the purpose of the study is given. The program looks for problems, such as poor loadings and a failure of discriminant validity.

Tables: There are two tables. Table gives the descriptive statistics. Table 2 provides means and variances from the analysis.

Computer Output: The lavaan output for the model with and without correlated errors is presented.

Dyadic_CFA: Four different tabs are presented: Text, Tables, Computer Output, and Figure.

Text: A description of the sample the purpose of the study is given. For distinguishable dyads, the fit of the configural and specified model are given. For the specified model, the results are discussed. For indistinguishable, the I-SAT and specified models are estimated.

Tables: The descriptive statistics for the indicators are presented. Next a table of fit statistics for the configural and specified model are given for distinguishable dyads and the I-SAT and specified models for indistinguishable dyads. Then for both members, a table of loadings, error variances, and intercepts and their p values is presented. If there are between dyads variables, their paths to the latent variables given in a fourth table.

Computer Output: For both models, the user is given the the lavaan syntax, the overall summary of two estimated models, the estimates, and the modification indices.

Figure: The figure shows up to five indicators but currently does show means, intercepts, and variances nor the effects of any of the between-dyads predictors, if there are any.

Dingy: Three different tabs are presented: Text, Tables, and Computer Output. This program does allow output to a file.

Text: A description of the sample and the purpose of the analysis is given. Then the results of models which force means, variances, and correlations equal are presented. The best fitting model if there is one is suggested. Also given is the ISat chi square, df, and null model which can be useful for dyadic SEM analyses that treat dyad members as indistinguishable. If the option is chosen, an overall test of nonindependence is given, assuming both distinguishability and indistinguishability.

Tables: Up to four tables are available: Descriptive statistics for the mixed variables, Model tests, Comparisons between models, and Tests of nonindependence.

Computer Output: The lavaan output from the model that test for complete distinguishability. You may need to adjust the screen size for best viewing.

BetweenO: Three different tabs are presented: Text, Tables, and Computer Output

Text: A description of the sample and the purpose of the analysis is given. Then the results from two models: one with interactions (product) and one without interactions. If necessary, the output of a model that trims out non-significant interactions.

Tables: Tables are outputted for each model estimated.

Computer Setup and Output: The regression model and output, using the R function "lm," for each model is outputted.

**Program Defaults**

Alpha is assumed to equal of .05 in all programs, but the user can override that default. For APIM_MM, the program defaults that the first variable in the dataset is the dyad identification variable, the second variable is the outcome variable, and that the third variable is distinguishing variable (if there is one).

**Error Checks**

All the programs have error checks. Nonetheless, it is still possible to crash the program without it reporting an error. Suggestions for error checks are appreciated.

**Variable Names**

The user need not name the variables, but to make interpretation easier, it is strongly suggested that the user provide appropriate names. Space and symbols are allowed. Some of the programs allow using the the names of the variables in the dataset for the names use in the text output.