Using R for Social Research and Statistical Modeling with the Prestige Dataset
Social research often involves examining relationships between social characteristics, economic conditions, educational attainment, occupational structures, and other factors that shape society. Statistical analysis helps researchers move beyond individual observations to identify broader patterns, investigate relationships between variables, and develop evidence-based explanations of social phenomena. R is particularly useful in this area because it combines statistical computing, data visualisation, and modelling within a single programming environment.
One of the interesting applications of R for Social Research is the analysis of occupational prestige. Occupations are not defined by income alone. Educational requirements, professional responsibilities, social perceptions, and the composition of the workforce can all contribute to how different occupations are positioned within society. Studying these relationships provides an opportunity to explore broader questions about social stratification, economic inequality, and occupational structures.
For this purpose, we can work with the Prestige dataset, an existing dataset available through R's carData package. It contains information on 102 Canadian occupations, making it a useful resource for demonstrating statistical techniques commonly employed in sociology, economics, and other social science disciplines. The dataset provides information about occupational education, income, gender composition, and prestige scores, allowing researchers to investigate several interconnected social and economic variables.

R for Social Research: Understanding the Prestige Dataset
The Prestige dataset is particularly interesting because it brings together variables that represent different dimensions of occupational standing. Originally compiled using information from the 1971 Canadian Census and a social survey conducted during the mid-1960s, the dataset provides a historical perspective on occupational structures in Canada. Each observation represents an occupation rather than an individual respondent.
It contains 102 observations and six variables, including five numerical or coded measurements and one categorical variable.
These variables make it possible to explore occupational differences, examine associations between educational attainment and income, and investigate how occupational categories relate to social prestige. The six variables available in the dataset are:
Education: Average years of education completed by people working in an occupation, recorded in 1971.
Income: Average income of occupational incumbents, measured in dollars in 1971.
Women: Percentage of people working in an occupation who are women.
Prestige: Pineo-Porter prestige score assigned to occupations through a social survey conducted in the mid-1960s.
Census: Canadian Census occupational classification code.
Type: Occupational classification, divided into Blue Collar (bc), Professional, Managerial and Technical (prof), and White Collar (wc).
These variables provide several opportunities for social science research. For example, educational attainment and income can be examined as potential indicators of occupational standing, while the occupational classification variable can help researchers compare differences between professional, white-collar, and blue-collar occupations. The percentage of women in each occupation also introduces a demographic dimension to the analysis.
Another interesting aspect is the distinction between occupational prestige and economic income. An occupation with a relatively high income does not necessarily have an equivalent prestige score. Exploring this relationship can help researchers investigate how economic rewards and social perceptions relate to occupational status.
Getting started with the dataset is straightforward. Since it is distributed through the carData package, researchers only need to install the package and load it into their R environment. It is not part of base R's default installation, but it is readily accessible through CRAN.
The following commands install the required package, load the dataset, and display its initial observations.
# Install the package (run once)
install.packages("carData")
# Load the package
library(carData)
# Load the Prestige dataset
data("Prestige")
# Display the first six observations
head(Prestige)
Output:
education income women prestige census type
gov.administrators 13.11 12351 11.16 68.8 1113 prof
general.managers 12.26 25879 4.02 69.1 1130 prof
.
.
.The head() function displays the first six rows, providing an initial look at the data structure. Researchers can also examine the number of observations, variable types, summary statistics, and missing values before proceeding with statistical analysis. These preliminary checks help establish how the dataset is organised and identify any data preparation requirements.
A few additional commands are useful for understanding the dataset in greater detail.
# Check the dimensions
dim(Prestige)
# Examine variable types
str(Prestige)
# Generate descriptive statistics
summary(Prestige)
# Check missing values in each variable
colSums(is.na(Prestige))
Output:
education income women prestige
Min. : 6.380 Min. : 611 Min. : 0.000 Min. :14.80
1st Qu.: 8.445 1st Qu.: 4106 1st Qu.: 3.592 1st Qu.:35.23
.
.
.The summary() function provides descriptive statistics for numerical variables, including minimum values, maximum values, medians, and means. For the categorical type variable, it displays the frequency of observations within each occupational category. Similarly, str() provides information about the structure of the dataset, helping researchers distinguish between numerical measurements and categorical variables.
Before conducting any statistical tests, it is important to examine missing observations. Missing data can affect sample sizes and influence the results of statistical models. The colSums(is.na(Prestige)) command identifies the number of missing observations in each column, allowing researchers to decide how to handle them.
The dataset also offers an opportunity to investigate how occupational characteristics relate to social stratification. For instance, researchers can begin with questions such as:
Do occupations requiring more years of education generally receive higher prestige scores?
How strongly is occupational income associated with social prestige?
Are professional occupations positioned differently from blue-collar and white-collar occupations?
Does the percentage of women in an occupation show an association with its prestige score?
Do income and education explain similar or different aspects of occupational standing?
These questions provide a starting point for applying statistical techniques in R. Rather than treating the variables independently, researchers can investigate how multiple characteristics interact to shape occupational patterns.
Exploring Occupational Patterns Through Data Visualisation and Statistical Analysis in R
Data visualisation is an important part of social research because it helps researchers identify patterns that may not be immediately apparent in descriptive statistics. Graphical representations can reveal relationships between variables, differences between population groups, unusual observations, and possible inconsistencies in the data.
Using the Prestige dataset, we can start by investigating the relationship between educational attainment and occupational prestige. A scatter plot is suitable for this purpose because both variables are numerical. Each point represents an occupation, with its average educational attainment plotted against its prestige score.
The following R code produces a scatter plot and adds a simple linear regression line to help illustrate the overall direction of the relationship.
# Select observations with complete values
plot_data <- subset(
Prestige,
complete.cases(education, prestige)
)
# Create a scatter plot
plot(
prestige ~ education,
data = plot_data,
main = "Education and Occupational Prestige",
xlab = "Average Years of Education",
ylab = "Prestige Score",
pch = 19
)
# Add a regression line
abline(
lm(prestige ~ education, data = plot_data),
col = "red",
lwd = 2
)Output graph:

The resulting graph allows researchers to examine the direction and general strength of the relationship between education and occupational prestige. An upward pattern would indicate a positive association, suggesting that occupations requiring more education tend to have higher prestige scores.
However, the visual relationship alone does not establish that education directly causes higher occupational prestige.
This type of visualisation is useful during exploratory data analysis because it provides an initial indication of relationships that can be investigated through statistical modelling. Researchers can also use it to identify occupations that appear far from the general pattern and might require closer examination.
Another interesting comparison involves occupational categories. The type variable groups occupations into three broad categories, allowing researchers to investigate differences in their prestige distributions.
A box plot is particularly useful for this analysis because it displays the median, spread, and potential outliers within each category. The following code compares occupational prestige across the three groups.
# Compare prestige scores by occupational type
boxplot(
prestige ~ type,
data = Prestige,
main = "Occupational Prestige by Type",
xlab = "Type of Occupation",
ylab = "Prestige Score",
col = "lightblue"
)Output graph:

The box plot provides a comparative view of occupational prestige across blue-collar, professional, and white-collar occupations. Researchers can examine differences in median prestige scores, variation within each category, and the presence of occupations with unusually high or low scores.
Beyond graphical exploration, researchers can use descriptive and inferential statistics to investigate relationships between numerical variables. Correlation analysis is one approach that helps measure the direction and strength of association between two numerical measurements.
In this example, we can examine the correlation between average educational attainment and occupational prestige using Pearson's correlation coefficient.
# Select complete observations
cor_data <- subset(
Prestige,
complete.cases(education, prestige)
)
# Calculate Pearson correlation
cor.test(
cor_data$education,
cor_data$prestige,
method = "pearson"
)
Output:
Pearson's product-moment correlation
data: cor_data$education and cor_data$prestige
t = 16.148, df = 100, p-value < 2.2e-16
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
0.7855899 0.8964367
sample estimates:
cor
0.8501769 The output includes the estimated correlation coefficient, test statistic, p-value, and confidence interval. The correlation coefficient ranges from -1 to +1. Positive values indicate that the two variables tend to increase together, while negative values indicate an inverse relationship. A value close to zero suggests a weak linear association.
For social researchers, correlation analysis offers a useful way to examine relationships between social and economic indicators. However, correlation does not establish causation. Other variables, such as income, occupational classification, or historical labour market conditions, may also help explain the observed relationship.
Statistical Modeling with R: Explaining Occupational Prestige
While descriptive statistics and graphical analysis help researchers understand the structure of a dataset, statistical modelling provides a more systematic approach to examining relationships between multiple variables. In social science research, regression analysis is particularly useful for studying how several characteristics are associated with an outcome of interest. The Prestige dataset provides a suitable example of multiple linear regression, with occupational prestige serving as the dependent variable. Researchers can investigate the association between prestige and educational attainment, income, gender composition, and occupational category within a single statistical model.
Multiple linear regression estimates the relationship between a numerical outcome and two or more explanatory variables. It also makes it possible to examine the contribution of individual predictors while accounting for the presence of other variables in the model.
For this analysis, we can formulate the following research question:
How are education, income, the percentage of women in an occupation, and occupational classification associated with occupational prestige?
Before fitting the model, we need to prepare the analysis dataset. Since missing observations can affect model estimation and comparisons between regression models, we can use complete-case analysis for the variables included in the model. This means retaining only observations with complete information across the selected columns.
Income can also be log-transformed to reduce the influence of large differences in its numerical scale and make the relationship easier to model. The logarithmic transformation is commonly used when analysing income-related variables because their distributions can be strongly skewed.
# Prepare the analysis dataset
analysis_data <- na.omit(
Prestige[, c(
"education",
"income",
"women",
"prestige",
"type"
)]
)
# Fit a basic regression model
model_basic <- lm(
prestige ~ education + log(income),
data = analysis_data
)
# Fit a multiple regression model
model_full <- lm(
prestige ~ education + log(income) + women + type,
data = analysis_data
)
# Display the model results
summary(model_full)
Output:
lm(formula = prestige ~ education + log(income) + women + type,
data = analysis_data)
Residuals:
Min 1Q Median 3Q Max
-13.8762 -4.0579 0.5503 4.2129 16.6400
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -115.67219 18.80181 -6.152 1.96e-08 ***
education 2.97384 0.60205 4.940 3.49e-06 ***
log(income) 14.65518 2.31151 6.340 8.42e-09 ***
women 0.08382 0.03223 2.601 0.0108 *
typeprof 5.29186 3.55585 1.488 0.1401
typewc -3.21599 2.40654 -1.336 0.1847
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 6.44 on 92 degrees of freedom
Multiple R-squared: 0.8654, Adjusted R-squared: 0.8581
F-statistic: 118.3 on 5 and 92 DF, p-value: < 2.2e-16The lm() function in R fits linear regression models to examine relationships between a dependent variable and multiple predictors. In this analysis, occupational prestige is the dependent variable, with education, log-transformed income, the percentage of women, and occupational classification included as explanatory variables. The summary() function provides the regression coefficients, p-values, and measures of model performance.
The results show that education, income, and the percentage of women have statistically significant positive associations with occupational prestige. An additional year of average education is associated with an increase of approximately 2.97 prestige points, while a 1% increase in income corresponds to an estimated 0.15-point increase, holding other variables constant. The percentage of women also has a positive association: each one-percentage-point increase corresponds to approximately 0.084 additional prestige points.
In contrast, professional and white-collar occupations do not show statistically significant differences in prestige compared with the blue-collar reference category. The model has an R-squared of 0.8654, indicating that it explains approximately 86.5% of the variation in occupational prestige. Its overall F-test is also statistically significant (p < 2.2 × 10⁻¹⁶), suggesting that the predictors collectively provide a strong explanation of prestige differences in this dataset. These findings highlight the importance of education and income in understanding occupational standing, although the results indicate associations rather than causal relationships.
Researchers can also compare the basic and full regression models to investigate whether adding occupational category and gender composition improves the model's explanatory performance. Since both models use the same analysis dataset, they can be compared through an analysis of variance table.
# Compare the two nested regression models
anova(model_basic, model_full)
# Examine confidence intervals
confint(model_full)
# Extract estimated coefficients
coef(model_full)
# Review adjusted R-squared
summary(model_full)$adj.r.squared
Output:
Res.Df RSS Df Sum of Sq F Pr(>F)
1 95 4565.354 NA NA NA NA
2 92 3815.736 3 749.6175 6.024596 0.00085838
A matrix: 6 × 2 of type dbl
2.5 % 97.5 %
(Intercept) -153.01421501 -78.3301625
education 1.77811631 4.1695696
log(income) 10.06432009 19.2460431
women 0.01981084 0.1478222
typeprof -1.77035600 12.3540756
typewc -7.99559489 1.5636064
(Intercept)-115.672188760456education2.97384294377765log(income)14.6551815839369women0.0838165138780721typeprof5.29185982119593typewc-3.21599425338872
0.858075594987617The anova() function compares the basic and full regression models to determine if the additional predictors improve model performance. The results show an F-statistic of 6.02 and a p-value of 0.000858, indicating that adding occupational gender composition and classification significantly improves the model's explanatory power.
The 95% confidence intervals provide further insight into the estimated coefficients. Education (1.78 to 4.17), log-transformed income (10.06 to 19.25), and the percentage of women (0.02 to 0.15) have intervals that exclude zero, supporting their positive associations with occupational prestige. In contrast, the intervals for professional and white-collar occupational categories include zero, indicating that their individual coefficients are not statistically significant at the 5% level. The adjusted R-squared of 0.8581 suggests that the full model explains approximately 85.8% of the variation in occupational prestige, accounting for the number of predictors.
A further extension involves examining interaction effects. In social research, the relationship between two variables may differ across social or occupational groups. For example, researchers can investigate if the association between education and occupational prestige varies across occupational categories.This can be explored by including an interaction between education and type in the regression formula.
# Fit a regression model with an interaction
model_interaction <- lm(
prestige ~ education * type + log(income) + women,
data = analysis_data
)
# Compare it with the model without interaction
anova(model_full, model_interaction)
# Examine the model summary
summary(model_interaction)
Output:
lm(formula = prestige ~ education * type + log(income) + women,
data = analysis_data)
Residuals:
Min 1Q Median 3Q Max
-13.380 -3.878 0.452 4.043 15.842
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -114.75797 19.92212 -5.760 1.16e-07 ***
education 3.10147 0.87922 3.528 0.000663 ***
typeprof 16.59029 13.88611 1.195 0.235328
typewc -22.84952 18.20370 -1.255 0.212651
log(income) 14.43737 2.31632 6.233 1.45e-08 ***
women 0.07712 0.03297 2.339 0.021540 *
education:typeprof -0.84100 1.19735 -0.702 0.484253
education:typewc 1.76996 1.75599 1.008 0.316177
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 6.429 on 90 degrees of freedom
Multiple R-squared: 0.8688, Adjusted R-squared: 0.8586The interaction model examines if the relationship between education and occupational prestige varies across occupational categories. The education coefficient is 3.10 for blue-collar occupations, the reference category. After accounting for the interaction terms, the estimated education coefficient is approximately 2.26 for professional occupations and 4.87 for white-collar occupations. However, neither interaction is statistically significant (p = 0.484 and p = 0.316, respectively), suggesting no strong statistical evidence that the relationship between education and prestige differs across these categories.
Education, log-transformed income, and the percentage of women remain statistically significant positive predictors. The model has an R-squared of 0.8688 and an adjusted R-squared of 0.8586, explaining approximately 86.9% of the variation in occupational prestige. Although the adjusted R-squared is marginally higher than that of the previous model, the interaction terms do not show significant individual effects.
Interpreting regression results also requires assessing the assumptions underlying linear regression. These include linearity, independence of errors, approximately constant residual variance, and an appropriate distribution of residuals.
R includes built-in diagnostic plots for examining many of these model characteristics. The following commands produce the standard diagnostic plots for the fitted regression model.
# Display regression diagnostic plots
par(mfrow = c(2, 2))
plot(model_full)
# Restore the default plotting layout
par(mfrow = c(1, 1))Output graphs:

These plots help identify potential problems, including unusual observations, influential occupations, non-constant residual variance, and departures from the expected residual distribution. Such checks are particularly important when working with relatively small datasets, where individual observations can have a noticeable influence on model estimates.
The findings from this type of analysis can contribute to several areas of social science research. Sociologists can investigate occupational hierarchies and social stratification, economists can examine relationships between earnings and occupational standing, and researchers interested in gender and labour markets can explore how workforce composition relates to differences in occupational prestige.
At the same time, it is important to recognise the limitations of the Prestige dataset. Its observations represent occupations, not individual workers, so the results cannot be directly interpreted as relationships between personal characteristics and individual outcomes. The data also describe historical conditions in Canada, with income and educational measurements from 1971 and prestige scores based on a survey from the mid-1960s. They should not be treated as a representation of contemporary labour market conditions or used to make direct claims about present-day occupational inequality.
Overall, the Prestige dataset offers a practical starting point for learning how R can support social research through data exploration, visualisation, correlation analysis, and statistical modelling. Its combination of economic, educational, demographic, and occupational variables makes it useful for demonstrating how researchers can approach questions concerning social stratification and occupational structures. More importantly, the techniques illustrated here can be applied to larger datasets from surveys, census records, and other social science sources, making R a valuable tool for conducting quantitative research and developing evidence-based interpretations of social phenomena.





