File: tab_fa.Rd

package info (click to toggle)
r-cran-sjplot 2.8.17%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,596 kB
  • sloc: sh: 13; makefile: 2
file content (139 lines) | stat: -rw-r--r-- 6,123 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/tab_fa.R
\name{tab_fa}
\alias{tab_fa}
\title{Summary of factor analysis as HTML table}
\usage{
tab_fa(
  data,
  rotation = "promax",
  method = c("ml", "minres", "wls", "gls", "pa", "minchi", "minrank"),
  nmbr.fctr = NULL,
  fctr.load.tlrn = 0.1,
  sort = FALSE,
  title = "Factor Analysis",
  var.labels = NULL,
  wrap.labels = 40,
  show.cronb = TRUE,
  show.comm = FALSE,
  alternate.rows = FALSE,
  digits = 2,
  CSS = NULL,
  encoding = NULL,
  file = NULL,
  use.viewer = TRUE,
  remove.spaces = TRUE
)
}
\arguments{
\item{data}{A data frame that should be used to compute a PCA, or a \code{\link{prcomp}} object.}

\item{rotation}{Rotation of the factor loadings. May be one of
\code{"varimax", "quartimax", "promax", "oblimin", "simplimax", "cluster"}
or \code{"none"}.}

\item{method}{the factoring method to be used. \code{"ml"} will do a maximum likelihood factor analysis (default).
\code{"minres"} will do a minimum residual (OLS),
\code{"wls"} will do a weighted least squares (WLS) solution,
\code{"gls"} does a generalized weighted least squares (GLS),
\code{"pa"} will do the principal factor solution,
\code{"minchi"} will minimize the sample size weighted chi square
when treating pairwise correlations with different number of
subjects per pair. \code{"minrank"} will do a minimum rank factor analysis.}

\item{nmbr.fctr}{Number of factors used for calculating the rotation. By
default, this value is \code{NULL} and the amount of factors is
calculated according to the Kaiser-criteria.}

\item{fctr.load.tlrn}{Specifies the minimum difference a variable needs to have between
factor loadings (components) in order to indicate a clear loading on just one factor and not
diffusing over all factors. For instance, a variable with 0.8, 0.82 and 0.84 factor loading
on 3 possible factors can not be clearly assigned to just one factor and thus would be removed
from the principal component analysis. By default, the minimum difference of loading values
between the highest and 2nd highest factor should be 0.1}

\item{sort}{logical, if \code{TRUE}, sort the loadings for each factors
(items will be sorted in terms of their greatest loading, in descending
order)}

\item{title}{String, will be used as table caption.}

\item{var.labels}{Character vector with variable names, which will be used
to label variables in the output.}

\item{wrap.labels}{Numeric, determines how many chars of the value, variable
or axis labels are displayed in one line and when a line break is inserted.}

\item{show.cronb}{Logical, if \code{TRUE} (default), the cronbach's alpha value for each factor scale will be calculated,
i.e. all variables with the highest loading for a factor are taken for the
reliability test. The result is an alpha value for each factor dimension.
Only applies when \code{data} is a data frame.}

\item{show.comm}{Logical, if \code{TRUE}, show the communality column in the table.}

\item{alternate.rows}{Logical, if \code{TRUE}, rows are printed in
alternatig colors (white and light grey by default).}

\item{digits}{Amount of decimals for estimates}

\item{CSS}{A \code{\link{list}} with user-defined style-sheet-definitions,
according to the \href{https://www.w3.org/Style/CSS/}{official CSS syntax}.
See 'Details' or \href{https://strengejacke.github.io/sjPlot/articles/table_css.html}{this package-vignette}.}

\item{encoding}{Character vector, indicating the charset encoding used
for variable and value labels. Default is \code{"UTF-8"}. For Windows
Systems, \code{encoding = "Windows-1252"} might be necessary for proper
display of special characters.}

\item{file}{Destination file, if the output should be saved as file.
If \code{NULL} (default), the output will be saved as temporary file and
opened either in the IDE's viewer pane or the default web browser.}

\item{use.viewer}{Logical, if \code{TRUE}, the HTML table is shown in the IDE's
viewer pane. If \code{FALSE} or no viewer available, the HTML table is
opened in a web browser.}

\item{remove.spaces}{Logical, if \code{TRUE}, leading spaces are removed from all lines in the final string
that contains the html-data. Use this, if you want to remove parantheses for html-tags. The html-source
may look less pretty, but it may help when exporting html-tables to office tools.}
}
\value{
Invisibly returns
         \itemize{
           \item the web page style sheet (\code{page.style}),
           \item the web page content (\code{page.content}),
           \item the complete html-output (\code{page.complete}),
           \item the html-table with inline-css for use with knitr (\code{knitr}),
           \item the \code{factor.index}, i.e. the column index of each variable with the highest factor loading for each factor and
           \item the \code{removed.items}, i.e. which variables have been removed because they were outside of the \code{fctr.load.tlrn}'s range.
           }
           for further use.
}
\description{
Performs a factor analysis on a data frame or matrix
               and displays the factors as HTML
               table, or saves them as file. \cr \cr In case a data frame is used as
               parameter, the Cronbach's Alpha value for each factor scale will be calculated,
               i.e. all variables with the highest loading for a factor are taken for the
               reliability test. The result is an alpha value for each factor dimension.
}
\note{
This method for factor analysis relies on the functions
      \code{\link[psych]{fa}} and \code{\link[psych]{fa.parallel}} from the psych package.
}
\examples{
\dontrun{
# Data from the EUROFAMCARE sample dataset
library(sjmisc)
library(GPArotation)
data(efc)

# recveive first item of COPE-index scale
start <- which(colnames(efc) == "c82cop1")
# recveive last item of COPE-index scale
end <- which(colnames(efc) == "c90cop9")
# auto-detection of labels
if (interactive()) {
  tab_fa(efc[, start:end])
}}
}