When constructing scales through rational, factorial, or empirical means, it is useful to examine the content of the items that relate most highly to each other (e.g., the factor loadings of fa.lookup of a set of items), or to some specific set of criteria (e.g., bestScales). Given a dictionary of item content, these routines will sort by factor loading, item means, or criteria correlations and display the item content.

lookup(x,y,criteria=NULL)
lookupItems(content=NULL,dictionary=NULL,search=c("Item","Content","item"))
fa.lookup(f,dictionary=NULL,digits=2,cut=.0,n=NULL,sort=TRUE)
item.lookup(f,m, dictionary,cut=.3, digits = 2) 
itemSort(m, dictionary, ascending=TRUE, digits = 2)
keys.lookup(keys.list,dictionary)
lookupFromKeys(keys.list,dictionary,n=20,cors=NULL,sort=TRUE,suppress.names=FALSE,
      digits=2)
lmCorLookup(x,dictionary=NULL,cut=0,digits=2,p=.05)

Arguments

x

A data matrix or data frame depending upon the function.

y

A data matrix or data frame or a vector

criteria

Which variables (by name or location) should be the empirical target for bestScales and bestItems. May be a separate object.

f

The object returned from either a factor analysis (fa) or a principal components analysis (principal)

content

The word(s) to search for from a dictionary

keys.list

A list of scoring keys suitable to use for make.keys

cut

Return all values in abs(x[,c1]) > cut.

n

Return the n best items per factor (as long as they have their highest loading on that factor)

cors

If provided (e.g. from scoreItems) will be added to the lookupFromKeys output

dictionary

a data.frame with rownames corresponding to rownames in the f$loadings matrix or colnames of the data matrix or correlation matrix, and entries (may be multiple columns) of item content. See Notes for how to construct a dictionary.

Column names of dictionary to search, defaults to "Item" or "Content" (dictionaries have different labels for this column), can search any column specified by search.

m

A data frame of item means

digits

round to digits

sort

Should the factors be sorted first?

suppress.names

In lookupFromKeys, should we suppress the column labels

p

Show lmCor regressions with probability < p

ascending

order to sort the means in itemSort – see dfOrder

Details

fa.lookup and lookup are simple helper functions to summarize correlation matrices or factor loading matrices. bestItems will sort the specified column (criteria) of x on the basis of the (absolute) value of the column. The return as a default is just the rowname of the variable with those absolute values > cut. If there is a dictionary of item content and item names, then include the contents as a two column (or more) matrix with rownames corresponding to the item name and then as many fields as desired for item content. (See the example dictionary bfi.dictionary).

lookup is used by bestItems and will find values in c1 of y that match those in x. It returns those rows of y of that match x. Suppose that you have a "dictionary" of the many variables in a study but you want to consider a small subset of them in a data set x. Then, you can find the entries in the dictionary corresponding to x by lookup(rownames(x),y) If the column is not specified, then it will match by rownames(y).

fa.lookup is used when examining the output of a factor analysis and one wants the corresponding variable names and contents. The returned object may then be printed in LaTex by using the df2latex function with the char option set to TRUE.

fa.lookup will work with output from fa, pca or omega. For omega output, the items are sorted by the non-general factor loadings.

Similarly, given a correlation matrix, r, of the x variables, if you want to find the items that most correlate with another item or scale, and then show the contents of that item from the dictionary, bestItems(r,c1=column number or name of x, contents = y)

item.lookup combines the output from a factor analysis fa with simple descriptive statistics (a data frame of means) with a dictionary. Items are grouped by factor loadings > cut, and then sorted by item mean. This allows a better understanding of how a scale works, in terms of the meaning of the item endorsements. Note the means must be a one column matrix (with row names), not a vector (without rownames.)

itemSort Combine item means and item content and then sort them by the item means.

lookupItems searches a dictionary for all items that have a certain content. The rownames of the returned object are the item numbers which can then be used in other functions to find statistics (e.g. omega) of a scale with those items. If an scales by items correlation matrix is given, then the item correlation with that scale are also shown.

Value

bestItems returns a sorted list of factor loadings or correlations with the labels as provided in the dictionary.

lookup is a very simple implementation of the match function.

fa.lookup takes a factor/cluster analysis object (or just a keys like matrix), sorts it using fa.sort and then matches by row.name to the corresponding dictionary entries.

References

Revelle, W. (in preparation) An introduction to psychometric theory with applications in R. Springer. (Available online at https://personality-project.org/r/book/).

Author

William Revelle

Note

Although empirical scale construction is appealing, it has the basic problem of capitalizing on chance. Thus, be careful of over interpreting the results unless working with large samples. Iteration and bootstrapping aggregation (bagging) gives information on the stability of the solutions. See bestScales

To create a dictionary, create an object with row names as the item numbers, and the columns as the item content. See the bfi.dictionary in the psychTools package as an example. The bfi.dictionary was constructed from a spreadsheet with multiple columns, the first of which was the column names of the bfi. See the first (not run) example.

Examples

#Tne following shows how to create a dictionary
#first, copy the spreadsheet to the clipboard
#the spreadsheet should have multiple columns
#col 1         col 2     col 3
#item         content   label 
#A1           Am indifferent to the feelings of others.     (q_146)
#A2         Inquire about others' well-being. (q_1162
#...

# bfi.dictionary <- read.clipboard.tab()  #read from the clipboard
# rownames(bfi.dictionary) <- bfi.dictionary[1] #the first column had the names
# bfi.dictionary <- bfi.dictionary[-1]  #these are redundant, drop them

f5 <- fa(bfi,5)
m <- colMeans(bfi,na.rm=TRUE)
item.lookup(f5,m,dictionary=bfi.dictionary[2,drop=FALSE])
#> Warning: 'drop' argument will be ignored
#>             MR2   MR1   MR3   MR5   MR4 means
#> N1         0.78  0.09  0.00 -0.12 -0.03  2.41
#> N2         0.76  0.03  0.01 -0.09  0.02  4.80
#> N3         0.73 -0.06 -0.03  0.06  0.02  4.60
#> N5         0.53 -0.15  0.01  0.21 -0.17  4.70
#> N4         0.50 -0.36 -0.13  0.10  0.09  4.56
#> E4         0.00  0.67  0.02  0.18 -0.07  4.50
#> E2         0.15 -0.64 -0.02 -0.03 -0.06  4.37
#> E1        -0.03 -0.54  0.10 -0.07 -0.09  4.30
#> E3         0.08  0.49  0.00  0.16  0.29  2.55
#> E5         0.12  0.41  0.27  0.03  0.22  3.30
#> C2         0.16 -0.05  0.66  0.04  0.04  2.97
#> C4         0.18  0.06 -0.62 -0.01 -0.04  3.14
#> C3         0.04 -0.05  0.56  0.08 -0.06  4.00
#> C5         0.20 -0.12 -0.56  0.01  0.10  4.42
#> C1         0.07 -0.02  0.55 -0.04  0.15  4.42
#> A2         0.01  0.07  0.08  0.63  0.03  2.93
#> A3         0.00  0.23  0.03  0.58  0.03  3.51
#> A1         0.20  0.19  0.07 -0.51 -0.05  3.22
#> A5        -0.10  0.32  0.01  0.46  0.05  3.19
#> A4        -0.04  0.13  0.20  0.40 -0.14  2.97
#> gender     0.14  0.00  0.11  0.29 -0.16  4.82
#> age       -0.15 -0.12  0.08  0.19  0.08  2.71
#> O3         0.03  0.17  0.02  0.05  0.62  4.44
#> O1         0.01  0.13  0.07 -0.03  0.52  4.89
#> O5         0.13  0.14 -0.03 -0.02 -0.52  2.49
#> O2         0.20  0.11 -0.08  0.10 -0.44  1.67
#> O4         0.16 -0.28 -0.02  0.18  0.37  3.19
#> education -0.10 -0.14 -0.01  0.10  0.15 28.78
#>                                                 Item
#> N1        Get angry easily.                         
#> N2        Get irritated easily.                     
#> N3        Have frequent mood swings.                
#> N5        Panic easily.                             
#> N4        Often feel blue.                          
#> E4        Make friends easily.                      
#> E2        Find it difficult to approach others.     
#> E1        Don't talk a lot.                         
#> E3        Know how to captivate people.             
#> E5        Take charge.                              
#> C2        Continue until everything is perfect.     
#> C4        Do things in a half-way manner.           
#> C3        Do things according to a plan.            
#> C5        Waste my time.                            
#> C1        Am exacting in my work.                   
#> A2        Inquire about others' well-being.         
#> A3        Know how to comfort others.               
#> A1        Am indifferent to the feelings of others. 
#> A5        Make people feel at ease.                 
#> A4        Love children.                            
#> gender    males=1, females=2                        
#> age       age in years                              
#> O3        Carry the conversation to a higher level. 
#> O1        Am full of ideas.                         
#> O5        Will not probe deeply into a subject.     
#> O2        Avoid difficult reading material.         
#> O4        Spend time reflecting on things.          
#> education in HS, fin HS, coll,  coll grad , grad deg
 #just show the item content, not the source of the items
fa.lookup(f5,dictionary=bfi.dictionary[2]) 
#>             MR2   MR1   MR3   MR5   MR4   h2  com
#> N1         0.78  0.09  0.00 -0.12 -0.03 0.61 1.08
#> N2         0.76  0.03  0.01 -0.09  0.02 0.58 1.03
#> N3         0.73 -0.06 -0.03  0.06  0.02 0.56 1.03
#> N5         0.53 -0.15  0.01  0.21 -0.17 0.37 1.70
#> N4         0.50 -0.36 -0.13  0.10  0.09 0.48 2.15
#> E4         0.00  0.67  0.02  0.18 -0.07 0.55 1.17
#> E2         0.15 -0.64 -0.02 -0.03 -0.06 0.51 1.13
#> E1        -0.03 -0.54  0.10 -0.07 -0.09 0.32 1.17
#> E3         0.08  0.49  0.00  0.16  0.29 0.45 1.93
#> E5         0.12  0.41  0.27  0.03  0.22 0.39 2.58
#> C2         0.16 -0.05  0.66  0.04  0.04 0.44 1.15
#> C4         0.18  0.06 -0.62 -0.01 -0.04 0.46 1.20
#> C3         0.04 -0.05  0.56  0.08 -0.06 0.31 1.09
#> C5         0.20 -0.12 -0.56  0.01  0.10 0.43 1.43
#> C1         0.07 -0.02  0.55 -0.04  0.15 0.33 1.21
#> A2         0.01  0.07  0.08  0.63  0.03 0.47 1.07
#> A3         0.00  0.23  0.03  0.58  0.03 0.49 1.31
#> A1         0.20  0.19  0.07 -0.51 -0.05 0.28 1.67
#> A5        -0.10  0.32  0.01  0.46  0.05 0.45 1.93
#> A4        -0.04  0.13  0.20  0.40 -0.14 0.28 2.03
#> gender     0.14  0.00  0.11  0.29 -0.16 0.12 2.42
#> age       -0.15 -0.12  0.08  0.19  0.08 0.08 3.49
#> O3         0.03  0.17  0.02  0.05  0.62 0.47 1.18
#> O1         0.01  0.13  0.07 -0.03  0.52 0.33 1.17
#> O5         0.13  0.14 -0.03 -0.02 -0.52 0.29 1.28
#> O2         0.20  0.11 -0.08  0.10 -0.44 0.24 1.77
#> O4         0.16 -0.28 -0.02  0.18  0.37 0.24 2.83
#> education -0.10 -0.14 -0.01  0.10  0.15 0.05 3.47
#>                                                 Item
#> N1        Get angry easily.                         
#> N2        Get irritated easily.                     
#> N3        Have frequent mood swings.                
#> N5        Panic easily.                             
#> N4        Often feel blue.                          
#> E4        Make friends easily.                      
#> E2        Find it difficult to approach others.     
#> E1        Don't talk a lot.                         
#> E3        Know how to captivate people.             
#> E5        Take charge.                              
#> C2        Continue until everything is perfect.     
#> C4        Do things in a half-way manner.           
#> C3        Do things according to a plan.            
#> C5        Waste my time.                            
#> C1        Am exacting in my work.                   
#> A2        Inquire about others' well-being.         
#> A3        Know how to comfort others.               
#> A1        Am indifferent to the feelings of others. 
#> A5        Make people feel at ease.                 
#> A4        Love children.                            
#> gender    males=1, females=2                        
#> age       age in years                              
#> O3        Carry the conversation to a higher level. 
#> O1        Am full of ideas.                         
#> O5        Will not probe deeply into a subject.     
#> O2        Avoid difficult reading material.         
#> O4        Spend time reflecting on things.          
#> education in HS, fin HS, coll,  coll grad , grad deg

#just show the means and the items
#use the m vector we found above
itemSort(as.matrix(m),dictionary=bfi.dictionary[,2:3,drop=FALSE])
#>           means                                       Item     Giant3
#> gender     1.67 males=1, females=2                         NA        
#> A1         2.41 Am indifferent to the feelings of others.  Cohesion  
#> O5         2.49 Will not probe deeply into a subject.      Plasticity
#> C4         2.55 Do things in a half-way manner.            Stability 
#> O2         2.71 Avoid difficult reading material.          Plasticity
#> N1         2.93 Get angry easily.                          Stability 
#> E1         2.97 Don't talk a lot.                          Plasticity
#> N5         2.97 Panic easily.                              Stability 
#> E2         3.14 Find it difficult to approach others.      Plasticity
#> N4         3.19 Often feel blue.                           Stability 
#> education  3.19 in HS, fin HS, coll,  coll grad , grad deg NA        
#> N3         3.22 Have frequent mood swings.                 Stability 
#> C5         3.30 Waste my time.                             Stability 
#> N2         3.51 Get irritated easily.                      Stability 
#> E3         4.00 Know how to captivate people.              Plasticity
#> C3         4.30 Do things according to a plan.             Stability 
#> C2         4.37 Continue until everything is perfect.      Stability 
#> E4         4.42 Make friends easily.                       Plasticity
#> E5         4.42 Take charge.                               Plasticity
#> O3         4.44 Carry the conversation to a higher level.  Plasticity
#> C1         4.50 Am exacting in my work.                    Stability 
#> A5         4.56 Make people feel at ease.                  Cohesion  
#> A3         4.60 Know how to comfort others.                Cohesion  
#> A4         4.70 Love children.                             Cohesion  
#> A2         4.80 Inquire about others' well-being.          Cohesion  
#> O1         4.82 Am full of ideas.                          Plasticity
#> O4         4.89 Spend time reflecting on things.           Plasticity
#> age       28.78 age in years                               NA        


#show how to use lookupFromKeys 
bfi.keys <- 
list(agree=c("-A1","A2","A3","A4","A5"),conscientiousness=c("C1","C2","C3","-C4","-C5"),
extraversion=c("-E1","-E2","E3","E4","E5"),neuroticism=c("N1","N2","N3","N4","N5"),
openness = c("O1","-O2","O3","O4","-O5")) 
bfi.over <- scoreOverlap(bfi.keys,bfi) #returns the corrected for overlap values
lookupFromKeys(bfi.keys,bfi.dictionary,n=5, cors=bfi.over$item.cor)
#> $agree
#>     ItemLabel                                      Item   Giant3          Big6
#> A3     q_1206 Know how to comfort others.               Cohesion Agreeableness
#> A2     q_1162 Inquire about others' well-being.         Cohesion Agreeableness
#> A5     q_1419 Make people feel at ease.                 Cohesion Agreeableness
#> A4     q_1364 Love children.                            Cohesion Agreeableness
#> A1-    q_146  Am indifferent to the feelings of others. Cohesion Agreeableness
#>       Little12 Keying IPIP100  cors
#> A3  Compassion      1    B5:A  0.72
#> A2  Compassion      1    B5:A  0.69
#> A5  Compassion      1    B5:A  0.64
#> A4  Compassion      1    B5:A  0.50
#> A1- Compassion     -1    B5:A -0.40
#> 
#> $conscientiousness
#>     ItemLabel                                  Item    Giant3              Big6
#> C4-    q_626  Do things in a half-way manner.       Stability Conscientiousness
#> C2     q_530  Continue until everything is perfect. Stability Conscientiousness
#> C5-    q_1949 Waste my time.                        Stability Conscientiousness
#> C1     q_124  Am exacting in my work.               Stability Conscientiousness
#> C3     q_619  Do things according to a plan.        Stability Conscientiousness
#>            Little12 Keying IPIP100  cors
#> C4- Industriousness     -1    B5:C -0.72
#> C2  Orderliness          1    B5:C  0.68
#> C5- Industriousness     -1    B5:C -0.65
#> C1  Orderliness          1    B5:C  0.60
#> C3  Orderliness          1    B5:C  0.59
#> 
#> $extraversion
#>     ItemLabel                                  Item     Giant3         Big6
#> E2-    q_901  Find it difficult to approach others. Plasticity Extraversion
#> E4     q_1410 Make friends easily.                  Plasticity Extraversion
#> E3     q_1205 Know how to captivate people.         Plasticity Extraversion
#> E1-    q_712  Don't talk a lot.                     Plasticity Extraversion
#> E5     q_1768 Take charge.                          Plasticity Extraversion
#>          Little12 Keying IPIP100  cors
#> E2- Sociability       -1    B5:E -0.76
#> E4  Sociability        1    B5:E  0.74
#> E3  Assertiveness      1    B5:E  0.66
#> E1- Sociability       -1    B5:E -0.64
#> E5  Assertiveness      1    B5:E  0.60
#> 
#> $neuroticism
#>    ItemLabel                       Item    Giant3                Big6 Little12
#> N1    q_952  Get angry easily.          Stability Emotional Stability  Balance
#> N2    q_974  Get irritated easily.      Stability Emotional Stability  Balance
#> N3    q_1099 Have frequent mood swings. Stability Emotional Stability  Balance
#> N4    q_1479 Often feel blue.           Stability Emotional Stability  Balance
#> N5    q_1505 Panic easily.              Stability Emotional Stability  Balance
#>    Keying IPIP100 cors
#> N1     -1    B5:N 0.76
#> N2     -1    B5:N 0.75
#> N3     -1    B5:N 0.74
#> N4     -1    B5:N 0.62
#> N5     -1    B5:N 0.55
#> 
#> $openness
#>     ItemLabel                                      Item     Giant3     Big6
#> O3     q_492  Carry the conversation to a higher level. Plasticity Openness
#> O1     q_128  Am full of ideas.                         Plasticity Openness
#> O5-    q_1964 Will not probe deeply into a subject.     Plasticity Openness
#> O2-    q_316  Avoid difficult reading material.         Plasticity Openness
#> O4     q_1738 Spend time reflecting on things.          Plasticity Openness
#>      Little12 Keying IPIP100  cors
#> O3  Intellect      1    B5:O  0.67
#> O1  Intellect      1    B5:O  0.57
#> O5- Openness      -1    B5:O -0.57
#> O2- Intellect     -1    B5:O -0.48
#> O4  Openness       1    B5:O  0.36
#> 
 #show the keying information
 if(require(psychTools)){
lookupItems("life",psychTools::spi.dictionary) #find those items with "life" in the item
}
#> Loading required package: psychTools
#> Warning: there is no package called ‘psychTools’