Learn R Programming

sjPlot (version 1.7)

sjt.itemanalysis: Show item analysis of an item scale as HTML table

Description

This function performs an item analysis with certain statistics that are useful for scale / index development. The resulting tables are shown in the viewer pane / webbrowser or can be saved as file. Following statistics are computed for each item of a data frame:
  • percentage of missing values
  • mean value
  • standard deviation
  • skew
  • item difficulty
  • item discrimination
  • Cronbach's Alpha if item was removed from scale
  • mean (or average) inter-item-correlation
Optional, following statistics can be computed as well:
  • kurstosis
  • Shapiro-Wilk Normality Test
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).

Usage

sjt.itemanalysis(df, factor.groups = NULL, factor.groups.titles = "auto",
  scaleItems = FALSE, minValidRowMeanValue = 2, alternateRowColors = TRUE,
  orderColumn = NULL, orderAscending = TRUE, showShapiro = FALSE,
  showKurtosis = FALSE, showCompCorrMat = TRUE, file = NULL,
  encoding = NULL, CSS = NULL, useViewer = TRUE, no.output = FALSE,
  remove.spaces = TRUE)

Arguments

Value

(Invisibly) returns a structure with following elements:
  • df.list: List of data frames with the item analysis for each sub.group (or complete, iffactor.groupswasNULL)
  • 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. Usedf.index.scoresif you want to append the cases' related index scores to the original data frame.
  • df.index.scores: A data frame with allindex.scoresas column variables. Whileindex.scoresdon'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.
If 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.

References

  • Jorion N, Self B, James K, Schroeder L, DiBello L, Pellegrino J (2013) Classical Test Theory Analysis of the Dynamics Concept Inventory. (https://www.academia.edu/4104752/Classical_Test_Theory_Analysis_of_the_Dynamics_Concept_Inventory{web})
  • Briggs SR, Cheek JM (1986) The role of factor analysis in the development and evaluation of personality scales. Journal of Personality, 54(1), 106-148 (http://onlinelibrary.wiley.com/doi/10.1111/j.1467-6494.1986.tb00391.x/abstract{web})
  • McLean S et al. (2013) Stigmatizing attitudes and beliefs about bulimia nervosa: Gender, age, education and income variability in a community sample. International Journal of Eating Disorders, doi: 10.1002/eat.22227.
  • Trochim WMK (2008) Types of Reliability. (http://www.socialresearchmethods.net/kb/reltypes.php{web})

See Also

Examples

Run this code
# -------------------------------
# Data from the EUROFAMCARE sample dataset
# -------------------------------
data(efc)

# retrieve variable and value labels
varlabs <- get_var_labels(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
df <- as.data.frame(efc[,c(start:end)])
colnames(df) <- varlabs[c(start:end)]

sjt.itemanalysis(df)

# -------------------------------
# auto-detection of labels
# -------------------------------
efc <- set_var_labels(efc, varlabs)
sjt.itemanalysis(efc[,c(start:end)])

# ---------------------------------------
# Compute PCA on Cope-Index, and perform a
# item analysis for each extracted factor.
# ---------------------------------------
factor.groups <- sjt.pca(df, no.output=TRUE)$factor.index
sjt.itemanalysis(df, factor.groups)

Run the code above in your browser using DataLab