#find confidence intervals of a correlation matrix with specified sample size
ci <- corCi(Thurstone[1:6,1:6],n=213)
ci #show them
R <- cor.plot.upperLowerCi(ci) #show them graphically
R #show them as a matrix
#confidence intervals by bootstrapping requires raw data
corCi(psychTools::bfi[1:200,1:10]) # just the first 10 variables
#The keys have overlapping scales
keys <- list(agree=c("-A1","A2","A3","A4","A5"), conscientious= 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"),
alpha=c("-A1","A2","A3","A4","A5","C1","C2","C3","-C4","-C5","N1","N2","N3","N4","N5"),
beta = c("-E1","-E2","E3","E4","E5","O1","-O2","O3","O4","-O5") )
#do not correct for item overlap
rci <- corCi(psychTools::bfi[1:200,],keys,n.iter=10,main="correlation with overlapping scales")
#also shows the graphic -note the overlap
#correct for overlap
rci <- cor.ci(psychTools::bfi[1:200,],keys,overlap=TRUE, n.iter=10,main="Correct for overlap")
#show the confidence intervals
ci <- cor.plot.upperLowerCi(rci) #to show the upper and lower confidence intervals
ci #print the confidence intervals in matrix form
Run the code above in your browser using DataLab