You have installed psych (section 2) and you want to use it without reading much more. What should you do?
r
library(psych)
r
myData <- read.clipboard.tab()
r
pairs.panels(myData)
outlier(myData)
r
cleaned <- scrub(myData, max=9) #e.g., change anything great than 9 to NA
r
error.bars(myData)
Find the correlations of all of your data.
r
r <- lowerCor(myData)
r
corPlot(r)
r
corr.test(myData)
Test for the number of factors in your data using parallel analysis (fa.parallel, section 4.4.2) or Very Simple Structure (vss, 4.4.1).
r
fa.parallel(myData)
vss(myData)
Factor analyze (see section 4.1) the data with a specified number of factors (the default is 1), the default method is minimum residual, the default rotation for more than one factor is oblimin. There are many more possibilities (see sections 4.1.1-4.1.3). Compare the solution to a hierarchical cluster analysis using the ICLUST algorithm [@revelle1979hierarchical] (see section 4.1.6). Also consider a hierarchical factor solution to find coefficient $\omega$ (see 4.1.5).
r
fa(myData)
iclust(myData)
omega(myData)
If you prefer to do a principal components analysis you may use the principal function. The default is one component.
r
principal(myData)
Some people like to find coefficient $/alpha$ as an estimate of reliability. This may be done for a single scale using the alpha function (see 5.1). Perhaps more useful is the ability to create several scales as unweighted averages of specified items using the scoreItems function (see 5.4) and to find various estimates of internal consistency for these scales, find their intercorrelations, and find scores for all the subjects.
r
alpha(myData) #score all of the items as part of one scale.
myKeys <- make.keys(nvar=20,
list(first = c(1,-3,5,-7,8:10),
second=c(2,4,-6,11:15,-16)))
my.scores <- scoreItems(myKeys,myData) #form several scales
my.scores #show the highlights of the results
At this point you have had a chance to see the highlights of the psych
package and to do some basic (and advanced) data analysis. You might find reading this entire vignette helpful to get a broader understanding of what can be done in R using the psych
. Remember that the help command (?
) is available for every function. Try running the examples for each help page.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.