Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Statistics for Sociologists/Chapter 3: The General Social Survey - What It Is and How to Use It

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Chapter 3: The General Social Survey — What It Is and How to Use It Here is a genuinely strange fact about American society, and you don't need a single statistic yet to appreciate it: ask someone who earns $22,000 a year and someone who earns $220,000 a year what social class they belong to, and there is a good chance both of them will say "middle class." Actual income says otherwise, rather loudly. This is not a fluke of one weird survey question — it's one of the more durable findings to come out of a dataset that has been quietly interviewing Americans about exactly this kind of thing since 1972: the General Social Survey, or GSS.Smith, T. W., Marsden, P. V., & Hout, M. (2013). General Social Survey, 1972–2010 [Cumulative File] (ICPSR 31521). Inter-university Consortium for Political and Social Research [distributor]. https://doi.org/10.3886/ICPSR31521.v1 You are going to spend the rest of this semester with this dataset. It deserves a proper introduction before you start running functions on it. alt=Image inside a standard American home.|thumb|center|800x800px|The GSS provides a regular snapshot of the lives, beliefs, values, and behaviors of everyday Americans. A Survey With a Track Record The GSS is conducted by NORC (originally the National Opinion Research Center, now known simply as NORC), an independent research organization affiliated with the University of Chicago. It has been fielded almost every year or two since 1972, funded primarily by the National Science Foundation, which means it exists specifically to serve basic social science research rather than any particular commercial or political interest. Fifty-plus years of the same core questions, asked the same careful way, is what makes the GSS valuable in a way that a one-off internet poll simply cannot match. A single survey tells you what people think right now. A survey repeated consistently for half a century tells you how American society has actually changed — not how people remember it changing, which, per Chapter 1, is a very different and considerably less reliable thing. What the GSS Actually Measures The GSS is not narrowly focused on any one topic, which is part of its appeal. In a single interview, a respondent might be asked about their job satisfaction, their views on capital punishment, how many hours of television they watch, whether they believe in a god, how happy their marriage is, and how much they trust their neighbors. Broadly, GSS questions fall into a few major territories: Demographics — age, sex, race, education, marital status, region: the basic architecture of who a respondent is. Socioeconomic characteristics — income, occupational prestige, subjective class identification (the source of this chapter's opening example). Attitudes and beliefs — happiness, political views, trust in institutions, views on gender roles, and dozens of other topics that shift over the decades in ways that are genuinely interesting to track. Religion — affiliation, attendance, belief in a god, and related questions, treated with the same systematic rigor as everything else. Behaviors — voting, church attendance, hours worked, and other things people actually do, as opposed to what they believe or feel. Researchers have used the GSS to study everything from the decline of religious affiliation to shifting attitudes on marriage, race, and gender, to whether Americans trust each other less than they used to (a genuinely contested and interesting question — more trust-related material comes back in Chapter 13). This is not a boring demographic clipboard. It is one of the more complete running records of American social life that exists. How the GSS Is Collected: Sampling, in Plain English You cannot interview all roughly 260 million American adults, and thankfully, you don't need to. The GSS relies on probability sampling: a method of selecting respondents such that every adult in the target population has a known, nonzero chance of being included. This is the opposite of, say, an online poll that anyone can click into — a method that captures only the people who happened to see the link and cared enough to respond, which is not a representative slice of anybody. Before going further, three terms are worth pinning down, because they'll recur constantly from here on. A population is the entire group you actually care about — every American adult, in the GSS's case. A sample is the smaller subgroup you actually observe and measure, which you then use to draw conclusions about the population you couldn't fully observe. A parameter is a summary number describing the population (the true percentage of American adults who attend religious services weekly, say) — a number that, outside of a full census, is essentially never actually known. What you calculate instead, from your sample, is a statistic — the sample's own percentage of weekly attenders — which you use as your best estimate of the parameter you can't directly see. Nearly everything from here to Chapter 13 is really just this same move, dressed up in different formulas: using a known statistic to make an honest guess about an unknown parameter. (One edge case worth naming: if you somehow did measure the entire population — every single American adult — that's called a census, and you wouldn't need any of the statistical machinery in this book at all. There'd be no estimating involved, because you'd already have the real number. The GSS is emphatically not a census; it's a sample-based estimate, which is exactly why the sampling design matters so much.) Five Ways to Build a Sample — and Which One the GSS Actually Uses Not all probability samples are built the same way. Here are the main approaches, in roughly increasing order of real-world practicality for something like a national survey: Simple random sampling (SRS) — every member of the population has an equal, independent chance of selection, as if every American adult's name were in one enormous hat. It's the cleanest method to reason about mathematically, and nearly impossible to actually pull off at national scale: there is no single list of all 260 million American adults to draw names from, and even if there were, interviewers would end up scattered across every zip code in the country trying to reach one respondent here, one two states away. Stratified sampling — divide the population into subgroups ("strata") first — by region, say, or race, or age — and then sample randomly within each stratum. This guarantees that smaller subgroups show up in the final sample in known, adequate numbers, rather than leaving it to chance whether, say, enough rural respondents happen to get picked. Cluster sampling — divide the population into naturally occurring groups ("clusters") — city blocks, counties, schools — randomly select some clusters, then interview everyone inside the selected clusters. Cheaper to field than SRS, because interviewers work a manageable number of geographic areas instead of chasing addresses scattered across the whole country, but it risks missing the fine-grained representativeness that stratification buys you. Multistage sampling — a refinement of cluster sampling: instead of interviewing everyone inside each selected cluster, take a further random subsample within it. Repeat that logic across several nested levels (region → county → neighborhood → household, for instance), and you get a sample that's still built entirely on known probabilities of selection, but at a fraction of the cost and logistical headache of true SRS. Systematic sampling — pick a random starting point, then take every kth unit from an ordered list (every third name on an alphabetical roster, every tenth house on a block). Simple to execute, and behaves almost like SRS as long as the list itself has no hidden pattern that lines up with the interval you're using. So which of these does the GSS actually use? All of the first four, stacked together. NORC's own sampling design documentation describes the GSS as a stratified, multistage area-probability cluster sample.NORC at the University of Chicago. GSS Codebook Appendix A: Sampling Design and Weighting. https://gss.norc.org/content/dam/gss/get-documentation/pdf/codebook/GSS_Codebook_AppendixA.pdf In plain English: NORC first divides the country into geographic strata and selects large areas within them (metro areas or groups of counties), then samples smaller areas within those — census tracts in cities, block groups in rural areas — then finally samples individual households within the selected areas, so an interviewer only needs to knock on doors within a manageable number of neighborhoods rather than driving to isolated addresses coast to coast. Every household still has a known, calculable probability of ending up in the sample; that probability is just built up in stages rather than in one single random draw. NORC rebuilds this entire sampling frame from scratch after every U.S. Census, most recently based on the 2020 count. none|thumb|1000x1000px When Probability Sampling Isn't Used Not every sample you'll encounter — in this book, in the news, or in your own future research — is built this carefully, and it's worth knowing the common alternatives if only to spot them when a claim leans on one: Convenience sampling — surveying whoever is easiest to reach: people you already know, students walking through a particular building on a particular morning, whoever's willing to click on a link you posted. Quota sampling — deciding in advance how many respondents you want in each demographic category (say, matching known population percentages by age and sex), then filling those quotas with whoever's available, rather than randomly. Snowball sampling — recruiting a few initial participants and asking them to refer others, useful (sometimes the only option) for reaching populations with no available list to sample from in the first place, such as people experiencing homelessness or members of a stigmatized group. None of these are automatically worthless — snowball sampling may be the only realistic way to study a genuinely hard-to-reach population, and a well-built quota sample can look reasonably representative on the traits it deliberately controlled for. What they all share, though, is that some people's odds of inclusion are unknown or effectively zero, which breaks the assumption that makes probability sampling trustworthy. That's precisely the assumption that lets you calculate a margin of error in Chapter 11 — without it, you're left trusting that a sample resembles the population, with no formal way to say how confident you should be, or how wrong you might be. Because the GSS uses probability sampling with a sample of roughly 1,500–3,000 respondents per wave (depending on the year), it can support a claim that a convenience or quota sample cannot: that the pattern observed in the sample plausibly generalizes to the U.S. adult population as a whole, within a margin of error that can actually be calculated. You'll learn precisely how that margin of error gets calculated starting in Chapter 11. For now, the important idea is this: a sample doesn't need to be enormous to be trustworthy, but it does need to be selected in a way that gives everyone a fair, known chance of ending up in it — however many stages that selection takes to pull off. Quick check, before moving on: for each pair below, which is the population of interest and which is the actual sample — and does the sampling method described sound like it would hold up as a fair, generalizable picture of the population? Population of interest: all nurses in Tampa. Who got surveyed: every nurse working at a single hospital, Tampa General. Population of interest: young adults aged 18–24 in Brussels. Who got surveyed: 400 students at a local university. Population of interest: all students at a university. Who got surveyed: the first 300 students to walk through one particular building on one Tuesday morning. Population of interest: all athletes at a high school. Who got surveyed: every third athlete on an alphabetical roster. There's no code to run for this one — just sit with each pair for a second and ask whether the "who got surveyed" column could plausibly stand in for the "population of interest" column, and why. (The last one, notably, is systematic sampling done reasonably well; the others lean convenience, and it's worth naming specifically what each one is missing.) A Note on Which GSS Data This Book Uses This book uses the 2010 wave of the GSS throughout, and it's worth being upfront about why. The 2010 data are fully collected, cleaned, publicly released, and — crucially for a textbook — will never change. A book built around the most recent available wave would be describing outdated data within a year or two of publication, as new waves are released and old ones are revised. The 2010 wave gives every reader of this book, regardless of when they pick it up, the exact same dataset to work with and the exact same numbers to check their work against. This is a deliberate teaching choice, not a claim that 2010 represents some contemporary snapshot of American life. If your instructor wants to discuss how things have shifted since then, that's exactly what lecture is for — this book teaches you the methods; your professor can point you at whatever vintage of data answers today's question. Getting the Data: The GSS Data Explorer The GSS is publicly available, free of charge, through the GSS Data Explorer . You can browse every variable ever asked, build a custom extract containing just the variables and years you want, and download it in several formats, including plain CSV and SPSS's native .sav format. Your instructor will most likely provide you with an already-prepared extract rather than asking you to build one from scratch — for this course, that extract will be a .sav file, typically named something like gss2010.sav. It's still worth knowing how to find a variable in the Data Explorer directly, because the codebook entries there contain information (exact question wording, response categories, missing value codes) that's useful to see in its original context even when your data file already carries most of it internally, which — as you're about to see — a .sav file does. alt=Screenshot of the GSS Data Explorer website.|center|thumb|800x800px|The GSS Data Explorer is a useful way to examine variables included in all of the waves of the General Social Survey. The Structure of GSS Data: Cases and Variables Like any dataset you'll meet in this book, the GSS is organized into cases (rows) and variables (columns). Each case is one respondent — one real adult who sat down with an interviewer and answered questions. Each variable is one question, or one piece of information derived from a question. A respondent's row might show AGE = 34, SEX = 2, HAPPY = 2, and so on — a compact numeric summary of a conversation that, in reality, took the better part of an hour. That numeric encoding is worth sitting with for a second: SEX = 2 does not mean "twice as much sex" any more than a jersey number means a player is twice as good. It's a code standing in for a category. This distinction — what a number is actually allowed to mean — is the entire subject of Chapter 4, and it matters more than it sounds like it should. For now, understand that, unless the number actually stands for that value (e.g., AGE = 34), the number is a "code" for something else. This will make more sense once in a couple of chapters. Key Variables You'll Use All Semester You'll encounter dozens of GSS variables across this book, but a handful will recur constantly. Bookmark this table; you'll be back. Category Variable What It Measures Demographics AGE Respondent's age in years SEX Respondent's sex RACE Respondent's race EDUC Years of formal education completed MARITAL Marital status REGION Region of the country where the respondent lives Socioeconomic INCOME Total family income (banded categories) RINCOME Respondent's personal income (banded categories) CONRINC Respondent's income in constant dollars (continuous) PRESTG10 Occupational prestige score CLASS Respondent's subjective social class identification Attitudes HAPPY General happiness SATJOB Job satisfaction TRUST Whether most people can be trusted POLVIEWS Political ideology, liberal to conservative PARTYID Political party identification Religion RELIG Religious affiliation ATTEND Frequency of religious attendance GOD Belief in God Cognitive WORDSUM Vocabulary test score (0–10 words identified correctly) A word about the two income variables above, since they show up differently throughout this book: INCOME and RINCOME are banded — respondents pick a bracket ("$25,000 to $29,999") rather than reporting an exact figure — which makes them ordinal-ish and genuinely awkward to treat as continuous dollars without real distortion. CONRINC is NORC's own derived variable: respondent income converted to a single continuous, constant-dollar figure. It's the more honest choice whenever this book wants to illustrate a genuinely continuous, ratio-level income measure, and it's what you'll see used for that purpose starting in Chapter 5. WORDSUM — a simple count of correct answers on a 10-item vocabulary test — is another clean ratio-level variable worth knowing early: unlike income, where "zero" is genuinely ambiguous (no income this year? unemployed? missing?), a WORDSUM score of zero means exactly one thing, which makes it a nice, uncomplicated example anywhere this book needs one. The Missing Data Problem (A Preview) Open any GSS variable and you will eventually run into values like 0, 8, 9, 98, or 99 sitting among otherwise sensible numbers. These are not real responses — they're codes meaning things like "not applicable," "don't know," or "refused to answer," and if you don't catch them, R will cheerfully average them in with everyone else's real answers as though refusing to answer a question were itself a meaningful data point on some numeric scale. Here's a piece of good news that depends entirely on how you load the data, which is exactly why this chapter is about to spend real time on that question: a .sav file doesn't just store the numbers respondents gave — it stores the codebook information about which of those numbers are supposed to count as missing. Load it with the right tool, and a meaningful share of this problem is handled for you before you've typed a single line of cleanup code. Load the same data as a bare CSV, and you're on your own until Chapters 5 and 6, which teach you to do it by hand. Either way, the underlying rule doesn't change: always check the codebook before you trust a number. Automatic handling reduces the manual work; it doesn't excuse you from knowing what's in your data. Loading GSS Data Into R You'll typically work with a file called gss2010.sav, saved in your project folder. Here are three ways to bring GSS data into R — you'll mostly use the third, but all three are worth recognizing. Base R, from a CSV export: gss <- read.csv("gss2010.csv") dplyr / tidyverse, from a CSV export:Wickham, H., Hester, J., & Bryan, J. readr: Read Rectangular Text Data. R package. https://readr.tidyverse.org library(readr) gss <- read_csv("gss2010.csv") haven, from the .sav file (this course's default): library(haven) gss <- read_sav("gss2010.sav") All three approaches produce a data frame called gss, one row per respondent, one column per variable — but they are not equivalent in what else they bring along. read.csv() and read_csv() give you raw numbers and nothing more; whatever a 2 or an 8 "means" lives only in a codebook you have to consult separately. read_sav() reads the value labels and missing-value definitions that are embedded in the SPSS file itself, which buys you two things immediately: by default, values the file's own metadata marks as missing (GSS's "don't know," "refused," and "not applicable" codes) are converted straight to R's NA on import, and the category labels for variables like RELIG or HAPPY are attached to the data and can be revealed with a single function, as_factor(), rather than the manual factor(levels = ..., labels = ...) approach you'll learn in Chapter 4: gss_labeled <- as_factor(gss) This is a real convenience, not a shortcut around understanding — you'll still learn the manual approach in Chapter 4, both because it's the foundation everything else builds on and because not every dataset you ever touch will arrive as a tidy .sav file with its metadata intact. But for this book's GSS-based examples, haven is doing meaningful, unglamorous work in the background from the moment you load the file. First Look at the Data Once loaded, don't immediately start analyzing. Look first. head(gss) # first six rows str(gss) # structure: variable names and types summary(gss) # quick numeric summary of every column names(gss) # just the variable names Running these four lines on any new dataset, before doing anything else with it, is a habit worth making automatic. It's the data equivalent of checking your mirrors before pulling out of a parking space — unglamorous, easy to skip, and the exact thing you'll wish you'd done the one time something goes wrong. One thing you'll notice with a haven-imported file: str() will describe columns as dbl+lbl rather than plain int or num. That's haven's labelled class — a number that's quietly carrying its value labels along with it, visible any time you ask for them with as_factor(), and invisible (in a good way) any time you just want to compute with the underlying numeric codes. alt=a bar chart of self-reported social class|center|thumb|800x800px|This figure, created in R, shows self-reported social class in the 2010 General Social Survey. Chapter Summary The GSS is a survey that has been asking a representative, probability-based sample of American adults about their demographics, attitudes, beliefs, and behaviors almost every year since 1972, run by NORC at the University of Chicago. This book uses the 2010 wave specifically, because it's stable and won't change out from under a printed textbook. GSS data is organized into cases (respondents) and variables (questions), and a handful of variables — spanning demographics, socioeconomics, attitudes, and religion — will recur throughout this book. Watch for missing data codes (0, 8, 9, 98, 99) hiding among real values; a .sav file loaded through haven's read_sav() converts many of these to NA automatically using the file's own embedded metadata, while a plain CSV import leaves that work for Chapters 5 and 6. For now, the essential skill is loading a GSS file into R — with read.csv() or read_csv() for a CSV export, or read_sav() from the haven package for the .sav file this course uses — and taking a careful first look with head(), str(), summary(), and names() before doing anything else. Practice Examples Example 1: Load and Explore The Research Question: What does the 2010 GSS dataset actually look like once it's loaded into R — how many respondents, how many variables? The Code: library(haven) gss <- read_sav("gss2010.sav") dim(gss) str(gss) The Output: [1] 2044 847 tibble [2,044 × 847] (S3: tbl_df/tbl/data.frame) $ FOUND : 'haven_labelled' num [1:2044] 1 1 1 1 1 1 1 1 1 1 ... ..- attr(*, "label")= chr "Case was retrievable in 2012" ..- attr(*, "format.spss")= chr "F8.0" ..- attr(*, "display_width")= int 10 ..- attr(*, "labels")= Named num [1:3] -1 0 1 .. ..- attr(*, "names")= chr [1:3] "IAP" "Not found" "Found" The Interpretation: dim() reports the number of rows (respondents) and columns (variables) in one line. str() gives you the same information in more detail — notice the dbl+lbl tag on each column instead of plain int. That's haven's labelled class: these are still numbers underneath, but each one is carrying its codebook label along for the ride, which is exactly why they'll be easier to work with in Chapter 4 than a bare CSV import would be. Follow-Up Challenge: Run names(gss) and scroll through the full list of variables. Pick three you don't recognize and look them up in the GSS Data Explorer codebook. Then try as_factor(gss$RELIG) and compare what it shows you to the raw gss$RELIG column — what changed? Example 2: Find a Variable, Meet Its Missing Codes (Two Ways) The Research Question: What values does HAPPY actually take in the data, and are any of them suspicious? Does it matter how the file was loaded? The Code (CSV import, base R): gss_csv <- read.csv("gss2010.csv") table(gss_csv$HAPPY) The Code (CSV import, dplyr): library(dplyr) gss_csv %>% count(HAPPY) The Code (.sav import, haven — this course's default): library(haven) gss <- read_sav("gss2010.sav") table(gss$HAPPY, useNA = "ifany") The Output (CSV version): 1 2 3 538 1184 317 The Output (.sav/haven version): 1 2 3 <NA> 538 1184 317 5 The Interpretation: Same underlying data, two different pictures. In the CSV version, all the respondents are assigned a value 1 through 3 — the real response categories for this question (1 = "very happy," 2 = "pretty happy," 3 = "not too happy"). Depending on which CSV file you have, you may also have some additional values: -99 and -98. Those are not a fourth and fifth flavor of happiness. They are "don't know" and "no answer," dressed up as numbers, and left untreated R would happily fold them into any mean or correlation you calculated. In the haven version, read_sav() already recognized those same codes as user-defined missing values from the file's metadata and converted them straight to NA — that's the 5 respondents (3 + 2) showing up honestly as missing rather than disguised as extra categories. This is the concrete payoff of the workflow this chapter recommends; it's also exactly the trap Chapters 5 and 6 exist to help you avoid by hand, for the cases haven's metadata doesn't catch. Follow-Up Challenge: Look up HAPPY in the GSS Data Explorer codebook and confirm what values -98 and -99 actually represent. Then pick one variable and run both the CSV and haven versions of this comparison yourself — do the missing counts match what you'd expect? Example 3: Cross-Referencing the Data Explorer and R The Research Question: Does what R shows you about a variable match what the official codebook says? The Code: summary(gss$EDUC) The Output: Min. 1st Qu. Median Mean 3rd Qu. Max. NA's 0.00 12.00 13.00 13.46 16.00 20.00 5 The Interpretation: R reports a minimum of 0 and a maximum of 20 years of education, with a mean around 13.5. Cross-referencing this against the GSS Data Explorer's codebook entry for EDUC confirms these are genuine years-of-education values (0 through 20, with 20 meaning "20 or more years") rather than a coded stand-in for something else — good news, since it means this particular variable can be trusted at face value once any legitimate missing codes are handled. Follow-Up Challenge: Pick a variable you have a personal guess about — something like average hours of TV watched (TVHOURS) or number of children (CHILDS) — and compare R's summary() output to your intuition before you looked. Were you close? References