Skip to contents

Analysis results data for survey Chi-Square test using survey::svychisq(). Only two-way comparisons are supported.

Usage

ard_survey_svychisq(data, by, variables, statistic = "F", ...)

Arguments

data

(survey.design)
a survey design object often created with the {survey} package

by

(tidy-select)
column name to compare by.

variables

(tidy-select)
column names to be compared. Independent tests will be computed for each variable.

statistic

(character)
statistic used to estimate Chisq p-value. Default is the Rao-Scott second-order correction ("F"). See survey::svychisq for available statistics options.

...

arguments passed to survey::svychisq().

Value

ARD data frame

Examples

data(api, package = "survey")
dclus1 <- survey::svydesign(id = ~dnum, weights = ~pw, data = apiclus1, fpc = ~fpc)

ard_survey_svychisq(dclus1, variables = sch.wide, by = comp.imp, statistic = "F")
#> # An ARD data frame: 5 × 9
#>   group1   variable context      stat_name stat                                 
#>   <chr>    <chr>    <chr>        <chr>     <named list>                         
#> 1 comp.imp sch.wide survey_svyc… ndf       1                                    
#> 2 comp.imp sch.wide survey_svyc… ddf       14                                   
#> 3 comp.imp sch.wide survey_svyc… statistic 236.8947                             
#> 4 comp.imp sch.wide survey_svyc… p.value   3.617927e-10                         
#> 5 comp.imp sch.wide survey_svyc… method    Pearson's X^2: Rao & Scott adjustment
#> # ℹ 4 more variables: stat_label <chr>, fmt_fun <named list>,
#> #   warning <named list>, error <named list>