data(ability)
cs<- psych::cs
keys <- list(ICAR16=colnames(ability),reasoning = cs(reason.4,reason.16,reason.17,reason.19),
letters=cs(letter.7, letter.33,letter.34,letter.58),
matrix=cs(matrix.45,matrix.46,matrix.47,matrix.55),
rotate=cs(rotate.3,rotate.4,rotate.6,rotate.8))
psych::scoreOverlap(keys,ability)
#this next step takes a few seconds to run and demonstrates IRT approaches
ability.irt <- psych::irt.fa(ability)
ability.scores <- psych::scoreIrt(ability.irt,ability)
ability.sub.scores <- psych::scoreIrt.2pl(keys,ability) #demonstrate irt scoring
#It is sometimes asked how to handle missing data when finding scores
#this next example compares 3 ways of scoring ability items from icar
#Just sum the items
#Sum the means for the items
#IRT score the items
total <- rowSums(ability, na.rm=TRUE)
means <- rowMeans(ability, na.rm=TRUE)
irt <- psych::scoreIrt(items=ability)[1]
df <- data.frame(total, means,irt)
psych:: pairs.panels(df)
Run the code above in your browser using DataLab