Aggregation Indices in R

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

Ines.Tomas@uv.

es

Aggregation Indices in R

1. Downloading and installing R


Visit the project website http://www.R-project.org/

Click on the link labelled CRAN.

There are various copies (mirrors) of the CRAN across the globe. This link will navigate you to
a page of links to the various “mirror” sites. Scroll down this list to find a mirror near to you.
For example, the mirror closest to me will be one of the links in Spain.

Then, select the platform you use (Linux, MacOs or Windows). I have selected Windows.

Click on the link “install R for the first time”


[email protected]

Click on the Download link and follow the install procedure.

Once the program has been installed, you will find the corresponding icon at the Desktop.

Click on the icon of the program and you will open the R Console.
[email protected]

2. Installing the needed packages


Copy and paste the following instructions in the R Console:

#install foreign package to import SPSS data


install.packages("foreign")

#install Commander package


install.packages("Rcmdr")

#install package for multilevel analysis


install.packages("multilevel")
[email protected]

As previously indicated, there are various copies (mirrors) of the CRAN across the globe.
Again, you will have access to a window of links to the various “mirror” sites. Scroll down this
list to find a mirror near to you. For example, the mirror closest to me will be the one in Madrid
(Spain).

THE INSTALATION PROCEDURE SHOULD BE CARRIED OUT JUST THE FIRST TIME.

ONCE YOU HAVE THE PROGRAMME AND THE PACKAGES INSTALLED IN YOUR
COMPUTER, YOU JUST WILL NEED TO GO DIRECTLY TO “HOW TO OBTAIN
AGGREGATION INDICES IN R” SECTION.

If during the following process you get a message telling to install any other packages that are
needed, just select the option to install the packages from the CRAN:
[email protected]

How to obtain Aggregation Indices in R

1. Getting ready: calling back the needed packages

Click on the icon of the program to open the R Console.

Copy and paste the following instructions in the R Console. Those instructions are for calling
back the packages that we are going to be needed to run the analyses (they were previously
installed; now they are called back to be used):

#call package to import SPSS data


library(foreign)

#open Commander package


library(Rcmdr)

#call package for multilevel analysis


library(multilevel)
Remember that if during the process you get a message telling to install any other packages
that are needed, you just have to select the option to install the packages from the CRAN.

You will get a new window: The R Commander window.


[email protected]

2. Setting a working directory


The idea is to set the place where the SPSS dataset is located, and the place where the resulting
files will be saved.

We can copy and paste the direction of the directory from the corresponding window. The only
problem is that the “\” lines must be changed for “/”.

When I copy and paste, I got the following (text in green):

setwd("C:\Users\usuario\Google Drive\Doctorado POT\Apuntes Pruebas


Estadísticas\R\Aggregation indices in R") [R will give an error message unless we change the /]

Then I have to change it as follow:

setwd("C:/Users/usuario/Google Drive/Doctorado POT/Apuntes Pruebas


Estadísticas/R/Aggregation indices in R") [OK]

Copy and paste this in the R Commander and Execute:


[email protected]

3. Reading data from SPSS


In the R Commander window:

And give a name to the dataset (I have called it “Example”):

Then select the SPSS file with the data to be opened:


[email protected]

We can Visualize the dataset to check that the data have been properly imported:

In this example, we are going to obtain aggregation indices for the Support scale. Then, in the
dataset we have:

 The items of the Support scale (ap1, ap2, ap3).


 The mean value in the Support scale for each subject (aptot)
[email protected]

4. Estimating the ADI values


Prior to aggregation, we should assess within-team agreement. We can do that by means of the
Average Deviation Index (ADI) proposed by Burke, Finkelstein and Dusig (1999).

Those are the instructions to estimate the ADI for the Support scale in my example (you will
have noticed, that the lines starting with “#” are just notes that we introduce to keep
information that can be useful for us):

#Estimating ADI
AD.SUPPORT.MEAN <- ad.m(Example[,6:8],Example$unidad);

#Obtaining the ADI for each single team


AD.SUPPORT.MEAN

#Obtaining the ADI mean value and the standard deviation


summary(AD.SUPPORT.MEAN)
sqrt(var(AD.SUPPORT.MEAN))

You have to modify the instructions to adapt them to your dataset, and names of your variables.

As we can check in the dataset, the items of the Support scale are placed in columns 6 to 8.
[email protected]

When copying and pasting the instructions in the R Commander window, and executing them:

The average ADI value was .60 (SD = .32).

To interpret the ADI values, Burke and Dunlap (2002) recommend using the criterion of AD <
c/6, where c is the number of response alternatives. For a Likert-type 5-point scale, as the one
used in the Support scale, c/6 (5/6) is equal to 0.83. Consequently, we could conclude that there
is within-team agreement if the ADI value is equal to or less than 0.83. Thus, we can conclude
that the average level of within-team agreement is sufficient to aggregate individual scores to
the team level.
[email protected]

5. Running the ANOVA


A one-way analysis of variance (ANOVA) allows us to ascertain whether there is statistically
significant between-team discrimination in the study variables (e.g., support) among teams.

Those are the instructions to run an ANOVA for the Support mean value in my example:

#run an ANOVA with unidad as IV and aptot as DV


AnovaSupport <- aov(aptot~as.factor(unidad), data=Example)

#visualizy the results of the ANOVA


summary(AnovaSupport)
You have to modify the instructions to adapt them to your dataset, and names of your variables.

When copying and pasting the instructions in the R Commander window, and executing them:

The F value was statistically significant (F (196, 442) = 2.25, p < .01), indicating that there was
adequate between-team discrimination of team support.
[email protected]

6. Estimating the ICC values


We can also estimate the relative consistency of responses among team members and the
reliability of the team mean by computing the intraclass correlation coefficients ICC[1] and
ICC[2], respectively (Bliese, 2000).

Those are the instructions to estimate the ICC values in my example:

#estimate ICC(1)
ICC1(AnovaSupport)
#estimate ICC(2)
ICC2(AnovaSupport)

You have to modify the instructions to adapt them to your variable names. See that the name
that we use is the same that we created for calling the Anova in the previous section.

When copying and pasting the instructions in the R Commander window, and executing them:

The values for ICC[1] and ICC[2] are .28 and .56, respectively, indicating that the level of
consistency of responses among team members and the reliability of the teams’ means on this
scale are adequate

You might also like