weighted_cgm | R Documentation |
weighted_cgm() computes the grand mean centering, while including normalized survey weights
weighted_cgm(data, variable, weight, name)
data |
a data frame with variables ws (normalized survey weight), and id_k (higher cluster, e.g., country) |
variable |
variable to be center |
weight |
normalized survey weight |
name |
acronym for the generated variables |
a data frame, including the center variables
library(dplyr)
data_model %>%
weighted_cgm(data = ., variable = sex , weight = ws, name = sex) %>%
dplyr::glimpse()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.