2017-08-18 22:16:01 2017-08-18 22:16:01 R version 3.4.0 (2017-04-21) -- "You Stupid Darkness" 2017-08-18 22:16:01 Copyright (C) 2017 The R Foundation for Statistical Computing 2017-08-18 22:16:01 Platform: x86_64-w64-mingw32/x64 (64-bit) 2017-08-18 22:16:01 2017-08-18 22:16:01 R is free software and comes with ABSOLUTELY NO WARRANTY. 2017-08-18 22:16:01 You are welcome to redistribute it under certain conditions. 2017-08-18 22:16:01 Type 'license()' or 'licence()' for distribution details. 2017-08-18 22:16:01 2017-08-18 22:16:01 Natural language support but running in an English locale 2017-08-18 22:16:01 2017-08-18 22:16:01 R is a collaborative project with many contributors. 2017-08-18 22:16:01 Type 'contributors()' for more information and 2017-08-18 22:16:01 'citation()' on how to cite R or R packages in publications. 2017-08-18 22:16:01 2017-08-18 22:16:01 Type 'demo()' for some demos, 'help()' for on-line help, or 2017-08-18 22:16:01 'help.start()' for an HTML browser interface to help. 2017-08-18 22:16:01 Type 'q()' to quit R. 2017-08-18 22:16:01 2017-08-18 22:16:01 > setwd( Sys.getenv( "RWD" ) ) 2017-08-18 22:16:01 > 2017-08-18 22:16:01 > machine_specific_replacements <- 2017-08-18 22:16:01 + list( 2017-08-18 22:16:01 + 2017-08-18 22:16:01 + # replace the folder path on macnix 2017-08-18 22:16:01 + c( 'path.expand( \"~\" ) , \"NBS\"' , paste0( '"' , getwd() , '"' ) ) , 2017-08-18 22:16:01 + 2017-08-18 22:16:01 + # change other things in the script to be run 2017-08-18 22:16:01 + c( "hello" , "howdy" ) 2017-08-18 22:16:01 + 2017-08-18 22:16:01 + ) 2017-08-18 22:16:01 > 2017-08-18 22:16:01 > source( lodown::syntaxtractor( "nbs" , replacements = machine_specific_replacements , setup_test = "setup" ) , echo = TRUE ) 2017-08-18 22:16:02 2017-08-18 22:16:02 > library(lodown) 2017-08-18 22:16:02 2017-08-18 22:16:02 > lodown("nbs", output_dir = file.path("e:/eanthony/r-wd/nbs-1503119729")) 2017-08-18 22:16:02 building catalog for nbs 2017-08-18 22:16:02 2017-08-18 22:16:04 locally downloading nbs 2017-08-18 22:16:04 2017-08-18 22:16:04 'https://www.ssa.gov/disabilityresearch/documents/r1puf093009.CSV' 2017-08-18 22:16:04 cached in 2017-08-18 22:16:04 'E:/eanthony/r-tmp/nbs/ae52b19983ff755049da0703880ab7f7.Rcache' 2017-08-18 22:16:04 copying to 2017-08-18 22:16:04 'E:\eanthony\r-tmp\nbs\RtmpkrhRug\file386c4c0b4893' 2017-08-18 22:16:04 2017-08-18 22:16:14 nbs catalog entry 1 of 4 stored at 'e:/eanthony/r-wd/nbs-1503119729/round 01.rds' 2017-08-18 22:16:14 2017-08-18 22:16:15 'https://www.ssa.gov/disabilityresearch/documents/r2puf102609.csv' 2017-08-18 22:16:15 cached in 2017-08-18 22:16:15 'E:/eanthony/r-tmp/nbs/5fe6a4487614be12708f1ca9e32a9b3a.Rcache' 2017-08-18 22:16:15 copying to 2017-08-18 22:16:15 'E:\eanthony\r-tmp\nbs\RtmpkrhRug\file386c4c0b4893' 2017-08-18 22:16:15 2017-08-18 22:16:30 nbs catalog entry 2 of 4 stored at 'e:/eanthony/r-wd/nbs-1503119729/round 02.rds' 2017-08-18 22:16:30 2017-08-18 22:16:30 'https://www.ssa.gov/disabilityresearch/documents/NBSr3puf121509.CSV' 2017-08-18 22:16:30 cached in 2017-08-18 22:16:30 'E:/eanthony/r-tmp/nbs/8238982c66387067fae2f4aefdddcf76.Rcache' 2017-08-18 22:16:30 copying to 2017-08-18 22:16:30 'E:\eanthony\r-tmp\nbs\RtmpkrhRug\file386c4c0b4893' 2017-08-18 22:16:30 2017-08-18 22:16:51 nbs catalog entry 3 of 4 stored at 'e:/eanthony/r-wd/nbs-1503119729/round 03.rds' 2017-08-18 22:16:51 2017-08-18 22:16:51 'https://www.ssa.gov/disabilityresearch/documents/NBSR4PUF.csv' 2017-08-18 22:16:51 cached in 2017-08-18 22:16:51 'E:/eanthony/r-tmp/nbs/c58247983bf4413d1458db4bf1897054.Rcache' 2017-08-18 22:16:51 copying to 2017-08-18 22:16:51 'E:\eanthony\r-tmp\nbs\RtmpkrhRug\file386c4c0b4893' 2017-08-18 22:16:51 2017-08-18 22:17:16 nbs catalog entry 4 of 4 stored at 'e:/eanthony/r-wd/nbs-1503119729/round 04.rds' 2017-08-18 22:17:16 2017-08-18 22:17:16 nbs local download completed 2017-08-18 22:17:16 2017-08-18 22:17:16 > 2017-08-18 22:17:18 2017-08-18 22:17:18 R version 3.4.0 (2017-04-21) -- "You Stupid Darkness" 2017-08-18 22:17:18 Copyright (C) 2017 The R Foundation for Statistical Computing 2017-08-18 22:17:18 Platform: x86_64-w64-mingw32/x64 (64-bit) 2017-08-18 22:17:18 2017-08-18 22:17:18 R is free software and comes with ABSOLUTELY NO WARRANTY. 2017-08-18 22:17:18 You are welcome to redistribute it under certain conditions. 2017-08-18 22:17:18 Type 'license()' or 'licence()' for distribution details. 2017-08-18 22:17:18 2017-08-18 22:17:18 Natural language support but running in an English locale 2017-08-18 22:17:18 2017-08-18 22:17:18 R is a collaborative project with many contributors. 2017-08-18 22:17:18 Type 'contributors()' for more information and 2017-08-18 22:17:18 'citation()' on how to cite R or R packages in publications. 2017-08-18 22:17:18 2017-08-18 22:17:18 Type 'demo()' for some demos, 'help()' for on-line help, or 2017-08-18 22:17:18 'help.start()' for an HTML browser interface to help. 2017-08-18 22:17:18 Type 'q()' to quit R. 2017-08-18 22:17:18 2017-08-18 22:17:19 > setwd( Sys.getenv( "RWD" ) ) 2017-08-18 22:17:19 > 2017-08-18 22:17:19 > machine_specific_replacements <- 2017-08-18 22:17:19 + list( 2017-08-18 22:17:19 + 2017-08-18 22:17:19 + # replace the folder path on macnix 2017-08-18 22:17:19 + c( 'path.expand( \"~\" ) , \"NBS\"' , paste0( '"' , getwd() , '"' ) ) , 2017-08-18 22:17:19 + 2017-08-18 22:17:19 + # change other things in the script to be run 2017-08-18 22:17:19 + c( "hello" , "howdy" ) 2017-08-18 22:17:19 + 2017-08-18 22:17:19 + ) 2017-08-18 22:17:19 > 2017-08-18 22:17:19 > source( lodown::syntaxtractor( "nbs" , replacements = machine_specific_replacements , setup_test = "test" ) , echo = TRUE ) 2017-08-18 22:17:19 2017-08-18 22:19:24 2017-08-18 22:19:24 > library(lodown) 2017-08-18 22:19:24 2017-08-18 22:19:24 > nbs_cat <- get_catalog("nbs", output_dir = file.path("e:/eanthony/r-wd/nbs-1503119729")) 2017-08-18 22:19:24 building catalog for nbs 2017-08-18 22:19:24 2017-08-18 22:19:26 2017-08-18 22:19:26 > nbs_cat <- subset(nbs_cat, this_round == 4) 2017-08-18 22:19:26 2017-08-18 22:19:26 > stopifnot(nrow(nbs_cat) > 0) 2017-08-18 22:19:26 2017-08-18 22:19:26 > library(survey) 2017-08-18 22:19:26 Loading required package: grid 2017-08-18 22:19:26 Loading required package: Matrix 2017-08-18 22:19:27 Loading required package: survival 2017-08-18 22:19:27 2017-08-18 22:19:27 Attaching package: 'survey' 2017-08-18 22:19:27 2017-08-18 22:19:27 The following object is masked from 'package:graphics': 2017-08-18 22:19:27 2017-08-18 22:19:27 dotchart 2017-08-18 22:19:27 2017-08-18 22:19:27 2017-08-18 22:19:27 > nbs_df <- readRDS(file.path("e:/eanthony/r-wd/nbs-1503119729", 2017-08-18 22:19:27 + "round 04.rds")) 2017-08-18 22:19:28 2017-08-18 22:19:28 > nbs_design <- svydesign(~a_psu_pub, strata = ~a_strata, 2017-08-18 22:19:28 + data = nbs_df, weights = ~wtr4_ben) 2017-08-18 22:19:28 2017-08-18 22:19:28 > nbs_design <- update(nbs_design, male = as.numeric(orgsampinfo_sex == 2017-08-18 22:19:28 + 1), age_categories = factor(c_intage_pub, labels = c("18-25", 2017-08-18 22:19:28 + "2 ..." ... [TRUNCATED] 2017-08-18 22:19:28 2017-08-18 22:19:28 > sum(weights(nbs_design, "sampling") != 0) 2017-08-18 22:19:28 [1] 2298 2017-08-18 22:19:28 2017-08-18 22:19:28 > svyby(~one, ~age_categories, nbs_design, unwtd.count) 2017-08-18 22:19:28 age_categories counts se 2017-08-18 22:19:28 18-25 18-25 344 0 2017-08-18 22:19:28 26-40 26-40 902 0 2017-08-18 22:19:28 41-55 41-55 754 0 2017-08-18 22:19:28 56 and older 56 and older 298 0 2017-08-18 22:19:28 2017-08-18 22:19:28 > svytotal(~one, nbs_design) 2017-08-18 22:19:28 total SE 2017-08-18 22:19:28 one 11102096 303506 2017-08-18 22:19:28 2017-08-18 22:19:28 > svyby(~one, ~age_categories, nbs_design, svytotal) 2017-08-18 22:19:29 age_categories one se 2017-08-18 22:19:29 18-25 18-25 629879.4 34768.47 2017-08-18 22:19:29 26-40 26-40 1740750.8 62955.77 2017-08-18 22:19:29 41-55 41-55 3986740.6 210289.62 2017-08-18 22:19:29 56 and older 56 and older 4744725.4 210264.92 2017-08-18 22:19:29 2017-08-18 22:19:29 > svymean(~n_totssbenlastmnth_pub, nbs_design) 2017-08-18 22:19:29 mean SE 2017-08-18 22:19:29 n_totssbenlastmnth_pub 888.72 12.021 2017-08-18 22:19:29 2017-08-18 22:19:29 > svyby(~n_totssbenlastmnth_pub, ~age_categories, nbs_design, 2017-08-18 22:19:29 + svymean) 2017-08-18 22:19:29 age_categories n_totssbenlastmnth_pub se 2017-08-18 22:19:29 18-25 18-25 571.9644 16.01497 2017-08-18 22:19:29 26-40 26-40 749.5379 11.12937 2017-08-18 22:19:29 41-55 41-55 858.8777 18.17960 2017-08-18 22:19:29 56 and older 56 and older 1006.9043 23.15232 2017-08-18 22:19:29 2017-08-18 22:19:29 > svymean(~c_hhsize_pub, nbs_design) 2017-08-18 22:19:29 mean SE 2017-08-18 22:19:29 c_hhsize_pub1 0.3332141 0.0166 2017-08-18 22:19:29 c_hhsize_pub2 0.3149135 0.0164 2017-08-18 22:19:29 c_hhsize_pub3 0.1374473 0.0097 2017-08-18 22:19:29 c_hhsize_pub4 0.1020012 0.0095 2017-08-18 22:19:29 c_hhsize_pub5 0.0512492 0.0063 2017-08-18 22:19:29 c_hhsize_pub6 0.0508282 0.0054 2017-08-18 22:19:29 c_hhsize_pubD 0.0063256 0.0022 2017-08-18 22:19:29 c_hhsize_pubR 0.0040209 0.0026 2017-08-18 22:19:29 2017-08-18 22:19:29 > svyby(~c_hhsize_pub, ~age_categories, nbs_design, 2017-08-18 22:19:29 + svymean) 2017-08-18 22:19:29 age_categories c_hhsize_pub1 c_hhsize_pub2 c_hhsize_pub3 2017-08-18 22:19:29 18-25 18-25 0.1683468 0.1785468 0.2129563 2017-08-18 22:19:29 26-40 26-40 0.2836866 0.2006891 0.2200142 2017-08-18 22:19:29 41-55 41-55 0.3832599 0.2931694 0.1321156 2017-08-18 22:19:29 56 and older 56 and older 0.3312208 0.3931939 0.1016108 2017-08-18 22:19:29 c_hhsize_pub4 c_hhsize_pub5 c_hhsize_pub6 c_hhsize_pubD 2017-08-18 22:19:29 18-25 0.19829491 0.09565934 0.12732271 0.014646078 2017-08-18 22:19:29 26-40 0.12919249 0.08415306 0.07685287 0.003381314 2017-08-18 22:19:29 41-55 0.08691233 0.05280942 0.04372074 0.005693284 2017-08-18 22:19:29 56 and older 0.09192026 0.03197080 0.03709741 0.006832423 2017-08-18 22:19:29 c_hhsize_pubR se.c_hhsize_pub1 se.c_hhsize_pub2 se.c_hhsize_pub3 2017-08-18 22:19:29 18-25 0.004227026 0.02647201 0.02002190 0.02471980 2017-08-18 22:19:29 26-40 0.002030423 0.01722697 0.01308725 0.01603754 2017-08-18 22:19:29 41-55 0.002319278 0.02625389 0.01915850 0.01644885 2017-08-18 22:19:29 56 and older 0.006153580 0.03088648 0.03236428 0.01695634 2017-08-18 22:19:29 se.c_hhsize_pub4 se.c_hhsize_pub5 se.c_hhsize_pub6 2017-08-18 22:19:29 18-25 0.02435934 0.015603488 0.017681832 2017-08-18 22:19:29 26-40 0.01135814 0.010237670 0.009373607 2017-08-18 22:19:29 41-55 0.01173657 0.011176925 0.009859746 2017-08-18 22:19:29 56 and older 0.01887858 0.009956332 0.010235835 2017-08-18 22:19:29 se.c_hhsize_pubD se.c_hhsize_pubR 2017-08-18 22:19:29 18-25 0.006787397 0.004192901 2017-08-18 22:19:29 26-40 0.001951144 0.001464181 2017-08-18 22:19:29 41-55 0.002617443 0.002322490 2017-08-18 22:19:29 56 and older 0.004795326 0.004653361 2017-08-18 22:19:29 2017-08-18 22:19:29 > svytotal(~n_totssbenlastmnth_pub, nbs_design) 2017-08-18 22:19:29 total SE 2017-08-18 22:19:29 n_totssbenlastmnth_pub 9866634478 296883773 2017-08-18 22:19:29 2017-08-18 22:19:29 > svyby(~n_totssbenlastmnth_pub, ~age_categories, nbs_design, 2017-08-18 22:19:29 + svytotal) 2017-08-18 22:19:29 age_categories n_totssbenlastmnth_pub se 2017-08-18 22:19:29 18-25 18-25 360268630 22464511 2017-08-18 22:19:29 26-40 26-40 1304758667 52384553 2017-08-18 22:19:29 41-55 41-55 3424122682 188848271 2017-08-18 22:19:29 56 and older 56 and older 4777484499 221981463 2017-08-18 22:19:29 2017-08-18 22:19:29 > svytotal(~c_hhsize_pub, nbs_design) 2017-08-18 22:19:29 total SE 2017-08-18 22:19:29 c_hhsize_pub1 3699376 204333 2017-08-18 22:19:29 c_hhsize_pub2 3496200 209037 2017-08-18 22:19:29 c_hhsize_pub3 1525953 112526 2017-08-18 22:19:29 c_hhsize_pub4 1132427 112206 2017-08-18 22:19:29 c_hhsize_pub5 568974 73200 2017-08-18 22:19:29 c_hhsize_pub6 564300 61232 2017-08-18 22:19:29 c_hhsize_pubD 70227 24913 2017-08-18 22:19:29 c_hhsize_pubR 44640 28693 2017-08-18 22:19:29 2017-08-18 22:19:29 > svyby(~c_hhsize_pub, ~age_categories, nbs_design, 2017-08-18 22:19:29 + svytotal) 2017-08-18 22:19:29 age_categories c_hhsize_pub1 c_hhsize_pub2 c_hhsize_pub3 2017-08-18 22:19:29 18-25 18-25 106038.2 112463.0 134136.8 2017-08-18 22:19:29 26-40 26-40 493827.7 349349.7 382989.8 2017-08-18 22:19:29 41-55 41-55 1527957.8 1168790.3 526710.8 2017-08-18 22:19:29 56 and older 56 and older 1571551.8 1865597.2 482115.2 2017-08-18 22:19:29 c_hhsize_pub4 c_hhsize_pub5 c_hhsize_pub6 c_hhsize_pubD 2017-08-18 22:19:29 18-25 124901.9 60253.85 80197.96 9225.263 2017-08-18 22:19:29 26-40 224891.9 146489.50 133781.69 5886.025 2017-08-18 22:19:29 41-55 346496.9 210537.45 174303.26 22697.645 2017-08-18 22:19:29 56 and older 436136.4 151692.67 176017.02 32417.972 2017-08-18 22:19:29 c_hhsize_pubR se.c_hhsize_pub1 se.c_hhsize_pub2 se.c_hhsize_pub3 2017-08-18 22:19:29 18-25 2662.517 17670.97 14471.11 17033.72 2017-08-18 22:19:29 26-40 3534.460 34505.54 26708.04 32640.39 2017-08-18 22:19:29 41-55 9246.361 133304.82 96420.17 70564.10 2017-08-18 22:19:29 56 and older 29197.049 165797.44 173967.82 80388.15 2017-08-18 22:19:29 se.c_hhsize_pub4 se.c_hhsize_pub5 se.c_hhsize_pub6 2017-08-18 22:19:29 18-25 17209.38 10051.47 11921.47 2017-08-18 22:19:29 26-40 20566.90 18432.67 16689.20 2017-08-18 22:19:29 41-55 49049.96 47044.97 40573.75 2017-08-18 22:19:29 56 and older 92308.24 48354.20 48760.22 2017-08-18 22:19:29 se.c_hhsize_pubD se.c_hhsize_pubR 2017-08-18 22:19:29 18-25 4236.902 2662.517 2017-08-18 22:19:29 26-40 3410.298 2536.303 2017-08-18 22:19:29 41-55 10564.297 9246.361 2017-08-18 22:19:29 56 and older 22926.576 21903.597 2017-08-18 22:19:29 2017-08-18 22:19:29 > svyquantile(~n_totssbenlastmnth_pub, nbs_design, 0.5) 2017-08-18 22:19:29 0.5 2017-08-18 22:19:29 n_totssbenlastmnth_pub 800 2017-08-18 22:19:29 2017-08-18 22:19:29 > svyby(~n_totssbenlastmnth_pub, ~age_categories, nbs_design, 2017-08-18 22:19:29 + svyquantile, 0.5, ci = TRUE, keep.var = TRUE) 2017-08-18 22:19:29 age_categories n_totssbenlastmnth_pub se 2017-08-18 22:19:29 18-25 18-25 700 0.00000 2017-08-18 22:19:29 26-40 26-40 700 0.00000 2017-08-18 22:19:29 41-55 41-55 800 0.00000 2017-08-18 22:19:29 56 and older 56 and older 1000 51.02135 2017-08-18 22:19:29 2017-08-18 22:19:29 > svyratio(numerator = ~n_ssilastmnth_pub, denominator = ~n_totssbenlastmnth_pub, 2017-08-18 22:19:29 + nbs_design) 2017-08-18 22:19:29 Ratio estimator: svyratio.survey.design2(numerator = ~n_ssilastmnth_pub, denominator = ~n_totssbenlastmnth_pub, 2017-08-18 22:19:29 nbs_design) 2017-08-18 22:19:29 Ratios= 2017-08-18 22:19:29 n_totssbenlastmnth_pub 2017-08-18 22:19:29 n_ssilastmnth_pub 0.2143466 2017-08-18 22:19:29 SEs= 2017-08-18 22:19:29 n_totssbenlastmnth_pub 2017-08-18 22:19:29 n_ssilastmnth_pub 0.01268758 2017-08-18 22:19:29 2017-08-18 22:19:29 > sub_nbs_design <- subset(nbs_design, c_curmedicare == 2017-08-18 22:19:29 + 1) 2017-08-18 22:19:29 2017-08-18 22:19:29 > svymean(~n_totssbenlastmnth_pub, sub_nbs_design) 2017-08-18 22:19:29 mean SE 2017-08-18 22:19:29 n_totssbenlastmnth_pub 962.75 14.94 2017-08-18 22:19:29 2017-08-18 22:19:29 > this_result <- svymean(~n_totssbenlastmnth_pub, nbs_design) 2017-08-18 22:19:29 2017-08-18 22:19:29 > coef(this_result) 2017-08-18 22:19:29 n_totssbenlastmnth_pub 2017-08-18 22:19:29 888.7182 2017-08-18 22:19:29 2017-08-18 22:19:29 > SE(this_result) 2017-08-18 22:19:29 n_totssbenlastmnth_pub 2017-08-18 22:19:29 n_totssbenlastmnth_pub 12.02136 2017-08-18 22:19:29 2017-08-18 22:19:29 > confint(this_result) 2017-08-18 22:19:29 2.5 % 97.5 % 2017-08-18 22:19:29 n_totssbenlastmnth_pub 865.1567 912.2796 2017-08-18 22:19:29 2017-08-18 22:19:29 > cv(this_result) 2017-08-18 22:19:29 n_totssbenlastmnth_pub 2017-08-18 22:19:29 n_totssbenlastmnth_pub 0.01352663 2017-08-18 22:19:29 2017-08-18 22:19:29 > grouped_result <- svyby(~n_totssbenlastmnth_pub, ~age_categories, 2017-08-18 22:19:29 + nbs_design, svymean) 2017-08-18 22:19:30 2017-08-18 22:19:30 > coef(grouped_result) 2017-08-18 22:19:30 18-25 26-40 41-55 56 and older 2017-08-18 22:19:30 571.9644 749.5379 858.8777 1006.9043 2017-08-18 22:19:30 2017-08-18 22:19:30 > SE(grouped_result) 2017-08-18 22:19:30 [1] 16.01497 11.12937 18.17960 23.15232 2017-08-18 22:19:30 2017-08-18 22:19:30 > confint(grouped_result) 2017-08-18 22:19:30 2.5 % 97.5 % 2017-08-18 22:19:30 18-25 540.5757 603.3532 2017-08-18 22:19:30 26-40 727.7247 771.3511 2017-08-18 22:19:30 41-55 823.2464 894.5091 2017-08-18 22:19:30 56 and older 961.5266 1052.2820 2017-08-18 22:19:30 2017-08-18 22:19:30 > cv(grouped_result) 2017-08-18 22:19:30 18-25 26-40 41-55 56 and older 2017-08-18 22:19:30 0.02799994 0.01484831 0.02116669 0.02299357 2017-08-18 22:19:30 2017-08-18 22:19:30 > degf(nbs_design) 2017-08-18 22:19:30 [1] 80 2017-08-18 22:19:30 2017-08-18 22:19:30 > svyvar(~n_totssbenlastmnth_pub, nbs_design) 2017-08-18 22:19:30 variance SE 2017-08-18 22:19:30 n_totssbenlastmnth_pub 150993 5282.7 2017-08-18 22:19:30 2017-08-18 22:19:30 > svymean(~n_totssbenlastmnth_pub, nbs_design, deff = TRUE) 2017-08-18 22:19:30 mean SE DEff 2017-08-18 22:19:30 n_totssbenlastmnth_pub 888.718 12.021 2.1998 2017-08-18 22:19:30 2017-08-18 22:19:30 > svymean(~n_totssbenlastmnth_pub, nbs_design, deff = "replace") 2017-08-18 22:19:30 mean SE DEff 2017-08-18 22:19:30 n_totssbenlastmnth_pub 888.718 12.021 2.1994 2017-08-18 22:19:30 2017-08-18 22:19:30 > svyciprop(~male, nbs_design, method = "likelihood") 2017-08-18 22:19:31 2.5% 97.5% 2017-08-18 22:19:31 male 0.502 0.474 0.53 2017-08-18 22:19:31 2017-08-18 22:19:31 > svyttest(n_totssbenlastmnth_pub ~ male, nbs_design) 2017-08-18 22:19:31 2017-08-18 22:19:31 Design-based t-test 2017-08-18 22:19:31 2017-08-18 22:19:31 data: n_totssbenlastmnth_pub ~ male 2017-08-18 22:19:31 t = 4.97, df = 79, p-value = 3.805e-06 2017-08-18 22:19:31 alternative hypothesis: true difference in mean is not equal to 0 2017-08-18 22:19:31 sample estimates: 2017-08-18 22:19:31 difference in mean 2017-08-18 22:19:31 141.714 2017-08-18 22:19:31 2017-08-18 22:19:31 2017-08-18 22:19:31 > svychisq(~male + c_hhsize_pub, nbs_design) 2017-08-18 22:19:32 2017-08-18 22:19:32 Pearson's X^2: Rao & Scott adjustment 2017-08-18 22:19:32 2017-08-18 22:19:32 data: svychisq(~male + c_hhsize_pub, nbs_design) 2017-08-18 22:19:32 F = 0.76048, ndf = 6.2637, ddf = 501.0900, p-value = 0.6067 2017-08-18 22:19:32 2017-08-18 22:19:32 2017-08-18 22:19:32 > glm_result <- svyglm(n_totssbenlastmnth_pub ~ male + 2017-08-18 22:19:32 + c_hhsize_pub, nbs_design) 2017-08-18 22:19:32 2017-08-18 22:19:32 > summary(glm_result) 2017-08-18 22:19:32 2017-08-18 22:19:32 Call: 2017-08-18 22:19:32 svyglm(formula = n_totssbenlastmnth_pub ~ male + c_hhsize_pub, 2017-08-18 22:19:32 nbs_design) 2017-08-18 22:19:32 2017-08-18 22:19:32 Survey design: 2017-08-18 22:19:32 update(nbs_design, male = as.numeric(orgsampinfo_sex == 1), age_categories = factor(c_intage_pub, 2017-08-18 22:19:32 labels = c("18-25", "26-40", "41-55", "56 and older"))) 2017-08-18 22:19:32 2017-08-18 22:19:32 Coefficients: 2017-08-18 22:19:32 Estimate Std. Error t value Pr(>|t|) 2017-08-18 22:19:32 (Intercept) 771.51 27.10 28.465 < 2e-16 *** 2017-08-18 22:19:32 male 141.07 28.23 4.997 3.94e-06 *** 2017-08-18 22:19:32 c_hhsize_pub2 141.19 29.10 4.852 6.85e-06 *** 2017-08-18 22:19:32 c_hhsize_pub3 28.94 36.47 0.794 0.430 2017-08-18 22:19:32 c_hhsize_pub4 14.84 39.00 0.380 0.705 2017-08-18 22:19:32 c_hhsize_pub5 -64.53 49.33 -1.308 0.195 2017-08-18 22:19:32 c_hhsize_pub6 -44.87 53.09 -0.845 0.401 2017-08-18 22:19:32 c_hhsize_pubD -71.10 126.04 -0.564 0.574 2017-08-18 22:19:32 c_hhsize_pubR 598.12 78.68 7.602 8.47e-11 *** 2017-08-18 22:19:32 --- 2017-08-18 22:19:32 Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 2017-08-18 22:19:32 2017-08-18 22:19:32 (Dispersion parameter for gaussian family taken to be 139911.7) 2017-08-18 22:19:32 2017-08-18 22:19:32 Number of Fisher Scoring iterations: 2 2017-08-18 22:19:32 2017-08-18 22:19:32 2017-08-18 22:19:32 > library(srvyr) 2017-08-18 22:19:39 2017-08-18 22:19:39 Attaching package: 'srvyr' 2017-08-18 22:19:39 2017-08-18 22:19:39 The following object is masked from 'package:stats': 2017-08-18 22:19:39 2017-08-18 22:19:39 filter 2017-08-18 22:19:39 2017-08-18 22:19:39 2017-08-18 22:19:39 > nbs_srvyr_design <- as_survey(nbs_design) 2017-08-18 22:19:39 2017-08-18 22:19:39 > nbs_srvyr_design %>% summarize(mean = survey_mean(n_totssbenlastmnth_pub)) 2017-08-18 22:19:48 # A tibble: 1 x 2 2017-08-18 22:19:48 mean mean_se 2017-08-18 22:19:48 2017-08-18 22:19:48 1 888.7182 12.02136 2017-08-18 22:19:48 2017-08-18 22:19:48 > nbs_srvyr_design %>% group_by(age_categories) %>% 2017-08-18 22:19:48 + summarize(mean = survey_mean(n_totssbenlastmnth_pub)) 2017-08-18 22:20:16 # A tibble: 4 x 3 2017-08-18 22:20:16 age_categories mean mean_se 2017-08-18 22:20:16 2017-08-18 22:20:16 1 18-25 571.9644 16.01497 2017-08-18 22:20:16 2 26-40 749.5379 11.12937 2017-08-18 22:20:16 3 41-55 858.8777 18.17960 2017-08-18 22:20:16 4 56 and older 1006.9043 23.15232 2017-08-18 22:20:16 Warning messages: 2017-08-18 22:20:16 1: In vcov.svyquantile(X[[i]], ...) : Only diagonal of vcov() available 2017-08-18 22:20:16 2: In vcov.svyquantile(X[[i]], ...) : Only diagonal of vcov() available 2017-08-18 22:20:16 3: In vcov.svyquantile(X[[i]], ...) : Only diagonal of vcov() available 2017-08-18 22:20:16 4: In vcov.svyquantile(X[[i]], ...) : Only diagonal of vcov() available 2017-08-18 22:20:16 >