0

I am working with some SPSS data currently and making some contingency tables using the survey package.

I want to be able to make weighted survey cross tables using the standard Pearson Chi Sq tests, and not the Rao Scott second order adjusted ones. In part this is for comparison purposes, but also to be able to replicate previous SPSS tables that do not use the correct adjusted test.

    data <- read_sav("data.sav")
    tab <- data %>%
      haven::as_factor() %>%
      survey::svydesign(id=~1, weights=~w, data = .) %>%
      tbl_svysummary(by=var1, include = c(var2,var3,var4)) %>%
      add_p()
    tab

the above will give me the Rao Scott, is there a way to "force" unadjusted Chi Square and keep using the weighted data?

I tried this and it didn't work:

    data <- read_sav("data.sav")
    tab <- data %>%
      haven::as_factor() %>%
      survey::svydesign(id=~1, weights=~w, data = .) %>%
      tbl_svysummary(by=var1, include = c(var2,var3,var4)) %>%
      add_p(test = all_categorical() ~ svychisq, method = "Chisq", adjust = FALSE)
    tab

the error i got was:

`...` must be empty.
✖ Problematic arguments:
• method = "Chisq"
• adjust = FALSE
  • 1
    Welcome to SO. You're much more likely to get an answer if you post a [MRE](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) to make it easy to answer your question. Broadly, though: if you don't want to use the weights, just use `chisq.test()` from base R. – Taren Sanders Jun 07 '23 at 04:50

0 Answers0