sjp.pca {sjPlot}

This document shows examples for using the sjp.pca function of the sjPlot package.


(back to table of content)

Data initialization

Please refer to this document.

# load package
# load sample data set.
# set theme
sjp.setTheme(theme = "539w", 
             geom.label.size = 3.5, 
             axis.textsize = .8, 
             axis.title.size = .9)

Plotting principal component analyses

First, we need to specify the items, which should be used to perfom the PCA. We use the Cope-Index-Scale from the sample dataset.

# recveive first item of COPE-index scale
start <- which(colnames(efc) == "c82cop1")
# recveive last item of COPE-index scale
end <- which(colnames(efc) == "c90cop9")

The sjp.pca function now computes a principal component analysis and plots the results:

sjp.pca(efc[, c(start:end)])

Changing plot style

With type = "tile" or type = "circle" the plot uses tiles or circles instead of bars.


sjp.pca(efc[, c(start:end)], type = "tile")


Note that when using type = "circle", the geom.size parameter needs to be changed to a larger default value.

sjp.pca(efc[, c(start:end)], type = "circle", geom.size = 9)

Identifying unclear factor loadings

The fctr.load.tlrn parameter specifies the minimum difference a factor loading needs to be assigned to a specific component only. All items, where the difference of the two closest factor loading values is less than this values, are removed from the return value

In the following example, the item do you find caregiving too demanding? has a factor loading of -.60 on the first component and -.42 on the second component. The difference is less then .2, as indicated by fctr.load.tlrn = .2, so this item is bein removed from the returned data frame - however, it is still shown in the plot.

mypca <- sjp.pca(efc[, c(start:end)], 
                 type = "tile",
                 fctr.load.tlrn = .2)

The return value contains the “updated” data frame, where factors with unclear loading have been removed (mypca$removed.df). You can, e.g. in case of testing scales or building index scores, perform an analysis of the item scale with the sjt.itemanalysis function, e.g. sjt.itemanalysis(mypca$removed.df, 2).

PCA with specific factor solution

You can force a certain amount of components / factors with the nmbr.fctr parameter. As you can see, the forced 3-component-solution also has one item which cannot be clearly assigned to a specific component.

sjp.pca(efc[, c(start:end)], nmbr.fctr = 3)

In the 3-factor-solution, item 7 has been removed do to unclear loading on a specific component.