R/sjTabItemAnalysis.R
sjt.itemanalysis.Rd
This function performs an item analysis with certain statistics that are useful for scale or index development. The resulting tables are shown in the viewer pane resp. 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) interitemcorrelation
Optional, following statistics can be computed as well:
kurstosis
ShapiroWilk 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).
sjt.itemanalysis(df, factor.groups = NULL, factor.groups.titles = "auto", scale = FALSE, min.valid.rowmean = 2, altr.row.col = TRUE, sort.column = NULL, 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)
df  A data frame with items. 

factor.groups  If not 
factor.groups.titles  Titles for each factor group that will be used as table caption for each
componenttable. Must be a character vector of same length as 
scale  Logical, if 
min.valid.rowmean  Minimum amount of valid values to compute row means for index scores.
Default is 2, i.e. the return values 
altr.row.col  Logical, if 
sort.column  Numeric vector, indicating the index of the column
that should sorted. by default, the column is sorted in ascending order.
Use negative index for descending order, for instance,

show.shapiro  Logical, if 
show.kurtosis  Logical, if 
show.corr.matrix  Logical, if 
CSS  A 
encoding  String, indicating the charset encoding used for variable and
value labels. Default is 
file  Destination file, if the output should be saved as file.
If 
use.viewer  Logical, if 
no.output  Logical, if 
remove.spaces  Logical, if 
Invisibly returns
df.list
: List of data frames with the item analysis for each sub.group (or complete, if factor.groups
was NULL
)
index.scores
: A data frame with of standardized scale / index scores for each case (mean value of all scale items for each case) for each subgroup.
ideal.item.diff
: List of vectors that indicate the ideal item difficulty for each item in each subgroup. Item difficulty only differs when items have different levels.
cronbach.values
: List of Cronbach's Alpha values for the overall item scale for each subgroup.
knitr.list
: List of htmltables with inlinecss for use with knitr for each table (subgroup)
knitr
: htmltable of all complete output with inlinecss for use with knitr
complete.page
: Complete htmloutput.
If factor.groups = 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 groupindexvalues, the lists contain elements for each subgroup.
See 'Details' in sjt.frq
.
The ShapiroWilk Normality Test (see column W(p)
) tests if an item has a distribution that is significantly different from normal.
Item difficulty should range between 0.2 and 0.8. Ideal value is p+(1p)/2
(which mostly is between 0.5 and 0.8).
For item discrimination, acceptable values are 0.20 or higher; the closer to 1.00 the better. See reliab_test
for more details.
In case the total Cronbach's Alpha value is below the acceptable cutoff of 0.7 (mostly if an index has few items), the mean interitemcorrelation is an alternative measure to indicate acceptability. Satisfactory range lies between 0.2 and 0.4. See also mic
.
See 'Notes' in sjt.frq
.
Jorion N, Self B, James K, Schroeder L, DiBello L, Pellegrino J (2013) 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), 106148. doi: 10.1111/j.14676494.1986.tb00391.x
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. (web)
# Data from the EUROFAMCARE sample dataset library(sjmisc) library(sjlabelled) data(efc) # retrieve variable and value labels varlabs < get_label(efc) # recveive first item of COPEindex scale start < which(colnames(efc) == "c82cop1") # recveive last item of COPEindex scale end < which(colnames(efc) == "c90cop9") # create data frame with COPEindex scale mydf < data.frame(efc[, start:end]) colnames(mydf) < varlabs[start:end]# NOT RUN { sjt.itemanalysis(mydf) # autodetection of labels sjt.itemanalysis(efc[, start:end]) # Compute PCA on CopeIndex, and perform a # item analysis for each extracted factor. factor.groups < sjt.pca(mydf, no.output = TRUE)$factor.index sjt.itemanalysis(mydf, factor.groups) # }