sjt.pca {sjPlot}

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

Ressources:

(back to table of content)

Basics of the sjt-functions

Please refer to this document

Data initialization

Please refer to this document.

library(sjPlot)
library(sjmisc)
data(efc)

Printing 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 sjt.pca function now computes a principal component analysis and plots the results as HTML table:

sjt.pca(efc[,c(start:end)])
Principal Component Analysis (with varimax rotation)
  Component 1 Component 2
do you feel you cope well as caregiver? 0.29 0.60
do you find caregiving too demanding? -0.60 -0.42
does caregiving cause difficulties in
your relationship with your friends?
-0.69 -0.16
does caregiving have negative effect on
your physical health?
-0.73 -0.12
does caregiving cause difficulties in
your relationship with your family?
-0.64 -0.01
does caregiving cause financial
difficulties?
-0.69 0.12
do you feel trapped in your role as
caregiver?
-0.68 -0.38
do you feel supported by
friends/neighbours?
-0.07 0.64
do you feel caregiving worthwhile? 0.07 0.75
Cronbach’s α 0.78 0.45

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 highlighted to indicate weak assignments.

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 highlighted.

sjt.pca(efc[,c(start:end)], fctr.load.tlrn = .2)
Principal Component Analysis (with varimax rotation)
  Component 1 Component 2
do you feel you cope well as caregiver? 0.29 0.60
do you find caregiving too demanding? -0.60 -0.42
does caregiving cause difficulties in
your relationship with your friends?
-0.69 -0.16
does caregiving have negative effect on
your physical health?
-0.73 -0.12
does caregiving cause difficulties in
your relationship with your family?
-0.64 -0.01
does caregiving cause financial
difficulties?
-0.69 0.12
do you feel trapped in your role as
caregiver?
-0.68 -0.38
do you feel supported by
friends/neighbours?
-0.07 0.64
do you feel caregiving worthwhile? 0.07 0.75
Cronbach’s α 0.78 0.45

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.

sjt.pca(efc[,c(start:end)], nmbr.fctr = 3)
Principal Component Analysis (with varimax rotation)
  Component 1 Component 2 Component 3
do you feel you cope well as caregiver? 0.01 0.10 -0.81
do you find caregiving too demanding? -0.37 -0.03 0.70
does caregiving cause difficulties in
your relationship with your friends?
-0.68 -0.12 0.24
does caregiving have negative effect on
your physical health?
-0.62 0.06 0.39
does caregiving cause difficulties in
your relationship with your family?
-0.71 -0.11 0.02
does caregiving cause financial
difficulties?
-0.74 0.06 0.03
do you feel trapped in your role as
caregiver?
-0.53 -0.12 0.56
do you feel supported by
friends/neighbours?
0.09 0.89 0.04
do you feel caregiving worthwhile? -0.00 0.61 -0.45
Cronbach’s α 0.69 0.41 -0.02

Adding further statistics

You can add several statistics like measure of sampling adequacy, Kaiser-Meyer-Olkin or cumulative and proportion of variance to the output.

sjt.pca(efc[,c(start:end)], show.msa = TRUE, show.var = TRUE)
Principal Component Analysis (with varimax rotation)
  Component 1 Component 2 MSA
do you feel you cope well as caregiver? 0.29 0.60 0.83
do you find caregiving too demanding? -0.60 -0.42 0.85
does caregiving cause difficulties in
your relationship with your friends?
-0.69 -0.16 0.86
does caregiving have negative effect on
your physical health?
-0.73 -0.12 0.86
does caregiving cause difficulties in
your relationship with your family?
-0.64 -0.01 0.87
does caregiving cause financial
difficulties?
-0.69 0.12 0.84
do you feel trapped in your role as
caregiver?
-0.68 -0.38 0.84
do you feel supported by
friends/neighbours?
-0.07 0.64 0.70
do you feel caregiving worthwhile? 0.07 0.75 0.75
Proportion of Variance 35.91 % 14.21 %
Cumulative Proportion 35.91 % 50.12 %
Cronbach’s α 0.78 0.45
Kaiser-Meyer-Olkin 0.84