Skip to contents

A version of survey::svyciprop( method = "beta" ) that adjusts for the degrees of freedom.

Usage

svyciprop_adjusted(formula, design, level = 0.95, adj = "none", ...)

Arguments

formula

see survey::svyciprop().

design

see survey::svyciprop().

level

see survey::svyciprop().

adj

adjustment to the Korn and Graubard confidence intervals: "none" (default), "NCHS", or "NHIS".

...

see survey::svyciprop().

Value

The point estimate of the proportion, with the confidence interval as an attribute.

Details

adj specifies the adjustment to the Korn and Graubard confidence intervals.

  • "none": No adjustment is performed. Produces standard Korn and Graubard confidence intervals, same as survey::svyciprop( method = "beta" ).

  • "NCHS": Adjustment that might be required by some (though not all) NCHS data systems. With this adjustment, the degrees of freedom is set to degf(design). Consult the documentation for the data system that you are analyzing to determine if this is the appropriate adjustment.

  • "NHIS": Adjustment that might be required by NHIS. With this adjustment, the degrees of freedom is set to nrow(design) - 1. Consult the documentation for the data system that you are analyzing to determine if this is the appropriate adjustment.

To use these adjustments in surveytable tabulations, call set_survey() or set_opts() with the appropriate mode or adj argument.

Originally written by Makram Talih in 2019.

Examples

set_survey(namcs2019sv)
#>                         Survey info {NAMCS 2019 PUF}                         
#> ┌───────────┬──────────────┬────────────────────────────────────────────────┐
#> │ Variables │ Observations │ Design                                         │
#> ├───────────┼──────────────┼────────────────────────────────────────────────┤
#> │        33 │        8,250 │ Stratified 1 - level Cluster Sampling design   │
#> │           │              │ (with replacement)                             │
#> │           │              │ With (398) clusters.                           │
#> │           │              │ namcs2019sv = survey::svydesign(ids = ~CPSUM,  │
#> │           │              │ strata = ~CSTRATM, weights = ~PATWT            │
#> │           │              │ , data = namcs2019sv_df)                       │
#> └───────────┴──────────────┴────────────────────────────────────────────────┘
#> 
set_opts(adj = "NCHS")
#> * Korn and Graubard confidence intervals for proportions with an adjustment that might be required by some (though not all) NCHS data systems.
tab("AGER")
#>                                     Patient age recode {NAMCS 2019 PUF}                                     
#> ┌─────────────┬───────┬─────────────┬────────────┬─────────────┬─────────────┬─────────┬─────┬──────┬──────┐
#> │ Level       │     n │      Number │         SE │          LL │          UL │ Percent │  SE │   LL │   UL │
#> ├─────────────┼───────┼─────────────┼────────────┼─────────────┼─────────────┼─────────┼─────┼──────┼──────┤
#> │ Under 15    │   887 │ 117,916,772 │ 14,097,315 │  93,228,928 │ 149,142,177 │    11.4 │ 1.3 │  8.9 │ 14.2 │
#> │ years       │       │             │            │             │             │         │     │      │      │
#> ├─────────────┼───────┼─────────────┼────────────┼─────────────┼─────────────┼─────────┼─────┼──────┼──────┤
#> │ 15-24 years │   542 │  64,855,698 │  7,018,359 │  52,386,950 │  80,292,164 │     6.3 │ 0.6 │  5.1 │  7.5 │
#> ├─────────────┼───────┼─────────────┼────────────┼─────────────┼─────────────┼─────────┼─────┼──────┼──────┤
#> │ 25-44 years │ 1,435 │ 170,270,604 │ 13,965,978 │ 144,924,545 │ 200,049,472 │    16.4 │ 1.1 │ 14.3 │ 18.8 │
#> ├─────────────┼───────┼─────────────┼────────────┼─────────────┼─────────────┼─────────┼─────┼──────┼──────┤
#> │ 45-64 years │ 2,283 │ 309,505,956 │ 23,289,827 │ 266,994,092 │ 358,786,727 │    29.9 │ 1.4 │ 27.2 │ 32.6 │
#> ├─────────────┼───────┼─────────────┼────────────┼─────────────┼─────────────┼─────────┼─────┼──────┼──────┤
#> │ 65-74 years │ 1,661 │ 206,865,982 │ 14,365,993 │ 180,480,708 │ 237,108,637 │    20   │ 1.2 │ 17.6 │ 22.5 │
#> ├─────────────┼───────┼─────────────┼────────────┼─────────────┼─────────────┼─────────┼─────┼──────┼──────┤
#> │ 75 years    │ 1,442 │ 167,069,344 │ 15,179,082 │ 139,746,193 │ 199,734,713 │    16.1 │ 1.3 │ 13.7 │ 18.8 │
#> │ and over    │       │             │            │             │             │         │     │      │      │
#> └─────────────┴───────┴─────────────┴────────────┴─────────────┴─────────────┴─────────┴─────┴──────┴──────┘
#>   N = 8250.                                                                                                 
#> 
set_opts(adj = "none")
#> * Korn and Graubard confidence intervals for proportions.