surveytable: Streamlined output from the `survey` package
+surveytable: Formatted Survey Estimates
Source:R/surveytable.R
surveytable-package.Rd
Streamlined output from the `survey` package.
+Formatted Survey Estimates.
Confidence intervals for proportions, adjusted for degrees of freedom
+ Source:R/svyciprop_adjusted.R
+ svyciprop_adjusted.Rd
A version of survey::svyciprop
that adjusts for the degrees of freedom when method == "beta"
.
Usage
+svyciprop_adjusted(
+ formula,
+ design,
+ method = c("logit", "likelihood", "asin", "beta", "mean"),
+ level = 0.95,
+ df_method,
+ ...
+)
Arguments
+- formula +
see
survey::svyciprop
.
+
+
+- design +
see
survey::svyciprop
.
+
+
+- method +
see
survey::svyciprop
.
+
+
+- level +
see
survey::svyciprop
.
+
+
+- df_method +
how
df
should be calculated: "default" or "NHIS".
+
+
+- ... +
see
+survey::svyciprop
.df_method
: for "default",df = degf(design)
; for "NHIS",df = nrow(design) - 1
.
+
+
Details
+Written by Makram Talih in 2019.
+To use this function in tabulations, type: options(surveytable.adjust_svyciprop = TRUE)
.
Examples
+set_survey("vars2019")
+#> _
+#> Survey name NAMCS 2019 PUF
+#> Number of variables 36
+#> Number of observations 8250
+#> Stratified 1 - level Cluster Sampling design (with replacement)
+#> With (398) clusters.
+#> svydesign(ids = ~CPSUM, strata = ~CSTRATM, weights = ~PATWT,
+#> data = d1)
+#> * To adjust how counts are rounded, see ?set_count_int
+options(surveytable.adjust_svyciprop = TRUE)
+tab("AGER")
+#> Patient age recode {NAMCS 2019 PUF}
+#> +---------------------------------------------------------------------------------------------+
+#> ¦ Level ¦ Number (000) ¦ SE (000) ¦ LL (000) ¦ UL (000) ¦ Percent ¦ SE ¦ LL ¦ UL ¦
+#> +---------------+--------------+----------+----------+----------+---------+-----+------+------¦
+#> ¦ Under 15 ¦ 117,917 ¦ 14,097 ¦ 93,229 ¦ 149,142 ¦ 11.4 ¦ 1.3 ¦ 8.9 ¦ 14.2 ¦
+#> ¦ years ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦
+#> +---------------+--------------+----------+----------+----------+---------+-----+------+------¦
+#> ¦ 15-24 years ¦ 64,856 ¦ 7,018 ¦ 52,387 ¦ 80,292 ¦ 6.3 ¦ 0.6 ¦ 5.1 ¦ 7.5 ¦
+#> +---------------+--------------+----------+----------+----------+---------+-----+------+------¦
+#> ¦ 25-44 years ¦ 170,271 ¦ 13,966 ¦ 144,925 ¦ 200,049 ¦ 16.4 ¦ 1.1 ¦ 14.3 ¦ 18.8 ¦
+#> +---------------+--------------+----------+----------+----------+---------+-----+------+------¦
+#> ¦ 45-64 years ¦ 309,506 ¦ 23,290 ¦ 266,994 ¦ 358,787 ¦ 29.9 ¦ 1.4 ¦ 27.2 ¦ 32.6 ¦
+#> +---------------+--------------+----------+----------+----------+---------+-----+------+------¦
+#> ¦ 65-74 years ¦ 206,866 ¦ 14,366 ¦ 180,481 ¦ 237,109 ¦ 20 ¦ 1.2 ¦ 17.6 ¦ 22.5 ¦
+#> +---------------+--------------+----------+----------+----------+---------+-----+------+------¦
+#> ¦ 75 years and ¦ 167,069 ¦ 15,179 ¦ 139,746 ¦ 199,735 ¦ 16.1 ¦ 1.3 ¦ 13.7 ¦ 18.8 ¦
+#> ¦ over ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦
+#> +---------------------------------------------------------------------------------------------+
+#> (Checked presentation standards. Nothing to report.)
+#>
+options(surveytable.adjust_svyciprop = FALSE)
+tab("AGER")
+#> Patient age recode {NAMCS 2019 PUF}
+#> +---------------------------------------------------------------------------------------------+
+#> ¦ Level ¦ Number (000) ¦ SE (000) ¦ LL (000) ¦ UL (000) ¦ Percent ¦ SE ¦ LL ¦ UL ¦
+#> +---------------+--------------+----------+----------+----------+---------+-----+------+------¦
+#> ¦ Under 15 ¦ 117,917 ¦ 14,097 ¦ 93,229 ¦ 149,142 ¦ 11.4 ¦ 1.3 ¦ 8.9 ¦ 14.2 ¦
+#> ¦ years ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦
+#> +---------------+--------------+----------+----------+----------+---------+-----+------+------¦
+#> ¦ 15-24 years ¦ 64,856 ¦ 7,018 ¦ 52,387 ¦ 80,292 ¦ 6.3 ¦ 0.6 ¦ 5.1 ¦ 7.5 ¦
+#> +---------------+--------------+----------+----------+----------+---------+-----+------+------¦
+#> ¦ 25-44 years ¦ 170,271 ¦ 13,966 ¦ 144,925 ¦ 200,049 ¦ 16.4 ¦ 1.1 ¦ 14.3 ¦ 18.8 ¦
+#> +---------------+--------------+----------+----------+----------+---------+-----+------+------¦
+#> ¦ 45-64 years ¦ 309,506 ¦ 23,290 ¦ 266,994 ¦ 358,787 ¦ 29.9 ¦ 1.4 ¦ 27.2 ¦ 32.6 ¦
+#> +---------------+--------------+----------+----------+----------+---------+-----+------+------¦
+#> ¦ 65-74 years ¦ 206,866 ¦ 14,366 ¦ 180,481 ¦ 237,109 ¦ 20 ¦ 1.2 ¦ 17.6 ¦ 22.5 ¦
+#> +---------------+--------------+----------+----------+----------+---------+-----+------+------¦
+#> ¦ 75 years and ¦ 167,069 ¦ 15,179 ¦ 139,746 ¦ 199,735 ¦ 16.1 ¦ 1.3 ¦ 13.7 ¦ 18.8 ¦
+#> ¦ over ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦
+#> +---------------------------------------------------------------------------------------------+
+#> (Checked presentation standards. Nothing to report.)
+#>
+