data(msqR)
table(msqR$form,msqR$time) #which forms?
table(msqR$study,msqR$drug) #Drug studies
table(msqR$study,msqR$film) #Film studies
table(msqR$study,msqR$TOD) #To examine time of day
#score them for 20 short scales -- note that these have item overlap
#The first 2 are from Thayer
#The next 2 are classic positive and negative affect
#The next 9 are circumplex scales
#the last 7 are msq estimates of PANASX scales (missing some items)
keys.list <- list(
EA = c("active", "energetic", "vigorous", "wakeful", "wide.awake", "full.of.pep",
"lively", "-sleepy", "-tired", "-drowsy"),
TA =c("intense", "jittery", "fearful", "tense", "clutched.up", "-quiet", "-still",
"-placid", "-calm", "-at.rest") ,
PA =c("active", "excited", "strong", "inspired", "determined", "attentive",
"interested", "enthusiastic", "proud", "alert"),
NAf =c("jittery", "nervous", "scared", "afraid", "guilty", "ashamed", "distressed",
"upset", "hostile", "irritable" ),
HAct = c("active", "aroused", "surprised", "intense", "astonished"),
aPA = c("elated", "excited", "enthusiastic", "lively"),
uNA = c("calm", "serene", "relaxed", "at.rest", "content", "at.ease"),
pa = c("happy", "warmhearted", "pleased", "cheerful", "delighted" ),
LAct = c("quiet", "inactive", "idle", "still", "tranquil"),
uPA =c( "dull", "bored", "sluggish", "tired", "drowsy"),
naf = c( "sad", "blue", "unhappy", "gloomy", "grouchy"),
aNA = c("jittery", "anxious", "nervous", "fearful", "distressed"),
Fear = c("afraid" , "scared" , "nervous" , "jittery" ) ,
Hostility = c("angry" , "hostile", "irritable", "scornful" ),
Guilt = c("guilty" , "ashamed" ),
Sadness = c( "sad" , "blue" , "lonely", "alone" ),
Joviality =c("happy","delighted", "cheerful", "excited", "enthusiastic", "lively", "energetic"),
Self.Assurance=c( "proud","strong" , "confident" , "-fearful" ),
Attentiveness = c("alert" , "determined" , "attentive" ))
#acquiscence = c("sleepy" , "wakeful" , "relaxed","tense"))
#Yik Russell and Steiger list the following items
Yik.keys <- list(
pleasure =psych::cs(happy,content,satisfied, pleased),
act.pleasure =psych::cs(proud,enthusiastic,euphoric),
pleasant.activation = psych::cs(energetic,full.of.pep,excited,wakeful,attentive,
wide.awake,active,alert,vigorous),
activation = psych::cs(aroused,hyperactivated,intense),
unpleasant.act = psych::cs(anxious,frenzied,jittery,nervous),
activated.displeasure =psych::cs(scared,upset,shaky,fearful,clutched.up,tense,
ashamed,guilty,agitated,hostile),
displeaure =psych::cs(troubled,miserable,unhappy,dissatisfied),
Ueactivated.Displeasure = psych::cs(sad,down,gloomy,blue,melancholy),
Unpleasant.Deactivation = psych::cs(droopy,drowsy,dull,bored,sluggish,tired),
Deactivation =psych::cs( quiet,still),
pleasant.deactivation = psych::cs(placid,relaxed,tranquil, at.rest,calm),
deactived.pleasure =psych::cs( serene,soothed,peaceful,at.ease,secure)
)
#of these 60 items, 46 appear in the msqR
Yik.msq.keys <- list(
Pleasure =psych::cs(happy,content,satisfied, pleased),
Activated.Pleasure =psych::cs(proud,enthusiastic),
Pleasant.Activation = psych::cs(energetic,full.of.pep,excited,wakeful,attentive,
wide.awake,active,alert,vigorous),
Activation = psych::cs(aroused,intense),
Unpleasant.Activation = psych::cs(anxious,jittery,nervous),
Activated.Displeasure =psych::cs(scared,upset,fearful,
clutched.up,tense,ashamed,guilty,hostile),
Displeasure = psych::cs(unhappy),
Deactivated.Displeasure = psych::cs(sad,gloomy,blue),
Unpleasant.Deactivation = psych::cs(drowsy,dull,bored,sluggish,tired),
Deactivation =psych::cs( quiet,still),
Pleasant.Deactivation = psych::cs(placid,relaxed,tranquil, at.rest,calm),
Deactivated.Pleasure =psych::cs( serene,at.ease)
)
yik.scores <- psych::scoreItems(Yik.msq.keys,msqR)
yik <- yik.scores$scores
f2.yik <- psych::fa(yik,2) #factor the yik scores
psych::fa.plot(f2.yik,labels=colnames(yik),title="Yik-Russell-Steiger circumplex",cex=.8,
pos=(c(1,1,2,1,1,1,3,1,4,1,2,4)))
msq.scores <- psych::scoreItems(keys.list,msqR)
#show a circumplex structure for the non-overlapping items
fcirc <- psych::fa(msq.scores$scores[,5:12],2)
psych::fa.plot(fcirc,labels=colnames(msq.scores$scores)[5:12])
# \donttest{
#now, find the correlations corrected for item overlap
msq.overlap <- psych::scoreOverlap(keys.list,msqR)
f2 <- psych::fa(msq.overlap$cor,2)
psych::fa.plot(f2,labels=colnames(msq.overlap$cor),
title="2 dimensions of affect, corrected for overlap")
#extend this solution to EA/TA NA/PA space
fe <- psych::fa.extension(cor(msq.scores$scores[,5:12],msq.scores$scores[,1:4]),fcirc)
psych::fa.diagram(fcirc,fe=fe,main="Extending the circumplex structure to EA/TA and PA/NA ")
#show the 2 dimensional structure
f2 <- psych::fa(msqR[1:72],2)
psych::fa.plot(f2,labels=colnames(msqR)[1:72],title="2 dimensions of affect at the item level")
#sort them by polar coordinates
round(psych::polar(f2),2)
# }
#the msqR and sai data sets have 10 overlapping items which can be used for
#testRetest analysis. We need to specify the keys, and then choose the appropriate
#data sets
sai.msq.keys <- list(pos =c( "at.ease" , "calm" , "confident", "content","relaxed"),
neg = c("anxious", "jittery", "nervous" ,"tense" , "upset"),
anx = c("anxious", "jittery", "nervous" ,"tense", "upset","-at.ease" , "-calm" ,
"-confident", "-content","-relaxed"))
select <- psych::selectFromKeys(sai.msq.keys$anx)
#The following is useful for examining test retest reliabilities
msq.control <- subset(msqR,is.element( msqR$study , c("Cart", "Fast", "SHED", "SHOP")))
msq.film <- subset(msqR,(is.element( msqR$study , c("FIAT", "FILM","FLAT","MIXX","XRAY"))
& (msqR$time < 3) ))
msq.film[((msq.film$study == "FLAT") & (msq.film$time ==3)) ,] <- NA
msq.drug <- subset(msqR,(is.element( msqR$study , c("AGES","SALT", "VALE", "XRAY")))
&(msqR$time < 3))
msq.day <- subset(msqR,is.element( msqR$study , c("SAM", "RIM")))
Run the code above in your browser using DataLab