Optional, following statistics can be computed as well:
If factor.groups
is not NULL
, the data frame df
will be
splitted into groups, assuming that factor.groups
indicate those columns
of the data frame that belong to a certain factor (see return value of function sjt.pca
as example for retrieving factor groups for a scale and see examples for more details).
sjt.itemanalysis(df, factor.groups = NULL, factor.groups.titles = "auto", scale = FALSE, min.valid.rowmean = 2, altr.row.col = TRUE, sort.col = NULL, sort.asc = TRUE, show.shapiro = FALSE, show.kurtosis = FALSE, show.corr.matrix = TRUE, CSS = NULL, encoding = NULL, file = NULL, use.viewer = TRUE, no.output = FALSE, remove.spaces = TRUE)
NULL
, df
will be splitted into sub-groups,
where the item analysis is carried out for each of these groups. Must be a vector of same
length as ncol(df)
, where each item in this vector represents the group number of
the related columns of df
. See 'Examples'.length(unique(factor.groups))
.
Default is "auto"
, which means that each table has a standard caption Component x.
Use NULL
to suppress table captions.TRUE
, the data frame's vectors will be scaled when calculating the
Cronbach's Alpha value (see reliab_test
). Recommended, when
the variables have different measures / scales.index.scores
and df.index.scores
are
computed for those items that have at least min.valid.rowmean
per case (observation, or
technically, row). See mean_n
for details.TRUE
, alternating rows are highlighted with a light gray
background color.sort.asc
argument. Default is NULL
, hence the data frame
is printed with no specific order. See 'Examples'.TRUE
(default) and sort.col
is not NULL
,
data frame is ordered according to the specified column in an ascending order.
Use FALSE
to apply descending order. See 'Examples'.TRUE
, a Shapiro-Wilk normality test is computed for each item.
See shapiro.test
for details.TRUE
(default), a correlation matrix of each component's
index score is shown. Only applies if factor.groups
is not NULL
and df
has
more than one group. First, for each case (df's row), the sum of all variables (df's columns) is
scaled (using the scale
-function) and represents a "total score" for
each component (a component is represented by each group of factor.groups
).
After that, each case (df's row) has a scales sum score for each component.
Finally, a correlation of these "scale sum scores" is computed.list
-object with user-defined style-sheet-definitions, according to the
official CSS syntax. See 'Details'.NULL
, so encoding will be auto-detected
depending on your platform (e.g., "UTF-8"
for Unix and "Windows-1252"
for
Windows OS). Change encoding if specific chars are not properly displayed (e.g. German umlauts).NULL
(default), the output will be saved as temporary file and
openend either in the IDE's viewer pane or the default web browser.TRUE
, the HTML table is shown in the IDE's viewer pane. If
FALSE
or no viewer available, the HTML table is opened in a web browser.TRUE
, the html-output is neither opened in a browser nor shown in
the viewer pane and not even saved to file. This option is useful when the html output
should be used in knitr
documents. The html output can be accessed via the return
value.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.df.list
: List of data frames with the item analysis for each sub.group (or complete, if factor.groups
was NULL
)
index.scores
: List of standardized scale / index scores of each case (mean value of all scale items for each case) for each sub-group. Note that NA's are removed from this list. Use df.index.scores
if you want to append the cases' related index scores to the original data frame.
df.index.scores
: A data frame with all index.scores
as column variables. While index.scores
don't have NA's included, this data frame's row-length equals to the originals data frame's row-length (and thus can be appended)
ideal.item.diff
: List of vectors that indicate the ideal item difficulty for each item in each sub-group. Item difficulty only differs when items have different levels.
cronbach.values
: List of Cronbach's Alpha values for the overall item scale for each sub-group.
knitr.list
: List of html-tables with inline-css for use with knitr for each table (sub-group)
knitr
: html-table of all complete output with inline-css for use with knitr
complete.page
: Complete html-output.
factor.groups
was NULL
, each list contains only one elment, since just one
table is printed for the complete scale indicated by df
. If factor.groups
is a vector of group-index-values, the lists contain elements for each sub-group.
sjt.frq
.
# Data from the EUROFAMCARE sample dataset
library(sjmisc)
data(efc)
# retrieve variable and value labels
varlabs <- get_label(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")
# create data frame with COPE-index scale
mydf <- data.frame(efc[, c(start:end)])
colnames(mydf) <- varlabs[c(start:end)]
## Not run:
# sjt.itemanalysis(mydf)
#
# # auto-detection of labels
# sjt.itemanalysis(efc[, c(start:end)])
#
# # Compute PCA on Cope-Index, and perform a
# # item analysis for each extracted factor.
# factor.groups <- sjt.pca(mydf, no.output = TRUE)$factor.index
# sjt.itemanalysis(mydf, factor.groups)## End(Not run)
Run the code above in your browser using DataLab