Look at https://personality-project.org/courses/350/350.week8.composites.pdf for the slides
library(psych)
library(psychTools)
packageDate("psych")
## [1] "2024-05-10"
data <- ability
Cscores <- rowSums(data) #total scores
Mscores <- rowMeans(data) #mean scores
cor2(Cscores,Mscores)
## [1] 1
length(Cscores)
## [1] 1525
#do it again, but with na.rm=TRUE
Cscores <- rowSums(data, na.rm=TRUE) #total scores
Mscores <- rowMeans(data,na.rm=TRUE) #mean scores
cor2(Cscores,Mscores)
## [1] 0.94
plot(Mscores ~ Cscores,main="means versus sum scores")
al <- alpha(data)
cor2(al$scores,Mscores)
## [1] 1
sf <- scoreFast(list(colnames(data)),data)
cor2(sf,Mscores)
## [,1]
## -A 1
keys <- list(colnames(data))
sf <- scoreFast(keys,data)
ability.keys
## $ICAR16
## [1] "reason.4" "reason.16" "reason.17" "reason.19" "letter.7" "letter.33" "letter.34" "letter.58"
## [9] "matrix.45" "matrix.46" "matrix.47" "matrix.55" "rotate.3" "rotate.4" "rotate.6" "rotate.8"
##
## $reasoning
## [1] "reason.4" "reason.16" "reason.17" "reason.19"
##
## $letters
## [1] "letter.7" "letter.33" "letter.34" "letter.58"
##
## $matrix
## [1] "matrix.45" "matrix.46" "matrix.47" "matrix.55"
##
## $rotate
## [1] "rotate.3" "rotate.4" "rotate.6" "rotate.8"
bfi.keys
## $agree
## [1] "-A1" "A2" "A3" "A4" "A5"
##
## $conscientious
## [1] "C1" "C2" "C3" "-C4" "-C5"
##
## $extraversion
## [1] "-E1" "-E2" "E3" "E4" "E5"
##
## $neuroticism
## [1] "N1" "N2" "N3" "N4" "N5"
##
## $openness
## [1] "O1" "-O2" "O3" "O4" "-O5"
spi.keys
## $Agree
## [1] "q_90" "q_1763" "q_253" "-q_1896" "q_851" "q_1832" "-q_501" "q_377" "-q_871"
## [10] "q_1855" "-q_4296" "-q_142" "q_379" "q_4289"
##
## $Consc
## [1] "q_1290" "q_1744" "q_1979" "-q_1452" "q_1915" "q_1201" "q_530" "-q_904" "q_1867"
## [10] "q_1694" "q_369" "-q_1444" "-q_1483" "-q_1254"
##
## $Neuro
## [1] "q_979" "q_4252" "q_1989" "q_1505" "q_4249" "q_808" "q_793" "-q_1840" "q_811"
## [10] "-q_1585" "q_578" "-q_176" "-q_797" "-q_1683"
##
## $Extra
## [1] "q_1904" "q_4243" "-q_312" "-q_565" "q_1416" "-q_1923" "-q_1027" "-q_684" "q_254"
## [10] "q_1296" "-q_901" "q_1243" "q_803" "q_1244"
##
## $Open
## [1] "q_128" "q_2745" "q_2754" "q_1392" "q_1058" "q_240" "q_1738" "q_422" "q_1389" "q_1310"
## [11] "q_1880" "-q_747" "q_1609" "q_1834"
##
## $Compassion
## [1] "q_253" "q_90" "q_1763" "q_851" "q_1832"
##
## $Trust
## [1] "q_1855" "q_4289" "q_377" "q_379" "-q_871"
##
## $Honesty
## [1] "-q_4296" "q_1812" "-q_501" "q_2853" "-q_1896"
##
## $Conservatism
## [1] "q_345" "-q_660" "q_1824" "-q_1825" "q_1328"
##
## $Authoritarianism
## [1] "q_1624" "q_1867" "-q_1609" "q_369" "q_398"
##
## $EasyGoingness
## [1] "q_1329" "q_1281" "q_1052" "q_1024" "q_1280"
##
## $Perfectionism
## [1] "q_530" "q_1915" "q_571" "q_1694" "q_142"
##
## $Order
## [1] "q_1201" "-q_1254" "-q_1483" "q_1290" "-q_169"
##
## $Industry
## [1] "-q_904" "q_1744" "-q_1444" "-q_1452" "q_1979"
##
## $Impulsivity
## [1] "q_35" "q_1173" "q_1424" "q_4276" "-q_4223"
##
## $SelfControl
## [1] "q_56" "q_736" "q_1590" "q_1462" "q_1461"
##
## $EmotionalStability
## [1] "-q_979" "q_174" "-q_793" "q_797" "q_1840"
##
## $Anxiety
## [1] "q_4252" "q_1989" "q_4249" "q_1505" "q_808"
##
## $Irritability
## [1] "q_952" "q_1357" "-q_1683" "-q_1585" "-q_176"
##
## $WellBeing
## [1] "-q_578" "-q_811" "q_2765" "q_820" "q_1371"
##
## $EmotionalExpressiveness
## [1] "q_219" "-q_1081" "q_803" "-q_1635" "q_1706"
##
## $Sociability
## [1] "q_1904" "-q_312" "-q_1923" "q_4243" "-q_684"
##
## $Adaptability
## [1] "-q_566" "-q_689" "q_39" "q_1542" "q_1303"
##
## $Charisma
## [1] "q_1045" "q_254" "-q_1242" "-q_901" "q_131"
##
## $Humor
## [1] "q_1243" "q_1244" "q_1248" "q_296" "-q_1685"
##
## $AttentionSeeking
## [1] "-q_565" "-q_1027" "q_1416" "q_1296" "q_1555"
##
## $SensationSeeking
## [1] "q_1367" "q_1664" "q_1781" "q_598" "q_1662"
##
## $Conformity
## [1] "q_152" "q_1300" "q_1653" "q_747" "q_2005"
##
## $Introspection
## [1] "q_1389" "q_1738" "q_755" "q_1880" "q_1310"
##
## $ArtAppreciation
## [1] "-q_610" "q_348" "-q_607" "-q_612" "q_1132"
##
## $Creativity
## [1] "q_2745" "q_128" "q_2754" "q_1392" "q_1058"
##
## $Intellect
## [1] "q_240" "-q_1253" "q_493" "q_422" "q_1834"
Keys can be used to show the content if we have a dictionary
lookupFromKeys(bfi.keys,bfi.dictionary[2:3])
## $agree
## Item Giant3
## A1- Am indifferent to the feelings of others. Cohesion
## A2 Inquire about others' well-being. Cohesion
## A3 Know how to comfort others. Cohesion
## A4 Love children. Cohesion
## A5 Make people feel at ease. Cohesion
##
## $conscientious
## Item Giant3
## C1 Am exacting in my work. Stability
## C2 Continue until everything is perfect. Stability
## C3 Do things according to a plan. Stability
## C4- Do things in a half-way manner. Stability
## C5- Waste my time. Stability
##
## $extraversion
## Item Giant3
## E1- Don't talk a lot. Plasticity
## E2- Find it difficult to approach others. Plasticity
## E3 Know how to captivate people. Plasticity
## E4 Make friends easily. Plasticity
## E5 Take charge. Plasticity
##
## $neuroticism
## Item Giant3
## N1 Get angry easily. Stability
## N2 Get irritated easily. Stability
## N3 Have frequent mood swings. Stability
## N4 Often feel blue. Stability
## N5 Panic easily. Stability
##
## $openness
## Item Giant3
## O1 Am full of ideas. Plasticity
## O2- Avoid difficult reading material. Plasticity
## O3 Carry the conversation to a higher level. Plasticity
## O4 Spend time reflecting on things. Plasticity
## O5- Will not probe deeply into a subject. Plasticity
lookupFromKeys(spi.keys, spi.dictionary[,c(2,5)])
## $Agree
## item B5
## q_90 Am concerned about others. Agree
## q_1763 Sympathize with others feelings. Agree
## q_253 Am sensitive to the needs of others. Agree
## q_1896- Use others for my own ends. Agree
## q_851 Feel sympathy for those who are worse off than myself. Agree
## q_1832 Think of others first. Agree
## q_501- Cheat to get ahead. Agree
## q_377 Believe that others have good intentions. Agree
## q_871- Feel that most people cant be trusted. Agree
## q_1855 Trust what people say. Agree
## q_4296- Tell a lot of lies. Agree
## q_142- Am hard to satisfy. Agree
## q_379 Believe that people are basically moral. Agree
## q_4289 Trust people to mainly tell the truth. Agree
##
## $Consc
## item B5
## q_1290 Like order. Consc
## q_1744 Start tasks right away. Consc
## q_1979 Work hard. Consc
## q_1452- Neglect my duties. Consc
## q_1915 Want every detail taken care of. Consc
## q_1201 Keep things tidy. Consc
## q_530 Continue until everything is perfect. Consc
## q_904- Find it difficult to get down to work. Consc
## q_1867 Try to follow the rules. Consc
## q_1694 Set high standards for myself and others. Consc
## q_369 Believe that laws should be strictly enforced. Consc
## q_1444- Need a push to get started. Consc
## q_1483- Often forget to put things back in their proper place. Consc
## q_1254- Leave a mess in my room. Consc
##
## $Neuro
## item B5
## q_979 Get overwhelmed by emotions. Neuro
## q_4252 Am a worrier. Neuro
## q_1989 Worry about things. Neuro
## q_1505 Panic easily. Neuro
## q_4249 Would call myself a nervous person. Neuro
## q_808 Fear for the worst. Neuro
## q_793 Experience my emotions intensely. Neuro
## q_1840- Think that my moods dont change more than most peoples do. Neuro
## q_811 Feel a sense of worthlessness or hopelessness. Neuro
## q_1585- Rarely get irritated. Neuro
## q_578 Dislike myself. Neuro
## q_176- Am not easily annoyed. Neuro
## q_797- Experience very few emotional highs and lows. Neuro
## q_1683- Seldom get mad. Neuro
##
## $Extra
## item B5
## q_1904 Usually like to spend my free time with people. Extra
## q_4243 Like going out a lot. Extra
## q_312- Avoid company. Extra
## q_565- Dislike being the center of attention. Extra
## q_1416 Make myself the center of attention. Extra
## q_1923- Want to be left alone. Extra
## q_1027- Hate being the center of attention. Extra
## q_684- Dont like crowded events. Extra
## q_254 Am skilled in handling social situations. Extra
## q_1296 Like to attract attention. Extra
## q_901- Find it difficult to approach others. Extra
## q_1243 Laugh a lot. Extra
## q_803 Express myself easily. Extra
## q_1244 Laugh aloud. Extra
##
## $Open
## item B5
## q_128 Am full of ideas. Open
## q_2745 Am able to come up with new and different ideas. Open
## q_2754 Am an original thinker. Open
## q_1392 Love to think up new ways of doing things. Open
## q_1058 Have a vivid imagination. Open
## q_240 Am quick to understand things. Open
## q_1738 Spend time reflecting on things. Open
## q_422 Can handle a lot of information. Open
## q_1389 Love to reflect on things. Open
## q_1310 Like to get lost in thought. Open
## q_1880 Try to understand myself. Open
## q_747- Enjoy being thought of as a normal mainstream person. Open
## q_1609 Rebel against authority. Open
## q_1834 Think quickly. Open
##
## $Compassion
## item B5
## q_253 Am sensitive to the needs of others. Agree
## q_90 Am concerned about others. Agree
## q_1763 Sympathize with others feelings. Agree
## q_851 Feel sympathy for those who are worse off than myself. Agree
## q_1832 Think of others first. Agree
##
## $Trust
## item B5
## q_1855 Trust what people say. Agree
## q_4289 Trust people to mainly tell the truth. Agree
## q_377 Believe that others have good intentions. Agree
## q_379 Believe that people are basically moral. Agree
## q_871- Feel that most people cant be trusted. Agree
##
## $Honesty
## item B5
## q_4296- Tell a lot of lies. Agree
## q_1812 Tell the truth. NA
## q_501- Cheat to get ahead. Agree
## q_2853 Cannot imagine lying or cheating. NA
## q_1896- Use others for my own ends. Agree
##
## $Conservatism
## item B5
## q_345 Believe in one true religion. NA
## q_660- Dont consider myself religious. NA
## q_1824 Tend to vote for conservative political candidates. NA
## q_1825- Tend to vote for liberal political candidates. NA
## q_1328 Like to stand during the national anthem. NA
##
## $Authoritarianism
## item B5
## q_1624 Respect authority. NA
## q_1867 Try to follow the rules. Consc
## q_1609- Rebel against authority. Open
## q_369 Believe that laws should be strictly enforced. Consc
## q_398 Believe that we should be tough on crime. NA
##
## $EasyGoingness
## item B5
## q_1329 Like to take it easy. NA
## q_1281 Like a leisurely lifestyle. NA
## q_1052 Have a slow pace to my life. NA
## q_1024 Hang around doing nothing. NA
## q_1280 Let things proceed at their own pace. NA
##
## $Perfectionism
## item B5
## q_530 Continue until everything is perfect. Consc
## q_1915 Want every detail taken care of. Consc
## q_571 Dislike imperfect work. NA
## q_1694 Set high standards for myself and others. Consc
## q_142 Am hard to satisfy. Agree
##
## $Order
## item B5
## q_1201 Keep things tidy. Consc
## q_1254- Leave a mess in my room. Consc
## q_1483- Often forget to put things back in their proper place. Consc
## q_1290 Like order. Consc
## q_169- Am not bothered by disorder. NA
##
## $Industry
## item B5
## q_904- Find it difficult to get down to work. Consc
## q_1744 Start tasks right away. Consc
## q_1444- Need a push to get started. Consc
## q_1452- Neglect my duties. Consc
## q_1979 Work hard. Consc
##
## $Impulsivity
## item B5
## q_35 Act without thinking. NA
## q_1173 Jump into things without thinking. NA
## q_1424 Make rash decisions. NA
## q_4276 Often make decisions on the spur of the moment. NA
## q_4223- Stop to think things over before doing anything. NA
##
## $SelfControl
## item B5
## q_56 Am able to control my cravings. NA
## q_736 Easily resist temptations. NA
## q_1590 Rarely overindulge. NA
## q_1462 Never splurge. NA
## q_1461 Never spend more than I can afford. NA
##
## $EmotionalStability
## item B5
## q_979- Get overwhelmed by emotions. Neuro
## q_174 Am not easily affected by my emotions. NA
## q_793- Experience my emotions intensely. Neuro
## q_797 Experience very few emotional highs and lows. Neuro
## q_1840 Think that my moods dont change more than most peoples do. Neuro
##
## $Anxiety
## item B5
## q_4252 Am a worrier. Neuro
## q_1989 Worry about things. Neuro
## q_4249 Would call myself a nervous person. Neuro
## q_1505 Panic easily. Neuro
## q_808 Fear for the worst. Neuro
##
## $Irritability
## item B5
## q_952 Get angry easily. NA
## q_1357 Lose my temper. NA
## q_1683- Seldom get mad. Neuro
## q_1585- Rarely get irritated. Neuro
## q_176- Am not easily annoyed. Neuro
##
## $WellBeing
## item B5
## q_578- Dislike myself. Neuro
## q_811- Feel a sense of worthlessness or hopelessness. Neuro
## q_2765 Am happy with my life. NA
## q_820 Feel comfortable with myself. NA
## q_1371 Love life. NA
##
## $EmotionalExpressiveness
## item B5
## q_219 Am open about my feelings. NA
## q_1081- Have difficulty expressing my feelings. NA
## q_803 Express myself easily. Extra
## q_1635- Reveal little about myself. NA
## q_1706 Show my sadness. NA
##
## $Sociability
## item B5
## q_1904 Usually like to spend my free time with people. Extra
## q_312- Avoid company. Extra
## q_1923- Want to be left alone. Extra
## q_4243 Like going out a lot. Extra
## q_684- Dont like crowded events. Extra
##
## $Adaptability
## item B5
## q_566- Dislike changes. NA
## q_689- Dont like the idea of change. NA
## q_39 Adjust easily. NA
## q_1542 Prefer variety to routine. NA
## q_1303 Like to begin new things. NA
##
## $Charisma
## item B5
## q_1045 Have a natural talent for influencing people. NA
## q_254 Am skilled in handling social situations. Extra
## q_1242- Lack the talent for influencing people. NA
## q_901- Find it difficult to approach others. Extra
## q_131 Am good at making impromptu speeches. NA
##
## $Humor
## item B5
## q_1243 Laugh a lot. Extra
## q_1244 Laugh aloud. Extra
## q_1248 Laugh my way through life. NA
## q_296 Amuse my friends. NA
## q_1685- Seldom joke around. NA
##
## $AttentionSeeking
## item B5
## q_565- Dislike being the center of attention. Extra
## q_1027- Hate being the center of attention. Extra
## q_1416 Make myself the center of attention. Extra
## q_1296 Like to attract attention. Extra
## q_1555 Put on a show to impress people. NA
##
## $SensationSeeking
## item B5
## q_1367 Love dangerous situations. NA
## q_1664 Seek danger. NA
## q_1781 Take risks. NA
## q_598 Do crazy things. NA
## q_1662 Seek adventure. NA
##
## $Conformity
## item B5
## q_152 Am just an ordinary person. NA
## q_1300 Like to be thought of as a normal kind of person. NA
## q_1653 See myself as an average person. NA
## q_747 Enjoy being thought of as a normal mainstream person. Open
## q_2005 Would hate to be considered odd or strange. NA
##
## $Introspection
## item B5
## q_1389 Love to reflect on things. Open
## q_1738 Spend time reflecting on things. Open
## q_755 Enjoy examining myself and my life. NA
## q_1880 Try to understand myself. Open
## q_1310 Like to get lost in thought. Open
##
## $ArtAppreciation
## item B5
## q_610- Do not like art. NA
## q_348 Believe in the importance of art. NA
## q_607- Do not enjoy going to art museums. NA
## q_612- Do not like poetry. NA
## q_1132 Have read the great literary classics. NA
##
## $Creativity
## item B5
## q_2745 Am able to come up with new and different ideas. Open
## q_128 Am full of ideas. Open
## q_2754 Am an original thinker. Open
## q_1392 Love to think up new ways of doing things. Open
## q_1058 Have a vivid imagination. Open
##
## $Intellect
## item B5
## q_240 Am quick to understand things. Open
## q_1253- Learn things slowly. NA
## q_493 Catch on to things quickly. NA
## q_422 Can handle a lot of information. Open
## q_1834 Think quickly. Open
bestScales
bestScales
is a simple “Machine Learning” learning
algorithm that does supervised learning by finding the items that best
correlate with a criterion based upon K-folds or n.iter bootstraps
bs <- bestScales(x=bfi[1:25], criteria = bfi[26:28],
dictionary=bfi.dictionary[2:3])
bs
##
## Call = bestScales(x = bfi[1:25], criteria = bfi[26:28], dictionary = bfi.dictionary[2:3])
## The items most correlated with the criteria yield r's of
## correlation n.items
## gender 0.32 9
## education 0.14 1
## age 0.24 10
##
## The best items, their correlations and content are
## $gender
## gender Item Giant3
## N5 0.21 Panic easily. Stability
## A2 0.18 Inquire about others' well-being. Cohesion
## A1 -0.16 Am indifferent to the feelings of others. Cohesion
## A3 0.14 Know how to comfort others. Cohesion
## A4 0.13 Love children. Cohesion
## E1 -0.13 Don't talk a lot. Plasticity
## N3 0.12 Have frequent mood swings. Stability
## O1 -0.10 Am full of ideas. Plasticity
## A5 0.10 Make people feel at ease. Cohesion
##
## $education
## education Item Giant3
## A1 -0.14 Am indifferent to the feelings of others. Cohesion
##
## $age
## age Item Giant3
## A1 -0.16 Am indifferent to the feelings of others. Cohesion
## C4 -0.15 Do things in a half-way manner. Stability
## A4 0.14 Love children. Cohesion
## A5 0.13 Make people feel at ease. Cohesion
## E5 0.11 Take charge. Plasticity
## A2 0.11 Inquire about others' well-being. Cohesion
## N3 -0.11 Have frequent mood swings. Stability
## E2 -0.11 Find it difficult to approach others. Plasticity
## N5 -0.10 Panic easily. Stability
## N2 -0.10 Get irritated easily. Stability
bs1 <- bestScales(x=bfi[1:25], criteria = bfi[26:28],
dictionary=bfi.dictionary[2:3], n.iter=100)
bs1
##
## Call = bestScales(x = bfi[1:25], criteria = bfi[26:28], n.iter = 100,
## dictionary = bfi.dictionary[2:3])
## derivation.mean derivation.sd validation.m validation.sd final.valid final.wtd N.wtd
## gender 0.32 0.021 0.30 0.029 0.29 0.33 10
## education 0.16 0.025 0.14 0.027 0.14 0.17 10
## age 0.25 0.019 0.22 0.023 0.24 0.25 10
##
## Best items on each scale with counts of replications
##
## Criterion = gender
## Freq mean.r sd.r Item Giant3
## N5 100 0.21 0.02 Panic easily. Stability
## A2 100 0.18 0.02 Inquire about others' well-being. Cohesion
## A1 100 -0.16 0.02 Am indifferent to the feelings of others. Cohesion
## A3 97 0.14 0.02 Know how to comfort others. Cohesion
## E1 91 -0.13 0.02 Don't talk a lot. Plasticity
##
## Criterion = education
## Freq mean.r sd.r Item Giant3
## A1 96 -0.14 0.02 Am indifferent to the feelings of others. Cohesion
##
## Criterion = age
## Freq mean.r sd.r Item Giant3
## A1 100 -0.16 0.02 Am indifferent to the feelings of others. Cohesion
## C4 99 -0.15 0.02 Do things in a half-way manner. Stability
## A4 100 0.14 0.02 Love children. Cohesion
## A5 94 0.13 0.02 Make people feel at ease. Cohesion