rscalesurveyweightinglikert

How can I incorporate sampling weights into an analysis of Likert scale survey questions?


I am analysing survey data, whose questions are in the form of the Likert Scale. I used auxiliary census data to calculate weights for different age groups within my sample. I would now like to use these weights to correct my sample data and then display the distribution for each question differentiated for each age group.

Any help is appreciated!


Solution

  • The conventional way of doing this in R would be to use the survey package and/or the srvyr package which allows you to use dplyr-style syntax while relying on the survey package to correctly handle weighting and complex survey designs.

    Below is a small example of analyzing Likert data using the srvyr package.

    # Create example data ----
      library(survey)
      library(srvyr)
    
      set.seed(1999)
    
        ## Data frame of responses and grouping information
    
        likert_response_options <- c("1 - Strongly Disagree", "2", "3", "4", "5 - Strongly Agree")
    
          data_df <- data.frame(
            group_vbl = factor(sample(LETTERS[1:4], 20, replace = TRUE), LETTERS[1:4]),
            likert_item = factor(x = sample(likert_response_options, 20, replace = TRUE), 
                                 levels = likert_response_options),
            weights = rnorm(20, mean = 1, sd = 0.1)
          )
    
        ## Create a survey design object from the data frame
          my_survey_design <- as_survey_design(data_df, weights = weights)
    
    # Create weighted summaries ----
    
          my_survey_design %>% 
            group_by(group_vbl, likert_item) %>%
            summarize(proportion = survey_mean())
    
    #> # A tibble: 20 x 5
    #>    group_vbl likert_item           proportion proportion_low proportion_upp
    #>    <fct>     <fct>                      <dbl>          <dbl>          <dbl>
    #>  1 A         1 - Strongly Disagree      0.300        -0.252           0.851
    #>  2 A         2                          0             0               0    
    #>  3 A         3                          0.700         0.149           1.25 
    #>  4 A         4                          0             0               0    
    #>  5 A         5 - Strongly Agree         0             0               0    
    #>  6 B         1 - Strongly Disagree      0.127        -0.130           0.384
    #>  7 B         2                          0.146        -0.143           0.435
    #>  8 B         3                          0.259        -0.0872          0.606
    #>  9 B         4                          0.468         0.0577          0.878
    #> 10 B         5 - Strongly Agree         0             0               0    
    #> 11 C         1 - Strongly Disagree      0             0               0    
    #> 12 C         2                          0.241        -0.213           0.696
    #> 13 C         3                          0.292        -0.221           0.804
    #> 14 C         4                          0.250        -0.216           0.716
    #> 15 C         5 - Strongly Agree         0.217        -0.205           0.639
    #> 16 D         1 - Strongly Disagree      0             0               0    
    #> 17 D         2                          0.529         0.0906          0.967
    #> 18 D         3                          0             0               0    
    #> 19 D         4                          0.159        -0.156           0.474
    #> 20 D         5 - Strongly Agree         0.312        -0.0888          0.713