alpha: Cronbach's Coefficient Alpha

Description Usage Arguments Details Value Author(s) Examples

View source: R/alpha.R

Description

Computes Cronbach's alpha. This reduces to KR-20 when the columns of the data matrix are dichotomous.

Usage

1
2
3
4
5
alpha(...)
## Default S3 method:
alpha(dat, ...)
## S3 method for class 'formula'
alpha(formula, data, na.action, subset, ...)

Arguments

formula

an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given under Details.

data

an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which alpha is called.

dat

A data frame or matrix with item responses. Implemented only for the alpha.default method.

na.action

a function which indicates what should happen when the data contain NAs. Defaults to getOption("na.action").

subset

an optional vector specifying a subset of observations to be used.

...

Not implemented

Details

The conditional alpha is accesible via the summary method for objects of class alpha

Value

A list with class "alpha" containing the following components:

alpha

coefficient alpha

numItems

the number of test items used in the computation

condAlpha

The alpha that would be realized if the item were excluded

Author(s)

Harold C. Doran

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
set.seed(1234)
tmp <- data.frame(item1 = sample(c(0,1), 20, replace=TRUE), item2 = sample(c(0,1), 20, replace=TRUE),
item3 = sample(c(0,1), 20, replace=TRUE),item4 = sample(c(0,1), 20, replace=TRUE),item5 = sample(c(0,1), 20, replace=TRUE))

## Formula interface
fm1 <- alpha(~ item1 + item2 + item3 + item4 + item5, data = tmp)
summary(fm1)
coef(fm1)

## Default interface
fm1 <- alpha(tmp)
summary(fm1)

wasabi1989/MiscPsycho documentation built on Jan. 19, 2020, 12:29 a.m.