National Agricultural Workers Survey (NAWS)
The primary face-to-face interview of currently-employed crop workers in the United States, with detailed questions on demographics, occupational injury, health surveillance, and seasonal and migrant labor.
One cumulative table containing all interviews since 1989, with one row per sampled respondent.
A complex sample designed to generalize to crop production workers employed by establishments engaged in Crop Production (NAICS 111) and Support Activities for Crop Production (NAICS 1151).
Released biennially since 1989.
Administered by the Employment and Training Administration, in partnership with JBS International.
Please skim before you begin:
Statistical Methods of the National Agricultural Workers Survey
A haiku regarding this microdata:
# were i king, my court:
# arcimboldo's vertumnus
# jester juggling self
Download, Import, Preparation
The public access dataset does not currently include the variables needed to get design-adjusted estimates. Previous data releases contained replicate weights; however, those have been discontinued.
Although the PUF allows external researchers to match weighted shares, the UCLA Statistical Consulting Group cautions ignoring the clustering will likely lead to standard errors that are underestimated, possibly leading to results that seem to be statistically significant, when in fact, they are not.
In order for the Employment and Training Administration (ETA) to consider a request for offsite use of the restricted NAWS data file, send these items to the contact listed here for inquiries about the survey:
A brief description of the research aims and how NAWS data will support the research;
A statement as to why the NAWS public data file is insufficient to meet the research aims;
A description of how and when the resulting findings will be disseminated; and
A brief description of the analysis plan, so that NAWS staff may assess the suitability of the NAWS given the research aims and analysis plan.
Upon receipt of this microdata, begin by loading the SAS file:
library(haven)
<-
naws_tbl read_sas(
file.path(
path.expand( "~" ) ,
"nawscrtdvars2db22.sas7bdat"
)
)
<- data.frame( naws_tbl )
naws_df
names( naws_df ) <- tolower( names( naws_df ) )
Save Locally
Save the object at any point:
# naws_fn <- file.path( path.expand( "~" ) , "NAWS" , "this_file.rds" )
# saveRDS( naws_df , file = naws_fn , compress = FALSE )
Load the same object:
# naws_df <- readRDS( naws_fn )
Survey Design Definition
Construct a complex sample survey design:
library(survey)
options( survey.lonely.psu = "adjust" )
<-
naws_design svydesign(
id = ~ cluster ,
strata = ~ interaction( fpc_region , cycle ) ,
data = naws_df ,
weights = ~ pwtycrd,
nest = TRUE
)
Variable Recoding
Add new columns to the data set:
<-
naws_design update(
naws_design ,
one = 1 ,
country_of_birth =
factor(
findInterval( a07 , c( 3 , 4 , 5 , 100 ) ) ,
levels = 0:4 ,
labels =
c( 'us or pr' , 'mexico' , 'central america' ,
'south america, carribean, asia, or other' , 'missing' )
) ,
gender =
factor(
gender ,levels = 0:1 ,
labels = c( 'male' , 'female' )
) ,
interview_cohort =
factor(
findInterval( fy , seq( 1989 , 2021 , 2 ) ) ,
levels = seq_along( seq( 1989 , 2021 , 2 ) ) ,
labels = paste( seq( 1989 , 2021 , 2 ) , seq( 1990 , 2022 , 2 ) , sep = '-' )
) ,
authorized_to_work =
ifelse( l01 < 9 , as.numeric( l01 < 5 ) , NA ) ,
hours_worked_last_week_at_farm_job = d04
)
Analysis Examples with the survey
library
Unweighted Counts
Count the unweighted number of records in the survey sample, overall and by groups:
sum( weights( naws_design , "sampling" ) != 0 )
svyby( ~ one , ~ interview_cohort , naws_design , unwtd.count )
Weighted Counts
Count the weighted size of the generalizable population, overall and by groups:
svytotal( ~ one , naws_design )
svyby( ~ one , ~ interview_cohort , naws_design , svytotal )
Descriptive Statistics
Calculate the mean (average) of a linear variable, overall and by groups:
svymean( ~ waget1 , naws_design , na.rm = TRUE )
svyby( ~ waget1 , ~ interview_cohort , naws_design , svymean , na.rm = TRUE )
Calculate the distribution of a categorical variable, overall and by groups:
svymean( ~ country_of_birth , naws_design , na.rm = TRUE )
svyby( ~ country_of_birth , ~ interview_cohort , naws_design , svymean , na.rm = TRUE )
Calculate the sum of a linear variable, overall and by groups:
svytotal( ~ waget1 , naws_design , na.rm = TRUE )
svyby( ~ waget1 , ~ interview_cohort , naws_design , svytotal , na.rm = TRUE )
Calculate the weighted sum of a categorical variable, overall and by groups:
svytotal( ~ country_of_birth , naws_design , na.rm = TRUE )
svyby( ~ country_of_birth , ~ interview_cohort , naws_design , svytotal , na.rm = TRUE )
Calculate the median (50th percentile) of a linear variable, overall and by groups:
svyquantile( ~ waget1 , naws_design , 0.5 , na.rm = TRUE )
svyby(
~ waget1 ,
~ interview_cohort ,
naws_design ,
svyquantile , 0.5 ,
ci = TRUE , na.rm = TRUE
)
Estimate a ratio:
svyratio(
numerator = ~ hours_worked_last_week_at_farm_job ,
denominator = ~ numfempl ,
naws_design ,na.rm = TRUE
)
Subsetting
Restrict the survey design to California, the only standalone state with adequate sample:
<- subset( naws_design , region12 == 'CA' ) sub_naws_design
Calculate the mean (average) of this subset:
svymean( ~ waget1 , sub_naws_design , na.rm = TRUE )
Measures of Uncertainty
Extract the coefficient, standard error, confidence interval, and coefficient of variation from any descriptive statistics function result, overall and by groups:
<- svymean( ~ waget1 , naws_design , na.rm = TRUE )
this_result
coef( this_result )
SE( this_result )
confint( this_result )
cv( this_result )
<-
grouped_result svyby(
~ waget1 ,
~ interview_cohort ,
naws_design ,
svymean ,na.rm = TRUE
)
coef( grouped_result )
SE( grouped_result )
confint( grouped_result )
cv( grouped_result )
Calculate the degrees of freedom of any survey design object:
degf( naws_design )
Calculate the complex sample survey-adjusted variance of any statistic:
svyvar( ~ waget1 , naws_design , na.rm = TRUE )
Include the complex sample design effect in the result for a specific statistic:
# SRS without replacement
svymean( ~ waget1 , naws_design , na.rm = TRUE , deff = TRUE )
# SRS with replacement
svymean( ~ waget1 , naws_design , na.rm = TRUE , deff = "replace" )
Compute confidence intervals for proportions using methods that may be more accurate near 0 and 1. See ?svyciprop
for alternatives:
svyciprop( ~ authorized_to_work , naws_design ,
method = "likelihood" , na.rm = TRUE )
Regression Models and Tests of Association
Perform a design-based t-test:
svyttest( waget1 ~ authorized_to_work , naws_design )
Perform a chi-squared test of association for survey data:
svychisq(
~ authorized_to_work + country_of_birth ,
naws_design )
Perform a survey-weighted generalized linear model:
<-
glm_result svyglm(
~ authorized_to_work + country_of_birth ,
waget1
naws_design
)
summary( glm_result )
Replication Example
This example matches the unweighted counts and weighted percents of the gender rows shown on PDF page 90 of the most current research report; however, the restricted-use dataset does not include information to implement a finite population correction (FPC). Since a FPC always reduces the standard error, omitting it only makes results more conservative. JBS International shared standard errors and coefficients of variation omitting the FPC, this exercise precisely matches those numbers as well:
# less conservative
options( survey.lonely.psu = "remove" )
<- c( 1823 , 775 )
published_unweighted_counts
<- c( 0.68 , 0.32 )
published_percentages
<- c( 0.024 , 0.024 )
unpublished_se
<- c( 0.04 , 0.08 )
unpublished_cv
<- subset( naws_design , interview_cohort == '2021-2022' )
current_cohort
<- svyby( ~ one , ~ gender , current_cohort , unwtd.count ) )
( unwtd_n
stopifnot( all( coef( unwtd_n ) == published_unweighted_counts ) )
<- svymean( ~ gender , current_cohort ) )
( results
stopifnot( all( round( coef( results ) , 2 ) == published_percentages ) )
stopifnot( all( round( SE( results ) , 3 ) == unpublished_se ) )
stopifnot( all( round( cv( results ) , 2 ) == unpublished_cv ) )
# more conservative
options( survey.lonely.psu = "adjust" )
Analysis Examples with srvyr
The R srvyr
library calculates summary statistics from survey data, such as the mean, total or quantile using dplyr-like syntax. srvyr allows for the use of many verbs, such as summarize
, group_by
, and mutate
, the convenience of pipe-able functions, the tidyverse
style of non-standard evaluation and more consistent return types than the survey
package. This vignette details the available features. As a starting point for NAWS users, this code replicates previously-presented examples:
library(srvyr)
<- as_survey( naws_design ) naws_srvyr_design
Calculate the mean (average) of a linear variable, overall and by groups:
%>%
naws_srvyr_design summarize( mean = survey_mean( waget1 , na.rm = TRUE ) )
%>%
naws_srvyr_design group_by( interview_cohort ) %>%
summarize( mean = survey_mean( waget1 , na.rm = TRUE ) )