Learn R Programming

userfriendlyscience (version 0.1-2)

scaleDiagnosis: scaleDiagnosis

Description

scaleDiagnosis provides a number of diagnostics for a scale (an aggregative measure consisting of several items).

Usage

scaleDiagnosis(dat=NULL, items=NULL, plotSize=180, sizeMultiplier = 1,
               axisLabels = "none", scaleReliability.ci=FALSE, conf.level=.95)

Arguments

dat
A dataframe containing the items in the scale. All variables in this dataframe will be used if items is NULL.
items
If not NULL, this should be a character vector with the names of the variables in the dataframe that represent items in the scale.
plotSize
Size of the final plot in millimeters.
sizeMultiplier
Allows more flexible control over the size of the plot elements
axisLabels
Passed to ggpairs function to set axisLabels.
scaleReliability.ci
TRUE or FALSE: whether to compute confidence intervals for Cronbach's Alpha and Omega (uses bootstrapping function in MBESS, takes a while).
conf.level
Confidence of confidence intervals for reliability estimates (if requested with scaleReliability.ci).

Value

  • An object with the input and several output variables. Most notably:
  • scaleReliabilityThe results of scaleReliability.
  • pcaA Principal Components Analysis
  • faA Factor Analysis
  • describeDecriptive statistics about the items
  • ggpairs.combinedA scattermatrix with histograms on the diagonal and correlation coefficients in the upper right half.

Details

Function to generate an object with several useful statistics and a plot to assess how the elements (usually items) in a scale relate to each other, such as Cronbach's Alpha, omega, the Greatest Lower Bound, a factor analysis, and a correlation matrix.

Examples

Run this code
### This will prompt the user to select an SPSS file
scaleDiagnosis();

### Generate a datafile to use
exampleData <- data.frame(item1=rnorm(100));
exampleData$item2 <- exampleData$item1+rnorm(100);
exampleData$item3 <- exampleData$item1+rnorm(100);
exampleData$item4 <- exampleData$item2+rnorm(100);
exampleData$item5 <- exampleData$item2+rnorm(100);

### Use all items
scaleDiagnosis(dat=exampleData);

### Use a selection of two variables
scaleDiagnosis(dat=exampleData, items=c('item2', 'item4'));

Run the code above in your browser using DataLab