# Behavioral Risk Factor Surveillance System (BRFSS)

A health behavior telephone interview survey with enough sample size to examine all fifty states.

One table with one row per telephone respondent.

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

Released annually since 1984 but all states did not participate until 1994.

Administered by the Centers for Disease Control and Prevention.

## Simplified Download and Importation

The R `lodown`

package easily downloads and imports all available BRFSS microdata by simply specifying `"brfss"`

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( "brfss" , output_dir = file.path( path.expand( "~" ) , "BRFSS" ) )
```

`lodown`

also provides a catalog of available microdata extracts with the `get_catalog()`

function. After requesting the BRFSS 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 BRFSS microdata files
brfss_cat <-
get_catalog( "brfss" ,
output_dir = file.path( path.expand( "~" ) , "BRFSS" ) )
# 2016 only
brfss_cat <- subset( brfss_cat , year == 2016 )
# download the microdata to your local computer
lodown( "brfss" , brfss_cat )
```

## Analysis Examples with the `survey`

library

Construct a complex sample survey design:

```
options( survey.lonely.psu = "adjust" )
library(survey)
brfss_df <-
readRDS( file.path( path.expand( "~" ) , "BRFSS" , "2016 main.rds" ) )
variables_to_keep <-
c( 'one' , 'xpsu' , 'xststr' , 'xllcpwt' , 'genhlth' , 'medcost' ,
'xstate' , 'xage80' , 'nummen' , 'numadult' , 'hlthpln1' )
brfss_df <- brfss_df[ variables_to_keep ] ; gc()
brfss_design <-
svydesign(
id = ~ xpsu ,
strata = ~ xststr ,
data = brfss_df ,
weight = ~ xllcpwt ,
nest = TRUE
)
```

### Variable Recoding

Add new columns to the data set:

```
brfss_design <-
update(
brfss_design ,
fair_or_poor_health = ifelse( genhlth %in% 1:5 , as.numeric( genhlth > 3 ) , NA ) ,
could_not_see_doctor_due_to_cost =
factor(
medcost ,
levels = c( 1 , 2 , 7 , 9 ) ,
labels = c( "yes" , "no" , "dk" , "rf" )
) ,
state_name =
factor(
xstate ,
levels =
c(1, 2, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 53, 54,
55, 56, 66, 72, 78) ,
labels =
c("ALABAMA", "ALASKA", "ARIZONA", "ARKANSAS", "CALIFORNIA",
"COLORADO", "CONNECTICUT", "DELAWARE", "DISTRICT OF COLUMBIA",
"FLORIDA", "GEORGIA", "HAWAII", "IDAHO", "ILLINOIS", "INDIANA",
"IOWA", "KANSAS", "KENTUCKY", "LOUISIANA", "MAINE", "MARYLAND",
"MASSACHUSETTS", "MICHIGAN", "MINNESOTA", "MISSISSIPPI",
"MISSOURI", "MONTANA", "NEBRASKA", "NEVADA", "NEW HAMPSHIRE",
"NEW JERSEY", "NEW MEXICO", "NEW YORK", "NORTH CAROLINA",
"NORTH DAKOTA", "OHIO", "OKLAHOMA", "OREGON", "PENNSYLVANIA",
"RHODE ISLAND", "SOUTH CAROLINA", "SOUTH DAKOTA", "TENNESSEE",
"TEXAS", "UTAH", "VERMONT", "VIRGINIA", "WASHINGTON",
"WEST VIRGINIA", "WISCONSIN", "WYOMING", "GUAM", "PUERTO RICO",
"U.S. VIRGIN ISLANDS")
)
)
```

### Unweighted Counts

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

```
sum( weights( brfss_design , "sampling" ) != 0 )
svyby( ~ one , ~ state_name , brfss_design , unwtd.count )
```

### Weighted Counts

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

```
svytotal( ~ one , brfss_design )
svyby( ~ one , ~ state_name , brfss_design , svytotal )
```

### Descriptive Statistics

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

```
svymean( ~ xage80 , brfss_design )
svyby( ~ xage80 , ~ state_name , brfss_design , svymean )
```

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

```
svymean( ~ could_not_see_doctor_due_to_cost , brfss_design , na.rm = TRUE )
svyby( ~ could_not_see_doctor_due_to_cost , ~ state_name , brfss_design , svymean , na.rm = TRUE )
```

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

```
svytotal( ~ xage80 , brfss_design )
svyby( ~ xage80 , ~ state_name , brfss_design , svytotal )
```

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

```
svytotal( ~ could_not_see_doctor_due_to_cost , brfss_design , na.rm = TRUE )
svyby( ~ could_not_see_doctor_due_to_cost , ~ state_name , brfss_design , svytotal , na.rm = TRUE )
```

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

```
svyquantile( ~ xage80 , brfss_design , 0.5 )
svyby(
~ xage80 ,
~ state_name ,
brfss_design ,
svyquantile ,
0.5 ,
ci = TRUE ,
keep.var = TRUE
)
```

Estimate a ratio:

```
svyratio(
numerator = ~ nummen ,
denominator = ~ numadult ,
brfss_design ,
na.rm = TRUE
)
```

### Subsetting

Restrict the survey design to persons without health insurance:

`sub_brfss_design <- subset( brfss_design , hlthpln1 == 2 )`

Calculate the mean (average) of this subset:

`svymean( ~ xage80 , sub_brfss_design )`

### 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 <- svymean( ~ xage80 , brfss_design )
coef( this_result )
SE( this_result )
confint( this_result )
cv( this_result )
grouped_result <-
svyby(
~ xage80 ,
~ state_name ,
brfss_design ,
svymean
)
coef( grouped_result )
SE( grouped_result )
confint( grouped_result )
cv( grouped_result )
```

Calculate the degrees of freedom of any survey design object:

`degf( brfss_design )`

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

`svyvar( ~ xage80 , brfss_design )`

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

```
# SRS without replacement
svymean( ~ xage80 , brfss_design , deff = TRUE )
# SRS with replacement
svymean( ~ xage80 , brfss_design , deff = "replace" )
```

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

for alternatives:

```
svyciprop( ~ fair_or_poor_health , brfss_design ,
method = "likelihood" , na.rm = TRUE )
```

### Regression Models and Tests of Association

Perform a design-based t-test:

`svyttest( xage80 ~ fair_or_poor_health , brfss_design )`

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

```
svychisq(
~ fair_or_poor_health + could_not_see_doctor_due_to_cost ,
brfss_design
)
```

Perform a survey-weighted generalized linear model:

```
glm_result <-
svyglm(
xage80 ~ fair_or_poor_health + could_not_see_doctor_due_to_cost ,
brfss_design
)
summary( glm_result )
```