Survey of Consumer Finances (SCF)

Build Status Build status

The Survey of Consumer Finances (SCF) tracks the wealth of American families. Five thousand households answer a battery of questions about income, net worth, credit card debt, pensions, mortgages, even the lease on their cars. Plenty of surveys collect annual income, only the Survey of Consumer Finances captures such detailed asset data.

  • One table of survey responses and a second table with replicate weights, both with one row per sampled household.

  • A complex sample survey designed to generalize to the civilian non-institutional population of the United States.

  • Released triennially since 1983.

  • Administered by the Board of Governors of the Federal Reserve System.

Simplified Download and Importation

The R lodown package easily downloads and imports all available SCF microdata by simply specifying "scf" with an output_dir = parameter in the lodown() function. Depending on your internet connection and computer processing speed, you might prefer to run this step overnight.

library(lodown)
lodown( "scf" , output_dir = file.path( path.expand( "~" ) , "SCF" ) )

lodown also provides a catalog of available microdata extracts with the get_catalog() function. After requesting the SCF catalog, you could pass a subsetted catalog through the lodown() function in order to download and import specific extracts (rather than all available extracts).

library(lodown)
# examine all available SCF microdata files
scf_cat <-
    get_catalog( "scf" ,
        output_dir = file.path( path.expand( "~" ) , "SCF" ) )

# 2016 only
scf_cat <- subset( scf_cat , year == 2016 )
# download the microdata to your local computer
lodown( "scf" , scf_cat )

Analysis Examples with the survey library

Construct a multiply-imputed, complex sample survey design:

library(survey)
library(mitools)

scf_imp <- readRDS( file.path( path.expand( "~" ) , "SCF" , "scf 2016.rds" ) )

scf_rw <- readRDS( file.path( path.expand( "~" ) , "SCF" , "scf 2016 rw.rds" ) )

scf_design <- 
    svrepdesign( 
        weights = ~wgt , 
        repweights = scf_rw[ , -1 ] , 
        data = imputationList( scf_imp ) , 
        scale = 1 ,
        rscales = rep( 1 / 998 , 999 ) ,
        mse = TRUE ,
        type = "other" ,
        combined.weights = TRUE
    )

Variable Recoding

Add new columns to the data set:

scf_design <- 
    update( 
        scf_design , 
        
        hhsex = factor( hhsex , labels = c( "male" , "female" ) ) ,
        
        married = as.numeric( married == 1 ) ,
        
        edcl = 
            factor( 
                edcl , 
                labels = 
                    c( 
                        "less than high school" , 
                        "high school or GED" , 
                        "some college" , 
                        "college degree" 
                    ) 
            )

    )

Unweighted Counts

Count the unweighted number of records in the survey sample, overall and by groups:

lodown:::scf_MIcombine( with( scf_design , svyby( ~ one , ~ one , unwtd.count ) ) )

lodown:::scf_MIcombine( with( scf_design , svyby( ~ one , ~ hhsex , unwtd.count ) ) )

Weighted Counts

Count the weighted size of the generalizable population, overall and by groups:

lodown:::scf_MIcombine( with( scf_design , svytotal( ~ one ) ) )

lodown:::scf_MIcombine( with( scf_design ,
    svyby( ~ one , ~ hhsex , svytotal )
) )

Descriptive Statistics

Calculate the mean (average) of a linear variable, overall and by groups:

lodown:::scf_MIcombine( with( scf_design , svymean( ~ networth ) ) )

lodown:::scf_MIcombine( with( scf_design ,
    svyby( ~ networth , ~ hhsex , svymean )
) )

Calculate the distribution of a categorical variable, overall and by groups:

lodown:::scf_MIcombine( with( scf_design , svymean( ~ edcl ) ) )

lodown:::scf_MIcombine( with( scf_design ,
    svyby( ~ edcl , ~ hhsex , svymean )
) )

Calculate the sum of a linear variable, overall and by groups:

lodown:::scf_MIcombine( with( scf_design , svytotal( ~ networth ) ) )

lodown:::scf_MIcombine( with( scf_design ,
    svyby( ~ networth , ~ hhsex , svytotal )
) )

Calculate the weighted sum of a categorical variable, overall and by groups:

lodown:::scf_MIcombine( with( scf_design , svytotal( ~ edcl ) ) )

lodown:::scf_MIcombine( with( scf_design ,
    svyby( ~ edcl , ~ hhsex , svytotal )
) )

Calculate the median (50th percentile) of a linear variable, overall and by groups:

lodown:::scf_MIcombine( with( scf_design , svyquantile( ~ networth , 0.5 , se = TRUE ) ) )

lodown:::scf_MIcombine( with( scf_design ,
    svyby( 
        ~ networth , ~ hhsex , svyquantile , 0.5 ,
        se = TRUE , keep.var = TRUE , ci = TRUE 
) ) )

Estimate a ratio:

lodown:::scf_MIcombine( with( scf_design ,
    svyratio( numerator = ~ income , denominator = ~ networth )
) )

Subsetting

Restrict the survey design to labor force participants:

sub_scf_design <- subset( scf_design , lf == 1 )

Calculate the mean (average) of this subset:

lodown:::scf_MIcombine( with( sub_scf_design , svymean( ~ networth ) ) )

Measures of Uncertainty

Extract the coefficient, standard error, confidence interval, and coefficient of variation from any descriptive statistics function result, overall and by groups:

this_result <-
    lodown:::scf_MIcombine( with( scf_design ,
        svymean( ~ networth )
    ) )

coef( this_result )
SE( this_result )
confint( this_result )
cv( this_result )

grouped_result <-
    lodown:::scf_MIcombine( with( scf_design ,
        svyby( ~ networth , ~ hhsex , svymean )
    ) )

coef( grouped_result )
SE( grouped_result )
confint( grouped_result )
cv( grouped_result )

Calculate the degrees of freedom of any survey design object:

degf( scf_design$designs[[1]] )

Calculate the complex sample survey-adjusted variance of any statistic:

lodown:::scf_MIcombine( with( scf_design , svyvar( ~ networth ) ) )

Include the complex sample design effect in the result for a specific statistic:

# SRS without replacement
lodown:::scf_MIcombine( with( scf_design ,
    svymean( ~ networth , deff = TRUE )
) )

# SRS with replacement
lodown:::scf_MIcombine( with( scf_design ,
    svymean( ~ networth , deff = "replace" )
) )

Compute confidence intervals for proportions using methods that may be more accurate near 0 and 1. See ?svyciprop for alternatives:

lodown:::MIsvyciprop( ~ married , scf_design ,
    method = "likelihood" )

Regression Models and Tests of Association

Perform a design-based t-test:

lodown:::MIsvyttest( networth ~ married , scf_design )

Perform a chi-squared test of association for survey data:

lodown:::MIsvychisq( ~ married + edcl , scf_design )

Perform a survey-weighted generalized linear model:

glm_result <- 
    lodown:::scf_MIcombine( with( scf_design ,
        svyglm( networth ~ married + edcl )
    ) )
    
summary( glm_result )

Poverty and Inequality Estimation with convey

The R convey library estimates measures of income concentration, poverty, inequality, and wellbeing. This textbook details the available features. As a starting point for SCF users, this code calculates the gini coefficient on complex sample survey data:

library(convey)
scf_design$designs <- lapply( scf_design$designs , convey_prep )

lodown:::scf_MIcombine( with( scf_design , svygini( ~ networth ) ) )

Replication Example