# California Health Interview Survey (CHIS)

*Contributed by Carl Ganz <carlganz@gmail.com>*

The State of California’s edition of the National Health Interview Survey (NHIS), a regional healthcare survey for the nation’s largest state.

One adult, one teenage, and one child table, each with one row per sampled respondent.

A complex sample survey designed to generalize to the civilian non-institutionalized population of California.

Released annually since 2011, and biennially since 2001.

Administered by the UCLA Center for Health Policy Research.

## Simplified Download and Importation

The R `lodown`

package easily downloads and imports all available CHIS microdata by simply specifying `"chis"`

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( "chis" , output_dir = file.path( path.expand( "~" ) , "CHIS" ) ,
your_username = "username" ,
your_password = "password" )
```

`lodown`

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

function. After requesting the CHIS 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 CHIS microdata files
chis_cat <-
get_catalog( "chis" ,
output_dir = file.path( path.expand( "~" ) , "CHIS" ) ,
your_username = "username" ,
your_password = "password" )
# 2014 only
chis_cat <- subset( chis_cat , year == 2014 )
# download the microdata to your local computer
lodown( "chis" , chis_cat ,
your_username = "username" ,
your_password = "password" )
```

## Analysis Examples with the `survey`

library

Construct a complex sample survey design:

```
options( survey.replicates.mse = TRUE )
library(survey)
child <- readRDS( file.path( path.expand( "~" ) , "CHIS" , "2014 child.rds" ) )
child$ak7_p1 <- child$ak10_p <- NA
child$agecat <- "1 - child"
child$no_usual_source_of_care <- as.numeric( child$cd1 == 2 )
# four-category srhs (excellent / very good / good / fair+poor)
child$hlthcat <- child$ca6_p1
# load adolescents ages 12-17
teen <- readRDS( file.path( path.expand( "~" ) , "CHIS" , "2014 teen.rds" ) )
teen$ak7_p1 <- teen$ak10_p <- NA
teen$agecat <- "2 - adolescent"
teen$no_usual_source_of_care <- as.numeric( teen$tf1 == 2 )
# four-category srhs (excellent / very good / good / fair+poor)
teen$hlthcat <- teen$tb1_p1
# load adults ages 18+
adult <- readRDS( file.path( path.expand( "~" ) , "CHIS" , "2014 adult.rds" ) )
adult$agecat <- ifelse( adult$srage_p1 >= 65 , "4 - senior" , "3 - adult" )
adult$no_usual_source_of_care <- as.numeric( adult$ah1 == 2 )
# four-category srhs (excellent / very good / good / fair+poor)
adult$hlthcat <- c( 1 , 2 , 3 , 4 , 4 )[ adult$ab1 ]
# construct a character vector with only the variables needed for the analysis
vars_to_keep <-
c( grep( "rakedw" , names( adult ) , value = TRUE ) ,
'hlthcat' , 'agecat' , 'ak7_p1' , 'ak10_p' ,
'povgwd_p' , 'no_usual_source_of_care' )
chis_df <-
rbind(
child[ vars_to_keep ] ,
teen[ vars_to_keep ] ,
adult[ vars_to_keep ]
)
# remove labelled classes
labelled_cols <-
sapply(
chis_df ,
function( w ) class( w ) == 'labelled'
)
chis_df[ labelled_cols ] <-
sapply(
chis_df[ labelled_cols ] ,
as.numeric
)
chis_design <-
svrepdesign(
data = chis_df ,
weights = ~ rakedw0 ,
repweights = "rakedw[1-9]" ,
type = "other" ,
scale = 1 ,
rscales = 1 ,
mse = TRUE
)
```

### Variable Recoding

Add new columns to the data set:

```
chis_design <-
update(
chis_design ,
one = 1 ,
hlthcat =
factor( hlthcat ,
labels = c( 'excellent' , 'very good' , 'good' , 'fair or poor' )
)
)
```

### Unweighted Counts

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

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

### Weighted Counts

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

```
svytotal( ~ one , chis_design )
svyby( ~ one , ~ hlthcat , chis_design , svytotal )
```

### Descriptive Statistics

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

```
svymean( ~ povgwd_p , chis_design )
svyby( ~ povgwd_p , ~ hlthcat , chis_design , svymean )
```

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

```
svymean( ~ agecat , chis_design )
svyby( ~ agecat , ~ hlthcat , chis_design , svymean )
```

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

```
svytotal( ~ povgwd_p , chis_design )
svyby( ~ povgwd_p , ~ hlthcat , chis_design , svytotal )
```

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

```
svytotal( ~ agecat , chis_design )
svyby( ~ agecat , ~ hlthcat , chis_design , svytotal )
```

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

```
svyquantile( ~ povgwd_p , chis_design , 0.5 )
svyby(
~ povgwd_p ,
~ hlthcat ,
chis_design ,
svyquantile ,
0.5 ,
ci = TRUE ,
keep.var = TRUE
)
```

Estimate a ratio:

```
svyratio(
numerator = ~ ak10_p ,
denominator = ~ ak7_p1 ,
chis_design ,
na.rm = TRUE
)
```

### Subsetting

Restrict the survey design to seniors:

`sub_chis_design <- subset( chis_design , agecat == "4 - senior" )`

Calculate the mean (average) of this subset:

`svymean( ~ povgwd_p , sub_chis_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( ~ povgwd_p , chis_design )
coef( this_result )
SE( this_result )
confint( this_result )
cv( this_result )
grouped_result <-
svyby(
~ povgwd_p ,
~ hlthcat ,
chis_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( chis_design )`

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

`svyvar( ~ povgwd_p , chis_design )`

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

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

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

for alternatives:

```
svyciprop( ~ no_usual_source_of_care , chis_design ,
method = "likelihood" )
```

### Regression Models and Tests of Association

Perform a design-based t-test:

`svyttest( povgwd_p ~ no_usual_source_of_care , chis_design )`

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

```
svychisq(
~ no_usual_source_of_care + agecat ,
chis_design
)
```

Perform a survey-weighted generalized linear model:

```
glm_result <-
svyglm(
povgwd_p ~ no_usual_source_of_care + agecat ,
chis_design
)
summary( glm_result )
```

## 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 CHIS users, this code replicates previously-presented examples:

```
library(srvyr)
chis_srvyr_design <- as_survey( chis_design )
```

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

```
chis_srvyr_design %>%
summarize( mean = survey_mean( povgwd_p ) )
chis_srvyr_design %>%
group_by( hlthcat ) %>%
summarize( mean = survey_mean( povgwd_p ) )
```

## Replication Example

The example below matches statistics and confidence intervals from this table pulled from the AskCHIS online table creator:

Match the bottom right weighted count:

`stopifnot( round( coef( svytotal( ~ one , chis_design ) ) , -3 ) == 37582000 )`

Compute the statistics and standard errors for excellent, very good, and good in the rightmost row:

```
( total_population_ex_vg_good <- svymean( ~ hlthcat , chis_design ) )
# confirm these match
stopifnot(
identical(
as.numeric( round( coef( total_population_ex_vg_good ) * 100 , 1 )[ 1:3 ] ) ,
c( 23.2 , 31.4 , 28.4 )
)
)
```

Compute the confidence intervals in the rightmost row:

```
( total_pop_ci <- confint( total_population_ex_vg_good , df = degf( chis_design ) ) )
# confirm these match
stopifnot(
identical(
as.numeric(
round( total_pop_ci * 100 , 1 )[ 1:3 , ]
) ,
c( 22.1 , 30.1 , 27.1 , 24.2 , 32.7 , 29.6 )
)
)
```