# How to Calculate Cronbach’s Alpha in R-With Examples

Calculate Cronbach’s Alpha in R, Cronbach’s alpha is a metric for determining the internal consistency, or reliability, of a set of scale or test items.

In other words, a measurement’s reliability refers to how constant it is in measuring a notion, and Cronbach’s alpha is one means of determining how strong that consistency is.

Cronbach’s Alpha is a scale that spans from 0 to 1, with higher values suggesting a more credible survey or questionnaire.

## Calculate Cronbach’s Alpha in R

The cronbach.alpha() function from the ltm package is the simplest way to calculate Cronbach’s Alpha.

This lesson shows you how to use this function in the real world.

### Example: How to Calculate Cronbach’s Alpha in R

Let’s say a restaurant manager wants to gauge overall customer happiness, so she sends out a survey to ten customers asking them to score the restaurant on a scale of 1 to 3 in a variety of parameters.

Market Basket Analysis in Data Mining » What Goes WIth What » finnstats

To calculate Cronbach’s Alpha for survey responses, we can use the following code.

library(ltm)

In a data frame, enter survey replies

df<-data.frame(Q1=c(1, 1, 1, 2, 2, 1, 1, 3, 2, 1), Q2=c(1, 1, 1, 1, 3, 2, 2, 2, 2, 2), Q3=c(1, 2, 2, 3, 3, 3, 1, 3, 3, 2))

Q1 Q2 Q3 1 1 1 1 2 1 1 2 3 1 1 2 4 2 1 3 5 2 3 3 6 1 2 3 7 1 2 1 8 3 2 3 9 2 2 3 10 1 2 2

Now we can calculate the Cronbach’s Alpha

cronbach.alpha(data)

Cronbach's alpha for the 'df' data-set Items: 3 Sample units: 10 alpha: 0.726

We can also use the CI=True option to get a 95 percent confidence interval for Cronbach’s Alpha:

Cronbach’s Alpha with a 95% confidence interval is calculated.

cronbach.alpha(df, CI=TRUE)

Cronbach's alpha for the 'df' data-set Items: 3 Sample units: 10 alpha: 0.726 Bootstrap 95% CI based on 1000 samples 2.5% 97.5% 0.192 0.886

Cronbach’s Alpha has a 95 percent confidence interval of [0.19, 0.88], as can be seen.

Because our sample size is so small, this confidence interval is unusually large. In practice, a sample size of at least 20 is advised.

For the purpose of simplicity, we utilized a sample size of 10.

The table below shows how different Cronbach’s Alpha values are typically interpreted.

Cronbach’s Alpha | Internal consistency |

0.9 ≤ α | Excellent |

0.8 ≤ α < 0.9 | Good |

0.7 ≤ α < 0.8 | Acceptable |

0.6 ≤ α < 0.7 | Questionable |

0.5 ≤ α < 0.6 | Poor |

α < 0.5 | Unacceptable |

We would argue that the internal consistency of this survey is “Acceptable,” based on Cronbach’s Alpha of 0.726.

Remember that the coefficient of a scale is a function of both item covariances and the number of items in the analysis, so a high coefficient isn’t necessarily a sign of a “good” or reliable set of items;

you can often increase the coefficient simply by increasing the number of items in the analysis.

Linear Discriminant Analysis: A step by step Guide » finnstats

Cronbach’s alpha can be calculated in a variety of methods in R using a variety of tools. One method is to use the psy package, which may be installed if it isn’t present on your computer by running the following command:

install.packages("psy") library(psy) cronbach(df)

$sample.size [1] 10 $number.of.items [1] 3 $alpha [1] 0.7263158