# Calculating inferential statistics for a single categorical variable

## Video: Calculating inferential statistics for a single categorical variable

In the last two movies we've looked at the most basic inferential statistics, the ones where we analyzed one variable at a time. We looked at the proportion for a nominal variable, with only two outcomes, that is, a dichotomous variable, and we looked at the mean for a scale variable. In both cases, we looked at both null hypothesis tests and confidence intervals. In this movie, we will expand things slightly by looking at how to do a hypothesis test for a nominal variable, or a categorical variable, that has more than two categories, something like occupation or a favorite sport.

## Calculating inferential statistics for a single categorical variable

In the last two movies we've looked at the most basic inferential statistics, the ones where we analyzed one variable at a time. We looked at the proportion for a nominal variable, with only two outcomes, that is, a dichotomous variable, and we looked at the mean for a scale variable. In both cases, we looked at both null hypothesis tests and confidence intervals. In this movie, we will expand things slightly by looking at how to do a hypothesis test for a nominal variable, or a categorical variable, that has more than two categories, something like occupation or a favorite sport.

Although it's possible to do confidence intervals for the number of people in each category, it's a complicated procedure, and it's not particularly helpful for most purposes. Instead, we'll just do a hypothesis test that looks at whether people are evenly distributed across all the categories in the variable. The test statistics that we'll use is called the One Sample Chi-Square Test in SPSS. It's also known as the Goodness-of- fit Test, and with SPSS's new automatic features, this is very easy to create and interpret.

I am going to be using the same data set as before, GSS.sav from the General Social Survey, and I thought it might be interesting to look at the variable that is second from the last, about people feeling happy. Specifically the question is self-rated happiness. Well, we have three possible answers: Not Too Happy, Pretty Happy, and Very Happy. And we can use this test to see if people fall evenly into those three different categories. To do this, we'd go to the Analyze menu, and then down to Nonparametric Tests, and again to One Sample.

This is the same one that we used for the single proportion. We're just going to be doing it a little bit differently this time. I need to go to the Fields tab, and then I have all of the variables that it can test in the Test Field thing. I don't want all of them there. It will be too much output. So what I am going to do is I am going to select all of these and put all of them back, and then I'll bring back over the only one that I want, which is near the bottom of the list, and it's Self-Rated Happiness. I can double-click on that to move it over.

Then I can go with the default test. All I need to do now is press Run, and I get the same kind of table I got before. It lets me know that the null hypothesis, or that the categories of Self-Rated Happiness, would occur with equal probabilities. That is that we would have the same percentage of people who said that they were Not Too Happy and Pretty Happy and Very Happy. All I can tell from this one is that those three are not evenly distributed. But this is an interactive model viewer, so I double-click on it and I will maximize that window.

And what I see is the hypothesized value is the green bars over here, and what it is, you see all three of them are the same size. The blue is how many I actually have. The green is how many I would have expected if things were distributed evenly. And it tells me that I have an observed 43 people who said they were not too happy. That's this blue bar right here, that's the Observed. The hypothesized was 116. So the difference between the two, the residual, is 73. In fact, what you can see is that in the first set, the Not Too Happy, I have fewer people than I would expect if people were evenly distributed.

On the other hand, I have a lot more people in the middle set, Pretty Happy, than I would expect. The Very Happy is actually right around one third of the group. Down below that, I have a table that gives me the total sample size, 349. The Test Statistic there is called the Chi-Square Test, and it's got a value of 88.06. It has what's called 2 Degrees of Freedom, and a Probability value, that's the Asymptotic Significance 2-sided test of less than 000. Again, it's not exactly 0, but it's going to be a small number.

Anyhow, this is the easiest possible hypothesis test for a categorical variable that has several categories in it. The One Sample Chi-Square Test, it's a quick and easy way to tell if your observations are distributed evenly across categories, or you can also specify some other expected way. It shows how important it can be to check whether the variation you see could be reasonably attributed to random, meaning less chance, or whether you might start to see something important that deserves further analysis.

Show transcript

#### This video is part of

SPSS Statistics Essential Training (2011)

52 video lessons · 20094 viewers

Author

Expand all | Collapse all
1. ### Introduction

2m 58s
1. Welcome
1m 5s
2. Using the exercise files
40s
3. Using a different version of the software
1m 13s
2. ### 1. Getting Started

19m 0s
1. Taking a first look at the interface
11m 49s
7m 11s
3. ### 2. Charts for One Variable

21m 54s
1. Creating bar charts for categorical variables
7m 18s
2. Creating pie charts for categorical variables
2m 54s
3. Creating histograms for quantitative variables
5m 45s
4. Creating box plots for quantitative variables
5m 57s
4. ### 3. Modifying Data

33m 10s
1. Recoding variables
5m 33s
2. Recoding with visual binning
5m 33s
3. Recoding by ranking cases
5m 26s
4. Computing new variables
5m 37s
5. Combining or excluding outliers
5m 21s
6. Transforming outliers
5m 40s
5. ### 4. Working with the Data File

28m 12s
1. Selecting cases
6m 44s
2. Using the Split File command
5m 12s
3. Merging files
5m 33s
4. Using the Multiple Response command
10m 43s
6. ### 5. Descriptive Statistics for One Variable

22m 14s
1. Calculating frequencies
8m 43s
2. Calculating descriptives
5m 31s
3. Using the Explore command
8m 0s
7. ### 6. Inferential Statistics for One Variable

16m 3s
1. Calculating inferential statistics for a single proportion
6m 6s
2. Calculating inferential statistics for a single mean
5m 39s
3. Calculating inferential statistics for a single categorical variable
4m 18s
8. ### 7. Charts for Two Variables

30m 43s
1. Creating clustered bar charts
7m 10s
2. Creating scatterplots
5m 8s
3. Creating time series
3m 24s
4. Creating simple bar charts of group means
4m 17s
5. Creating population pyramids
3m 0s
6. Creating simple boxplots for groups
3m 3s
7. Creating side-by-side boxplots
4m 41s
9. ### 8. Descriptive and Inferential Statistics for Two Variables

45m 28s
1. Calculating correlations
8m 17s
2. Computing a bivariate regression
6m 27s
3. Creating crosstabs for categorical variables
6m 34s
4. Comparing means with the Means procedure
6m 33s
5. Comparing means with the t-test
6m 4s
6. Comparing means with a one-way ANOVA
6m 30s
7. Comparing paired means
5m 3s
10. ### 9. Charts for Three or More Variables

24m 30s
1. Creating clustered bar charts for frequencies
6m 34s
2. Creating clustered bar charts for means
3m 45s
3. Creating scatterplots by group
4m 13s
4. Creating 3-D scatterplots
4m 25s
5. Creating scatterplot matrices
5m 33s
11. ### 10. Descriptive Statistics for Three or More Variables

30m 57s
1. Using Automatic Linear Models
11m 52s
2. Calculating multiple regression
9m 3s
3. Comparing means with a two-factor ANOVA
10m 2s
12. ### 11. Formatting and Exporting Tables and Charts

29m 29s
1. Formatting descriptive statistics
6m 1s
2. Formatting correlations
7m 49s
3. Formatting regression
10m 19s
4. Exporting charts and tables
5m 20s
13. ### Conclusion

51s
1. What's next
51s

### Start learning today

Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

### What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

### Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.

Exercise files

How to use exercise files.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.

Congratulations

You have completed SPSS Statistics Essential Training (2011).

Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

How to use exercise files.

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

• Mark video as unwatched
• Mark ALL videos as unwatched
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

## Are you sure you want to delete this note?

Thanks for signing up.

We’ll send you a confirmation email shortly.

• new course releases
• general communications
• special notices

Keep up with news, tips, and latest courses with emails from lynda.com.

• new course releases