This is a guide to conducting Item Analysis on Likert data. R will need some libraries to work out the following examples, so make sure you run the following lines in your computer.

install.packages("xlsx")
install.packages("foreign")
install.packages("psych")
install.packages("Hmisc")
install.packages("Scale")

Loading the Scale Library

In order to use the Scale library, you should load it, using the following line.

library(Scale)

Reading in Data

From Excel

library(xlsx)
my_data <- read.xlsx("YouDataFileHere.xlsx", sheetIndex=1)

From SPSS

library(foreign)
my_data <- read.spss("YourDataFileHere.sav", to.data.frame=T)

Minimal Example

If your questionnaire has no reverse items and it has not been administered in various re-orderings of items, then you can proceed as follows:

my_scale <- Scale(my_data)

Re-Ordered Items

If you have administered your questionnaire in one ore more reorderings - and you know which! - you can pass them to the orders argument, enclosed in c(), separated by commas. If you have more than one reorderings, you should use a list() to wrap them up. You also need to provide an orders_id argument, i.e. a c() of integers indicating which order was administered to each participant.

my_scale <- Scale(data=my_data, 
                         orders=list(
                           # Half of the questionnaires were
                           # administered in this order.
                           c(16,19,11,9,1,17,5,18,4,8,2,12,
                             20,10,14,6,3,13,15,7),
                           # The second half was administered in
                           # this one:
                           c(1,18,4,15,7,8,3,14,20,6,19,16,
                             12,5,10,13,2,17,11,9)),
                         orders_id=c(
                           # participants 1 through 49 received the
                           # first order
                           rep(1, 49), # repeat "1" 49 times
                           # participants 50 through 98 received the
                           # second one: these are 49 people, who 
                           # all got the second order, thus:
                           rep(2, 49)), # repeat "2" 49 times
                         )

Reverse Items

If you have reverse items in the questionnaire, you can pass them to the reverse argument. It needs to be a c() of integers, indicating the position of the items in the original order.

my_scale <- Scale(my_data, reverse=c(3,4,13,14,18,20))

Adding Item Labels

You may add some labels to be used for items in the data.frame() to be constructed by the Scale library. If you want to name the items in a repetitive form, you can use the paste() function, in order to spare some typing.

my_scale <- Scale(my_data, col_names= paste('q', 1:20, sep=''))
# "paste" will create a vector such as c("q1", "q2", ..., "q20")

Pre-processing Data

Now, all the work and thought you have put into your questionnaire pays off. You don’t have to do anything complicated from now on. To pre-process your data, just type:

my_scale_pr <- PreProc(my_scale)

Doing the Analysis

In order to get the Item Analysis, you only need to pass the preprocessed object to the ItemAnalysis() function:

my_scale_it <- ItemAnalysis(my_scale_pr)

Getting the Report

Pass the output of ItemAnalysis() to ReportTable().

my_table <- ReportTable(my_scale_it)  
Item Corr. to scale Factor Loading Mean SD
q12 0.61 0.65 2.24 1.15
q11 0.49 0.55 1.36 0.71
q9 0.46 0.53 2.54 1.07
q5 0.47 0.52 1.88 1.10
q20 0.44 0.51 2.19 0.88
q2 0.43 0.50 1.40 0.86
q18 0.41 0.50 2.63 1.16
q7 0.43 0.48 2.91 1.09
q10 0.43 0.47 2.50 1.32
q14 0.41 0.47 2.36 0.90
q17 0.41 0.46 2.82 1.25
q16 0.41 0.45 2.77 1.27
q6 0.38 0.43 3.00 1.24
q8 0.37 0.43 1.36 0.84
q19 0.38 0.43 2.83 1.28
q13 0.38 0.42 2.33 1.02
q4 0.36 0.41 2.58 1.17
q15 0.31 0.34 2.93 1.22
q3 0.24 0.29 2.29 1.34
q1 0.20 0.23 2.81 1.27

Excluding Items

Either because the program suggested it, or because you studied the report yourself and decided to, you may want to repeat the analysis without specific items. You can do so by adding an exclude argument.

my_scale_it <- ItemAnalysis(my_scale_pr, exclude=c(1, 3, 15))
print(my_scale_it)

Show Best Items

Now that you have an ItemAnalysis object, created by the ItemAnalysis() function, you can use it in a number of follow-up functions, in order to proceed with your scale construction.

# This will return the label of the best items.
# The labels must have been defined in advance, when creating the ScaleData object. 
best_items <- ChooseBest(my_scale_it)
print(best_items)

# This will show the labels and the contents of the items, provided a text
# file with item statements has been defined, when creating the ScaleData object. 
items_content <- ShowItems(my_scale_it)
print(items_content)

Get Scores

There is no use in constructing a scale if you don’t score people with it. So, in order to get the scores of the people in your data set, just use:

my_scores <- GetScores(my_scale_it)
print(my_scores)

Write Outputs in a File

You can write the output either of the report or the scores into a .csv file. All post-analysis functions, (ReportTable(), GetScores() and ShowItems() will accept a write_file=TRUE argument, which will write the output in a file. See the functions’ help files for more options.)

my_table <- ReportTable(my_scale_it, write_file=TRUE)
my_scores <- GetScores(my_scale_it, write_file=TRUE)
my_items <- ShowItems(my_scale_it, write_file=TRUE)

Conclusion

The Scale package has the purpose of quickly giving you the common practice indices of reliability and validity, in order to facilitate you constructing a scale and use it. So, if your instrument exhibits good properties, go out and use it. If not - well you know what you have to do!