# Session 10 : données pondérées et plan d'échantillonage
library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.0 --
## v ggplot2 3.3.3.9000 v purrr 0.3.4
## v tibble 3.0.6 v dplyr 1.0.4
## v tidyr 1.1.2 v stringr 1.4.0
## v readr 1.4.0 v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(labelled)
library(questionr)
data("hdv2003")
library(survey)
## Loading required package: grid
## Loading required package: Matrix
##
## Attaching package: 'Matrix'
## The following objects are masked from 'package:tidyr':
##
## expand, pack, unpack
## Loading required package: survival
##
## Attaching package: 'survey'
## The following object is masked from 'package:graphics':
##
## dotchart
# simuler des strates et des grappes
hdv2003$grappe <- rep.int(1:25, times = 80)
hdv2003 <- hdv2003 %>%
arrange(grappe)
hdv2003$strate <- "a"
hdv2003$strate[801:1200] <- "b"
hdv2003$strate[1201:2000] <- "c"
# conseil essentiel
# Faire toutes les recodifications avant de définir le plan d'échantillonnage
# définir un plan d'échantillonnage -----------
dp <- svydesign(ids = ~ 1, weights = ~ poids, data = hdv2003)
dp_strates <- svydesign(ids = ~ 1, weights = ~ poids, data = hdv2003, strata = ~ strate)
dp_grappes <- svydesign(ids = ~ grappe, weights = ~ poids, data = hdv2003)
# Pour un échantillonage à plusieurs degrés
# ids = ~ var1 + var2
dp_strates_grappes <- svydesign(ids = ~ grappe, weights = ~ poids, data = hdv2003, strata = ~ strate)
# si on a besoin d'un sous-échantillon ---------
# toujours définir l'objet survey sur le tableau entier
# puis appliquer la fonction subset
dp_femmes <- subset(dp, sexe == "Femme")
# si besoin de récupérer les poids ------
weights(dp_strates)
## 1 2 3 4 5 6
## 2634.39822 1700.84366 1936.88263 6571.58950 22962.35960 7174.80941
## 7 8 9 10 11 12
## 566.58165 1645.86876 8601.02300 1824.26403 13603.21874 1611.80358
## 13 14 15 16 17 18
## 1773.50953 1150.35083 4792.01034 9683.57638 2814.56228 2147.84106
## 19 20 21 22 23 24
## 9657.99595 2687.28114 2151.26932 3799.84175 3210.74430 13706.31968
## 25 26 27 28 29 30
## 4268.93799 1247.68540 2106.89611 4993.05317 9046.53398 3439.00971
## 31 32 33 34 35 36
## 1086.59011 1264.93006 4084.46759 3564.18137 6178.42919 302.29352
## 37 38 39 40 41 42
## 1808.44613 688.57688 3446.19259 8147.55346 2252.79317 10938.53553
## 43 44 45 46 47 48
## 3936.57863 447.94659 2663.37122 836.26644 4291.00879 6819.19437
## 49 50 51 52 53 54
## 1289.86318 3354.54696 4610.32030 1523.80430 1179.39286 2763.38783
## 55 56 57 58 59 60
## 3280.87763 1216.36448 5018.88111 3795.37338 11076.90257 799.94968
## 61 62 63 64 65 66
## 933.83276 4941.13681 2897.27634 3444.37391 4131.51144 3201.69368
## 67 68 69 70 71 72
## 5310.26295 12316.73032 2088.89940 3464.04622 4228.22664 6864.25787
## 73 74 75 76 77 78
## 4552.64658 13074.78210 976.82434 19413.73042 1200.06506 3148.59477
## 79 80 81 82 83 84
## 6479.80972 1252.49916 9738.39578 6662.83748 834.38451 3238.32040
## 85 86 87 88 89 90
## 11268.55561 2954.27411 578.00909 12745.01230 6781.55643 1583.23777
## 91 92 93 94 95 96
## 1043.59583 2170.15344 5908.78522 10536.17520 2378.06636 11213.31216
## 97 98 99 100 101 102
## 3226.42609 2472.31233 3098.42253 8233.92116 1180.50684 1517.40659
## 103 104 105 106 107 108
## 5699.75924 14946.31635 2046.13748 7323.99917 1414.53791 9553.96929
## 109 110 111 112 113 114
## 2564.21200 1008.92675 16570.12070 5217.08228 1180.98570 1164.61797
## 115 116 117 118 119 120
## 3284.63877 6200.97477 3229.74425 3759.14900 1161.82293 6393.79601
## 121 122 123 124 125 126
## 663.98734 7660.77322 4680.84027 11433.02024 8439.80977 25986.09789
## 127 128 129 130 131 132
## 6438.15359 4629.22907 1867.24312 1285.45223 965.12018 5463.26829
## 133 134 135 136 137 138
## 6743.98564 3176.41916 8881.53352 7514.21296 2302.24514 3986.63063
## 139 140 141 142 143 144
## 3098.49234 7273.59185 6919.55820 2057.70976 2485.84216 662.80449
## 145 146 147 148 149 150
## 5538.19479 10772.84994 5303.34582 855.29199 11202.98847 5114.64669
## 151 152 153 154 155 156
## 4100.45860 2997.05954 376.18012 3846.18425 16066.90836 8487.99867
## 157 158 159 160 161 162
## 5371.58970 1854.81667 1605.37103 9938.70397 3994.10246 3359.46898
## 163 164 165 166 167 168
## 3432.52858 17333.25440 2032.21525 8819.37612 8547.32348 8196.61223
## 169 170 171 172 173 174
## 6516.50773 5735.28923 2224.88512 10120.05933 6040.51233 4069.28538
## 175 176 177 178 179 180
## 2051.08424 14830.58383 9510.56235 8569.68033 4443.46418 9000.59787
## 181 182 183 184 185 186
## 14755.43868 7859.12669 4233.37037 8654.38669 358.18111 6788.95277
## 187 188 189 190 191 192
## 1285.54567 825.85450 3840.48642 5500.62645 4269.16065 4670.87574
## 193 194 195 196 197 198
## 968.01988 13720.73546 521.34264 3885.26104 8659.04803 1540.80834
## 199 200 201 202 203 204
## 2178.46530 5484.50779 7966.27380 13470.76759 7239.40283 1484.90829
## 205 206 207 208 209 210
## 2689.54513 4904.07416 935.32185 8263.30157 4079.20867 742.04353
## 211 212 213 214 215 216
## 9380.68243 656.05756 2741.46086 7453.34975 1242.37048 8977.84825
## 217 218 219 220 221 222
## 6747.15806 2756.88131 2030.81797 1830.99979 238.44301 2766.07068
## 223 224 225 226 227 228
## 9568.31058 7367.10529 1050.28418 4872.16258 8906.30907 473.01688
## 229 230 231 232 233 234
## 12081.02626 3240.21397 7515.24410 4018.76869 9664.31868 7441.14711
## 235 236 237 238 239 240
## 913.84435 23299.32407 6040.78253 6238.89214 3272.68076 2174.38739
## 241 242 243 244 245 246
## 5731.66151 8536.11006 11354.89319 6168.50167 3173.02478 1117.19960
## 247 248 249 250 251 252
## 6123.69218 7697.18733 6339.69459 1199.49021 3732.58313 4054.42253
## 253 254 255 256 257 258
## 4970.03148 6528.37095 6058.08403 14891.77337 23867.62510 5907.34751
## 259 260 261 262 263 264
## 3436.36088 8368.88107 14201.23880 6889.07086 1853.07026 5783.46143
## 265 266 267 268 269 270
## 3745.47385 3550.30970 6368.47979 7424.20649 10820.50295 5544.51375
## 271 272 273 274 275 276
## 6969.16902 2720.58113 8585.31073 7451.68794 6978.11309 1347.90418
## 277 278 279 280 281 282
## 4302.71127 5662.78790 4010.90211 1840.13265 7147.28264 3298.97074
## 283 284 285 286 287 288
## 945.73993 5881.42070 1703.00813 8718.80044 6165.34358 9733.98656
## 289 290 291 292 293 294
## 3824.72988 797.66048 2176.72982 13572.65669 3358.41734 5854.28376
## 295 296 297 298 299 300
## 7276.69365 29570.78696 5620.92896 4561.49562 4064.43049 8201.93548
## 301 302 303 304 305 306
## 1457.65930 20681.68902 704.50182 5323.88100 11440.85272 2400.09786
## 307 308 309 310 311 312
## 9947.85164 5568.52642 2282.05819 11305.21743 7534.40032 552.61185
## 313 314 315 316 317 318
## 153.01026 3019.93207 7205.15184 7980.06339 4930.67600 6294.86715
## 319 320 321 322 323 324
## 1465.60753 567.76117 4329.09400 10620.52591 9292.97620 7357.92915
## 325 326 327 328 329 330
## 10483.54536 6721.40093 3580.08617 5794.55269 6529.89704 6688.77708
## 331 332 333 334 335 336
## 2330.03915 8970.64438 12618.12652 6446.60640 2204.04027 2756.88131
## 337 338 339 340 341 342
## 9984.41426 9178.11612 9354.26753 7312.43455 3190.33875 4228.61164
## 343 344 345 346 347 348
## 19493.50009 885.44705 2969.28214 5841.66106 4165.52267 3873.80041
## 349 350 351 352 353 354
## 5326.74244 3421.95972 10332.16009 2887.95673 6328.48895 3447.44381
## 355 356 357 358 359 360
## 3564.18137 1731.26116 10637.42813 8324.60479 6350.79986 748.55080
## 361 362 363 364 365 366
## 14785.39348 5393.75021 2134.45006 236.28395 4427.23297 2686.87308
## 367 368 369 370 371 372
## 1819.49908 18190.65372 3540.43993 943.79546 2836.91882 1873.69142
## 373 374 375 376 377 378
## 6505.62747 7930.68447 8415.73307 15116.14962 3806.47909 14805.28412
## 379 380 381 382 383 384
## 4233.37037 7678.55546 931.00249 6388.49891 4276.02236 7337.74030
## 385 386 387 388 389 390
## 10365.59071 1572.63005 5801.79640 852.41196 11347.67529 2641.19973
## 391 392 393 394 395 396
## 2348.47064 9279.64972 2385.04522 2045.69969 12544.41826 8742.18026
## 397 398 399 400 401 402
## 1365.43180 896.34470 7418.57533 6107.21084 8674.69938 5264.29531
## 403 404 405 406 407 408
## 6344.12272 3909.55864 2395.82957 7975.21857 1087.88725 388.10276
## 409 410 411 412 413 414
## 5802.14765 8463.64000 3298.37878 1991.46873 2342.71929 1939.97350
## 415 416 417 418 419 420
## 2499.10005 6708.95596 3991.23505 1610.88968 3560.02133 2334.28725
## 421 422 423 424 425 426
## 1781.37958 2400.98611 4486.89566 10426.93772 6308.14479 5827.01295
## 427 428 429 430 431 432
## 690.80871 4777.51426 1280.24825 1364.04350 5133.69570 3242.02937
## 433 434 435 436 437 438
## 1091.92665 7147.28264 7916.67722 1111.52211 1654.59924 2652.78401
## 439 440 441 442 443 444
## 2785.90046 3298.26755 10645.74599 2438.26388 12082.01628 2099.07668
## 445 446 447 448 449 450
## 8724.65373 8410.55464 7435.75946 1112.23537 5968.53055 6143.52233
## 451 452 453 454 455 456
## 3312.59794 8411.92320 5933.35310 3845.54171 5408.65322 6062.76946
## 457 458 459 460 461 462
## 6793.47725 6998.51046 7739.94184 8950.32520 7364.66018 6260.74083
## 463 464 465 466 467 468
## 5535.72536 12246.10604 4492.99836 5713.78178 92.93637 4836.13931
## 469 470 471 472 473 474
## 5927.08888 4875.17709 5276.45519 872.36834 685.92819 5837.60349
## 475 476 477 478 479 480
## 7147.28264 7535.84118 2806.93096 13332.43038 6868.35044 3734.32949
## 481 482 483 484 485 486
## 6165.80349 14161.75971 4899.94038 1514.06192 12265.60802 9081.31588
## 487 488 489 490 491 492
## 3963.18408 914.68026 2554.52735 1544.16371 10397.02130 8150.71674
## 493 494 495 496 497 498
## 605.52146 7973.26127 2544.46340 609.93821 3151.21926 6809.89950
## 499 500 501 502 503 504
## 4794.21618 835.70647 820.59817 1239.40043 1081.59974 1391.47106
## 505 506 507 508 509 510
## 2905.27279 1965.95066 6511.37865 2674.38036 2289.32303 2381.25706
## 511 512 513 514 515 516
## 2179.90972 261.71764 8229.21578 9721.73309 2420.83948 8750.76665
## 517 518 519 520 521 522
## 3547.84777 2125.67730 5834.25822 3765.01166 1159.24140 11739.71031
## 523 524 525 526 527 528
## 19258.24675 6586.12976 7013.44277 6819.19437 2822.24691 1271.53792
## 529 530 531 532 533 534
## 7147.28264 10181.68215 23967.67323 127.90122 5537.89340 7230.27918
## 535 536 537 538 539 540
## 9262.37674 8881.85112 1648.48882 1005.56052 5169.33741 4629.31294
## 541 542 543 544 545 546
## 3943.92232 1250.99200 2248.39503 2987.43234 1760.29569 6277.85110
## 547 548 549 550 551 552
## 1113.24521 7788.15964 12533.83881 8222.27349 5117.24243 7282.84175
## 553 554 555 556 557 558
## 3010.84595 1976.82981 3203.19253 5079.08146 6147.69713 7128.36274
## 559 560 561 562 563 564
## 924.66586 1269.63861 12891.64076 1339.61963 4766.86520 2916.92540
## 565 566 567 568 569 570
## 5844.38619 10783.41051 7310.11222 15044.27884 5100.79858 1962.92019
## 571 572 573 574 575 576
## 9865.73934 10164.79164 2435.15468 9891.81649 9894.97377 4736.77218
## 577 578 579 580 581 582
## 3192.37881 4540.62082 3244.10615 401.14929 3832.53846 3701.23693
## 583 584 585 586 587 588
## 7891.36280 6310.44518 1537.28455 8439.80977 2820.02739 6449.51889
## 589 590 591 592 593 594
## 5367.66973 433.32346 2485.52436 10302.99602 7047.88027 1393.90271
## 595 596 597 598 599 600
## 8882.49835 2771.07574 7785.06046 3765.65249 5664.56976 5319.72078
## 601 602 603 604 605 606
## 4418.01406 571.83882 568.19342 578.76913 3518.64852 601.57834
## 607 608 609 610 611 612
## 7940.67704 1305.25166 6446.60640 1423.49844 7379.76263 5322.90478
## 613 614 615 616 617 618
## 5733.79951 4760.38247 14753.62571 1894.29631 2239.61924 5662.78790
## 619 620 621 622 623 624
## 7188.52984 3107.39098 6575.66217 4629.22907 2608.39965 7838.57762
## 625 626 627 628 629 630
## 22870.42151 2114.79233 9854.04732 12265.60802 4885.31123 10453.81230
## 631 632 633 634 635 636
## 9530.08871 4155.16642 26204.71333 5190.20730 8737.52614 5641.48992
## 637 638 639 640 641 642
## 6697.86825 2008.16022 3706.07446 7396.80716 7808.87206 9243.91526
## 643 644 645 646 647 648
## 3462.81206 3156.08224 1114.64958 7444.42715 2063.17748 6648.04006
## 649 650 651 652 653 654
## 7323.01540 663.50864 3258.31269 4468.97627 1229.01187 8752.57996
## 655 656 657 658 659 660
## 5332.97218 6853.15984 6587.14598 16548.67114 6259.80712 2236.79269
## 661 662 663 664 665 666
## 12156.75299 5621.27468 2968.67629 2119.84024 1624.32833 4336.49437
## 667 668 669 670 671 672
## 5820.34189 2318.53573 6287.49937 13580.64222 9554.68018 8316.77062
## 673 674 675 676 677 678
## 3628.06951 2335.64016 5390.87477 17547.49437 7298.09708 5376.16490
## 679 680 681 682 683 684
## 4763.69824 10874.67952 7324.08969 2381.03405 7624.31229 1083.23383
## 685 686 687 688 689 690
## 2545.17530 5936.30907 5775.91347 5589.29095 1355.79604 7128.36274
## 691 692 693 694 695 696
## 8032.88667 12102.70990 4249.14230 4244.16325 1172.47491 19356.29285
## 697 698 699 700 701 702
## 1244.81184 5160.84409 8767.53823 8997.35334 9819.92083 2070.93395
## 703 704 705 706 707 708
## 9262.37674 9183.73557 6721.53253 7526.51664 5840.41730 1362.84771
## 709 710 711 712 713 714
## 833.93771 7567.34821 2064.63151 1773.73858 7313.12195 3071.78227
## 715 716 717 718 719 720
## 1176.20740 1648.61108 11414.38776 5285.44855 3495.39270 4010.07505
## 721 722 723 724 725 726
## 2277.16047 4512.29590 23732.48529 12404.57949 3172.98165 5276.45519
## 727 728 729 730 731 732
## 7514.76413 7739.15153 13644.79087 827.45367 2614.50724 2220.78754
## 733 734 735 736 737 738
## 9751.98403 13195.64740 3291.45844 8482.97942 5188.08690 693.12945
## 739 740 741 742 743 744
## 3029.04202 1484.20198 1974.33010 6240.30820 1339.06124 1116.03089
## 745 746 747 748 749 750
## 13590.63983 8094.24430 3223.30320 8733.42835 7151.68483 1869.67379
## 751 752 753 754 755 756
## 8093.42129 12379.09374 1359.00480 7966.27380 6523.79481 10312.67934
## 757 758 759 760 761 762
## 4683.76662 13140.92970 8291.11504 4070.23255 2259.57719 7048.26063
## 763 764 765 766 767 768
## 2953.05057 14473.34272 8200.20289 7741.26613 3856.44013 3412.08786
## 769 770 771 772 773 774
## 2762.64877 2666.17386 2462.00492 6781.55643 702.41049 7619.96849
## 775 776 777 778 779 780
## 1346.09063 8829.30875 3615.83755 3009.35290 11354.89319 6024.44669
## 781 782 783 784 785 786
## 11847.21598 2567.57328 11741.00184 3072.79663 7052.14636 8248.67622
## 787 788 789 790 791 792
## 9262.37674 324.16574 6905.59807 6883.60042 981.80945 2659.17710
## 793 794 795 796 797 798
## 2987.63317 6165.34358 678.72588 2973.70773 7256.11397 652.51630
## 799 800 801 802 803 804
## 5426.10430 2073.65504 704.32273 7871.64520 833.84284 2388.01142
## 805 806 807 808 809 810
## 4631.18837 7736.58228 1446.39665 2228.64869 3782.09995 2968.15453
## 811 812 813 814 815 816
## 6329.20973 1184.43725 7095.56803 3689.39720 1657.39611 3359.91732
## 817 818 819 820 821 822
## 3104.63683 6319.54233 16098.20045 1286.75140 2448.16200 7151.03343
## 823 824 825 826 827 828
## 1812.08563 7282.49829 796.18708 1018.13128 4367.80955 9552.60092
## 829 830 831 832 833 834
## 320.58075 5014.31571 2175.57369 13607.53840 1309.29374 1943.01198
## 835 836 837 838 839 840
## 2838.17377 6721.53253 6692.52784 2263.05288 8807.85344 4299.69979
## 841 842 843 844 845 846
## 4698.34779 697.07077 6161.32539 2430.47719 1344.27724 4916.19198
## 847 848 849 850 851 852
## 4561.49562 4731.46379 14254.28150 1594.26815 6789.11327 4911.51739
## 853 854 855 856 857 858
## 7534.55552 4736.37197 6181.82000 2824.99711 9283.46171 10304.63997
## 859 860 861 862 863 864
## 4466.80440 8411.92320 8030.46522 6866.57772 13267.53678 4625.11369
## 865 866 867 868 869 870
## 1947.28316 1965.50128 3342.89258 2009.70977 1692.64166 814.73085
## 871 872 873 874 875 876
## 3210.84753 7778.91096 5971.25129 5978.98187 13059.79408 3707.44354
## 877 878 879 880 881 882
## 10880.90929 1360.40329 5210.14457 6118.81300 6697.86825 1356.96207
## 883 884 885 886 887 888
## 8529.44029 6590.63843 7194.16793 8338.04877 4982.96438 7118.46585
## 889 890 891 892 893 894
## 2644.51957 953.63157 10519.60681 2543.56180 6062.76946 24031.21664
## 895 896 897 898 899 900
## 4178.88944 1377.17309 2260.45841 7671.19631 1621.77240 2007.28538
## 901 902 903 904 905 906
## 5360.54406 1908.49470 15027.02909 7364.75486 6408.42927 3626.03917
## 907 908 909 910 911 912
## 17349.28872 9327.73831 2491.48956 1226.35758 6992.74554 4928.43427
## 913 914 915 916 917 918
## 15383.01454 6007.19291 2567.57328 13566.87325 8468.54954 871.71047
## 919 920 921 922 923 924
## 15247.24378 1576.62771 4776.02284 1191.81641 4935.84745 9710.22193
## 925 926 927 928 929 930
## 6866.57772 4561.49562 9207.51095 1257.11628 1907.25291 2852.06361
## 931 932 933 934 935 936
## 4174.23584 6543.77244 3861.21578 4329.01048 6889.07086 3248.50561
## 937 938 939 940 941 942
## 3090.98358 7957.54352 1617.99371 4702.69996 3019.26174 796.86890
## 943 944 945 946 947 948
## 3884.22397 1540.21018 4898.86822 29548.78954 2789.15147 1596.04757
## 949 950 951 952 953 954
## 6684.81652 9262.37674 11094.39188 7919.49784 10221.11523 5329.88558
## 955 956 957 958 959 960
## 10850.09252 9280.53471 6715.65990 6400.94194 1541.15678 14848.41298
## 961 962 963 964 965 966
## 7118.46585 7626.33003 3190.36798 2590.60932 3437.08850 7103.50084
## 967 968 969 970 971 972
## 8386.74313 1419.54106 2396.54667 511.93962 4419.32999 7111.84326
## 973 974 975 976 977 978
## 5124.08513 10836.75179 8314.26819 11724.96670 9336.18291 1901.39620
## 979 980 981 982 983 984
## 1194.07886 11485.34056 5846.34785 960.90262 1645.55351 5843.33345
## 985 986 987 988 989 990
## 7147.28264 3912.49163 3588.08192 2853.13449 1658.83021 7239.40283
## 991 992 993 994 995 996
## 1027.22952 10393.37503 1464.55371 4200.52976 6495.10090 9292.97620
## 997 998 999 1000 1001 1002
## 7917.13154 4547.19807 7540.97892 4673.02261 656.80392 4982.97912
## 1003 1004 1005 1006 1007 1008
## 19716.09813 9649.04266 1405.72091 771.69306 13026.12228 4045.69044
## 1009 1010 1011 1012 1013 1014
## 4909.69949 4238.82222 628.80379 1551.67586 2295.90668 4972.17290
## 1015 1016 1017 1018 1019 1020
## 4513.99466 1661.73796 5166.52684 4412.43775 3824.72988 6007.17006
## 1021 1022 1023 1024 1025 1026
## 1867.35853 542.93204 1725.22536 1278.01451 7301.08768 8851.86979
## 1027 1028 1029 1030 1031 1032
## 7993.74541 15483.23390 2374.38639 4834.76135 1803.71425 2535.76785
## 1033 1034 1035 1036 1037 1038
## 8573.47011 23845.70710 2563.83710 2917.45700 24358.80212 7499.20873
## 1039 1040 1041 1042 1043 1044
## 1600.95363 1862.61377 586.77141 1630.27458 2423.10519 2786.29662
## 1045 1046 1047 1048 1049 1050
## 1131.59356 608.57053 1598.41673 7834.43197 1966.06490 6165.34358
## 1051 1052 1053 1054 1055 1056
## 3912.49163 10180.34321 8241.67226 1743.14522 469.35587 1119.40147
## 1057 1058 1059 1060 1061 1062
## 8690.75572 1236.73264 2916.92540 2677.21453 802.00737 3329.39704
## 1063 1064 1065 1066 1067 1068
## 1321.50101 1480.35594 3840.46437 6145.59325 14027.77713 11913.87014
## 1069 1070 1071 1072 1073 1074
## 8553.42734 7523.98480 9990.39519 3105.11127 262.69840 4277.58001
## 1075 1076 1077 1078 1079 1080
## 1019.15644 3899.63101 1101.78846 31092.14132 506.18778 6716.79935
## 1081 1082 1083 1084 1085 1086
## 2321.93732 658.85681 3678.85550 10450.28645 5336.00704 5233.73581
## 1087 1088 1089 1090 1091 1092
## 10198.30162 11104.48783 2866.46809 1255.47069 2038.82262 2802.79957
## 1093 1094 1095 1096 1097 1098
## 3390.77822 5815.08645 2322.92350 1545.48460 5117.24243 27021.94109
## 1099 1100 1101 1102 1103 1104
## 13978.83807 7389.26161 3459.01774 5432.31536 3153.03154 3450.46327
## 1105 1106 1107 1108 1109 1110
## 2768.09230 5858.79439 1055.54186 10727.56246 1525.07136 936.02464
## 1111 1112 1113 1114 1115 1116
## 5303.34582 6861.69279 7527.36948 1059.87804 1205.42291 7300.57390
## 1117 1118 1119 1120 1121 1122
## 2359.28727 1141.00340 1790.77204 9721.73309 11042.07745 2196.24853
## 1123 1124 1125 1126 1127 1128
## 5945.99294 7457.67187 8463.95303 660.95776 1753.67646 12923.54577
## 1129 1130 1131 1132 1133 1134
## 4631.18837 2446.32898 1960.08349 1427.06355 717.46036 1455.45413
## 1135 1136 1137 1138 1139 1140
## 7484.55360 1581.01485 888.20199 3433.18492 6099.73892 3426.57992
## 1141 1142 1143 1144 1145 1146
## 8496.84882 2141.41551 15219.68351 18639.52145 4166.98273 5910.77359
## 1147 1148 1149 1150 1151 1152
## 2560.85587 2859.48129 5581.69371 2873.10451 7524.60411 3241.44390
## 1153 1154 1155 1156 1157 1158
## 4443.34360 2283.09457 1439.62914 2114.79233 3175.27421 3646.02470
## 1159 1160 1161 1162 1163 1164
## 4976.07552 5620.10334 770.68482 3228.11512 13379.34902 1804.07001
## 1165 1166 1167 1168 1169 1170
## 8913.00763 5543.89176 3626.61507 4730.33839 820.08280 7796.57988
## 1171 1172 1173 1174 1175 1176
## 17590.35577 7011.94742 2107.72266 6250.29609 3680.18981 2139.56518
## 1177 1178 1179 1180 1181 1182
## 4563.14682 7323.86421 10658.35848 6172.54190 3749.47920 5318.27382
## 1183 1184 1185 1186 1187 1188
## 2163.64209 3524.83932 5878.79339 3026.57217 5429.59491 18639.52145
## 1189 1190 1191 1192 1193 1194
## 11348.08373 2718.19378 4496.70072 11654.06930 2008.82398 1828.98984
## 1195 1196 1197 1198 1199 1200
## 5151.49801 2742.54883 4184.20745 21997.57674 7034.92060 3944.08480
## 1201 1202 1203 1204 1205 1206
## 9958.22873 5605.98462 14991.86521 11076.90257 15556.25846 313.64342
## 1207 1208 1209 1210 1211 1212
## 8999.28848 2324.48127 16582.83445 10216.94872 92.68033 13480.67822
## 1213 1214 1215 1216 1217 1218
## 5019.42803 1713.09885 2611.59312 1345.96363 1043.81666 9280.53471
## 1219 1220 1221 1222 1223 1224
## 8727.14870 2759.58067 2804.51064 6388.49891 6077.69870 3409.59719
## 1225 1226 1227 1228 1229 1230
## 1875.22145 3316.89493 558.57041 5934.87245 1009.89614 7996.01057
## 1231 1232 1233 1234 1235 1236
## 6864.51073 2631.21743 7338.87550 1757.05680 1986.11464 4836.57847
## 1237 1238 1239 1240 1241 1242
## 3564.18137 2484.52919 10576.57209 4195.84702 4457.97787 18081.12607
## 1243 1244 1245 1246 1247 1248
## 5772.69869 1246.40779 1884.06206 8601.02300 4938.34436 6598.49523
## 1249 1250 1251 1252 1253 1254
## 14689.64554 3752.87941 8128.86098 5513.76263 3354.45513 26178.58682
## 1255 1256 1257 1258 1259 1260
## 6495.10090 2334.02266 1470.32043 1886.86196 3300.73081 2215.35162
## 1261 1262 1263 1264 1265 1266
## 15685.58048 10950.07620 8793.52511 4296.29193 17118.49003 17764.99670
## 1267 1268 1269 1270 1271 1272
## 6382.72848 3486.46615 9438.65325 1482.91188 1522.94751 468.17776
## 1273 1274 1275 1276 1277 1278
## 5765.98393 5118.13179 2272.36117 4110.22906 2162.83465 6733.95353
## 1279 1280 1281 1282 1283 1284
## 1296.18852 2801.38168 4836.13931 8841.29604 2062.11243 2841.47129
## 1285 1286 1287 1288 1289 1290
## 2662.08516 9668.31478 2246.76322 6626.08984 8839.36792 10886.75741
## 1291 1292 1293 1294 1295 1296
## 5348.60718 2415.95301 4948.66007 26983.52695 6446.60640 2985.77934
## 1297 1298 1299 1300 1301 1302
## 194.44285 3082.67179 10164.74110 78.07834 6013.76986 1536.32859
## 1303 1304 1305 1306 1307 1308
## 912.89633 9867.03424 1662.29722 8301.59157 7702.86067 6715.65990
## 1309 1310 1311 1312 1313 1314
## 9837.49616 1080.37162 18709.69268 4049.14489 7417.56071 487.69663
## 1315 1316 1317 1318 1319 1320
## 3033.57695 880.62721 3645.11182 14727.67635 5005.94165 3807.30215
## 1321 1322 1323 1324 1325 1326
## 9721.73309 9262.37674 186.48657 5087.13153 5677.21437 6721.18690
## 1327 1328 1329 1330 1331 1332
## 7975.01739 1716.02068 4626.01172 3501.18279 894.66958 3010.88639
## 1333 1334 1335 1336 1337 1338
## 7402.62721 8780.26142 6465.66395 4895.14133 1947.28979 2747.41241
## 1339 1340 1341 1342 1343 1344
## 3564.18137 19306.10688 7776.92847 7107.84060 4771.02387 4829.14022
## 1345 1346 1347 1348 1349 1350
## 3186.46972 6749.68661 1035.61633 3276.32672 2164.26775 11752.96203
## 1351 1352 1353 1354 1355 1356
## 12265.60802 7420.78298 12265.60802 3912.49163 3287.62936 5401.80511
## 1357 1358 1359 1360 1361 1362
## 7325.35942 11276.54068 1369.96183 2039.15205 1551.48458 9113.53784
## 1363 1364 1365 1366 1367 1368
## 5702.06235 2422.14819 8147.55346 8222.27349 405.10883 16784.05908
## 1369 1370 1371 1372 1373 1374
## 5780.19971 9322.52307 2377.48515 9819.23024 3954.33127 4594.60763
## 1375 1376 1377 1378 1379 1380
## 2793.45796 9742.00106 1737.17403 10392.45857 5476.15029 3032.38414
## 1381 1382 1383 1384 1385 1386
## 1444.01272 8774.86974 1546.29086 905.82964 3836.73041 2350.87348
## 1387 1388 1389 1390 1391 1392
## 1248.87214 8471.93769 5458.15981 10606.69164 2579.20321 11530.57122
## 1393 1394 1395 1396 1397 1398
## 29657.94035 5731.66151 5571.39890 8911.37123 8427.06810 1870.56368
## 1399 1400 1401 1402 1403 1404
## 4911.81371 1135.93140 739.19859 3561.13596 18223.96609 1356.81515
## 1405 1406 1407 1408 1409 1410
## 4357.16689 5386.85960 10213.32919 10356.23866 1182.87991 10229.89836
## 1411 1412 1413 1414 1415 1416
## 8489.53405 3244.45391 3060.23193 7709.51312 4273.89328 3093.58563
## 1417 1418 1419 1420 1421 1422
## 2273.04529 3368.87646 4242.37022 11156.94785 2728.39413 5308.37575
## 1423 1424 1425 1426 1427 1428
## 6925.62413 443.17604 3135.90648 981.96368 2145.95617 7324.84369
## 1429 1430 1431 1432 1433 1434
## 5382.16545 6168.50167 10338.67483 2199.70565 7869.06200 910.86014
## 1435 1436 1437 1438 1439 1440
## 1197.33916 1944.67117 2730.96159 14830.85831 2519.59962 12381.58975
## 1441 1442 1443 1444 1445 1446
## 3141.15717 2267.59121 20604.26420 4454.33180 1726.75003 1847.10729
## 1447 1448 1449 1450 1451 1452
## 2295.74905 6242.18862 8601.02300 1812.90182 1917.81751 4270.25296
## 1453 1454 1455 1456 1457 1458
## 7369.88179 2928.97945 8136.99466 900.58071 6721.53253 2405.38391
## 1459 1460 1461 1462 1463 1464
## 3611.14686 1038.21685 1505.37154 13480.67822 4004.70226 6000.95811
## 1465 1466 1467 1468 1469 1470
## 6696.97108 8080.76403 2474.56447 6075.33245 5116.91073 10239.32256
## 1471 1472 1473 1474 1475 1476
## 11715.02569 15044.27884 8744.29485 2030.52706 5276.09400 11811.40033
## 1477 1478 1479 1480 1481 1482
## 3898.90905 2426.06778 16124.20984 8365.21857 2165.67041 3526.61710
## 1483 1484 1485 1486 1487 1488
## 4724.40513 1381.90287 7152.53470 1175.08724 4394.62743 4809.18016
## 1489 1490 1491 1492 1493 1494
## 6446.60640 7665.92434 14556.11624 4181.20865 2600.23846 17240.87381
## 1495 1496 1497 1498 1499 1500
## 1169.42226 8865.78979 5731.11668 3086.10218 2587.64327 2553.26421
## 1501 1502 1503 1504 1505 1506
## 4017.44192 1274.61612 2651.40485 6781.55643 3767.83271 4334.91020
## 1507 1508 1509 1510 1511 1512
## 1876.79632 8601.02300 1938.48362 1262.67675 3555.51775 10933.32354
## 1513 1514 1515 1516 1517 1518
## 10015.64186 7854.38037 2558.43563 8592.37070 3941.18683 6415.15113
## 1519 1520 1521 1522 1523 1524
## 9292.97620 1113.84193 27195.83782 7706.29436 2634.48613 5581.58420
## 1525 1526 1527 1528 1529 1530
## 4921.91931 4264.91744 1909.16143 958.43064 3680.22755 10132.22271
## 1531 1532 1533 1534 1535 1536
## 9993.02007 3642.84502 1252.30692 2126.87696 1434.47541 7421.65110
## 1537 1538 1539 1540 1541 1542
## 6822.87710 11050.06292 1387.68058 5014.43511 4607.50832 5603.27830
## 1543 1544 1545 1546 1547 1548
## 7624.31229 1155.33507 14281.79747 6856.15098 7143.69108 1525.26224
## 1549 1550 1551 1552 1553 1554
## 14946.79966 1025.78251 6040.17173 7166.74262 1192.89354 1940.37518
## 1555 1556 1557 1558 1559 1560
## 2278.99927 3018.57943 5005.94165 1246.88502 1459.76142 2496.10149
## 1561 1562 1563 1564 1565 1566
## 14830.58383 3279.73439 4635.51414 2094.23908 5082.68382 2224.91103
## 1567 1568 1569 1570 1571 1572
## 5436.53925 3951.32537 3462.14491 980.07778 7020.52269 1067.59985
## 1573 1574 1575 1576 1577 1578
## 14293.47793 6139.86587 6352.83859 9133.39588 7576.04357 10737.42139
## 1579 1580 1581 1582 1583 1584
## 1906.54632 5156.52850 2112.24177 853.21886 8410.55464 9262.37674
## 1585 1586 1587 1588 1589 1590
## 8757.76734 7093.55382 8366.49157 7308.50430 4215.07751 4831.16493
## 1591 1592 1593 1594 1595 1596
## 3901.40356 6352.83859 4626.01172 7483.06141 6235.83764 6959.71609
## 1597 1598 1599 1600 1601 1602
## 5040.29690 4234.09593 5802.14765 8408.24514 14647.99834 2446.51113
## 1603 1604 1605 1606 1607 1608
## 13544.62124 5875.03995 284.16068 5684.05668 6299.06769 20766.92539
## 1609 1610 1611 1612 1613 1614
## 9319.76072 4433.48174 5616.38436 9356.39891 7424.20649 1725.41023
## 1615 1616 1617 1618 1619 1620
## 8551.49347 1045.70641 18190.65372 14983.11518 5703.31871 14228.21378
## 1621 1622 1623 1624 1625 1626
## 2983.06963 6224.54980 8955.04879 7024.97942 5113.94754 4545.30523
## 1627 1628 1629 1630 1631 1632
## 4629.15326 10333.63278 12761.47192 3687.97811 7128.36274 3862.05988
## 1633 1634 1635 1636 1637 1638
## 646.40013 8274.19316 305.44793 2486.07971 1684.17580 2368.23853
## 1639 1640 1641 1642 1643 1644
## 2373.63185 1989.29509 9077.48423 10033.08449 11744.22325 2894.16414
## 1645 1646 1647 1648 1649 1650
## 5077.78122 25717.20258 1386.57287 1553.31958 1508.17207 13390.01272
## 1651 1652 1653 1654 1655 1656
## 4863.12835 1521.31976 8970.42292 745.01656 10451.17085 3844.52073
## 1657 1658 1659 1660 1661 1662
## 5765.14614 592.35739 6287.49937 7514.76413 7395.90694 7150.07207
## 1663 1664 1665 1666 1667 1668
## 898.65363 11477.96272 2600.59060 10725.84450 2438.01714 4099.14242
## 1669 1670 1671 1672 1673 1674
## 6889.07086 10643.09577 2478.11428 1772.86054 2105.36184 9248.73784
## 1675 1676 1677 1678 1679 1680
## 7195.25746 1754.43878 3084.25084 8087.39535 1460.36294 8092.14727
## 1681 1682 1683 1684 1685 1686
## 8128.06029 8118.26387 4748.77279 2064.08485 3224.73134 4157.13409
## 1687 1688 1689 1690 1691 1692
## 3078.10631 5954.67384 909.57573 4865.92453 1970.19401 1815.76553
## 1693 1694 1695 1696 1697 1698
## 3968.09179 12698.59372 13102.36952 570.41626 5988.20683 4426.97514
## 1699 1700 1701 1702 1703 1704
## 2898.45874 7008.74857 1671.76251 3829.48166 7308.50430 7514.76413
## 1705 1706 1707 1708 1709 1710
## 6561.44543 850.78965 14758.81071 1632.48564 7147.28264 883.34941
## 1711 1712 1713 1714 1715 1716
## 10859.18982 4692.16527 5262.43486 1420.37273 5513.76263 1805.21361
## 1717 1718 1719 1720 1721 1722
## 14798.83394 5065.40059 11810.39058 5744.43513 2373.95079 1282.84635
## 1723 1724 1725 1726 1727 1728
## 1734.26176 10159.45526 14812.21576 6021.23323 2910.79675 2345.04257
## 1729 1730 1731 1732 1733 1734
## 14685.75090 11104.34532 2195.05061 3715.92369 8193.01193 1165.68739
## 1735 1736 1737 1738 1739 1740
## 3420.06462 3404.07404 5020.14424 6740.33911 9402.89852 3422.80566
## 1741 1742 1743 1744 1745 1746
## 926.42415 1914.83237 8082.93717 736.86436 8233.92116 7147.28264
## 1747 1748 1749 1750 1751 1752
## 5413.92256 5416.05125 4355.15419 5833.68803 1248.37129 1204.39140
## 1753 1754 1755 1756 1757 1758
## 9874.84168 4630.43620 6654.55698 4970.03148 4826.84806 5151.49801
## 1759 1760 1761 1762 1763 1764
## 7196.23139 955.87873 1281.91563 10751.50367 2348.37809 827.70358
## 1765 1766 1767 1768 1769 1770
## 1483.76383 2346.81267 6468.77209 637.94885 7924.95125 4974.33148
## 1771 1772 1773 1774 1775 1776
## 1807.99246 189.56697 13413.61695 463.85819 3546.49620 1166.84185
## 1777 1778 1779 1780 1781 1782
## 1879.08794 8411.92320 4273.89328 952.94773 8741.97456 4994.72400
## 1783 1784 1785 1786 1787 1788
## 16353.25845 468.64137 2379.16822 13115.07945 1942.18967 2063.86037
## 1789 1790 1791 1792 1793 1794
## 772.09029 9050.24521 5389.36524 5294.66782 1071.98313 5513.76263
## 1795 1796 1797 1798 1799 1800
## 12933.41265 13839.11640 6328.48895 7975.21857 8997.35334 14791.81387
## 1801 1802 1803 1804 1805 1806
## 4357.16689 6626.08984 8897.00895 6328.48895 4633.95329 11891.59145
## 1807 1808 1809 1810 1811 1812
## 4921.91931 3653.29666 2030.90065 2434.90451 7739.34928 5357.15447
## 1813 1814 1815 1816 1817 1818
## 5126.65983 2800.79496 3404.74925 5529.21687 1314.14456 3181.55455
## 1819 1820 1821 1822 1823 1824
## 7871.64520 6914.75303 520.48414 14191.39108 12855.25096 3458.28997
## 1825 1826 1827 1828 1829 1830
## 2805.95796 10019.91670 453.96878 2866.96656 2631.81488 4212.07679
## 1831 1832 1833 1834 1835 1836
## 6626.08984 8893.42882 8278.10213 851.70090 2640.19177 7032.94148
## 1837 1838 1839 1840 1841 1842
## 1828.41602 9597.92920 7795.35546 5320.16239 11663.33833 831.85990
## 1843 1844 1845 1846 1847 1848
## 3718.83896 13405.10469 6341.86469 615.96304 5267.87477 2525.46984
## 1849 1850 1851 1852 1853 1854
## 1113.08174 3170.59831 2128.04704 11839.11870 2243.72730 8175.78696
## 1855 1856 1857 1858 1859 1860
## 620.07609 5825.48377 3963.18408 6310.79892 4485.27844 1461.80249
## 1861 1862 1863 1864 1865 1866
## 7002.89890 2833.72224 11906.47417 1278.40219 14685.43134 9409.97090
## 1867 1868 1869 1870 1871 1872
## 9310.63563 768.76526 1334.97342 3200.67203 3777.25682 6790.53513
## 1873 1874 1875 1876 1877 1878
## 7906.42398 8031.36210 3005.34500 3564.18137 4990.42203 3288.10310
## 1879 1880 1881 1882 1883 1884
## 2968.15453 2440.90180 2868.29030 2756.88236 2554.17933 7627.15066
## 1885 1886 1887 1888 1889 1890
## 7419.34150 701.01688 793.82878 5082.06136 742.96222 5731.66151
## 1891 1892 1893 1894 1895 1896
## 5921.66557 2221.92633 2257.92794 1263.40704 5707.23890 13775.51191
## 1897 1898 1899 1900 1901 1902
## 1902.28889 10612.10915 10874.67952 5357.15447 5971.95593 1369.19178
## 1903 1904 1905 1906 1907 1908
## 616.88703 4546.91432 1517.30121 3109.64809 772.04823 842.08539
## 1909 1910 1911 1912 1913 1914
## 13048.65917 6088.58903 8833.99839 445.34756 6271.81297 1127.43682
## 1915 1916 1917 1918 1919 1920
## 4011.82960 5362.81209 2221.51091 7147.28264 2375.92748 13740.80950
## 1921 1922 1923 1924 1925 1926
## 8780.26142 6591.64398 3850.60898 2186.54041 9516.12798 7704.76840
## 1927 1928 1929 1930 1931 1932
## 603.27698 8540.51444 1649.34744 858.28121 2968.15453 8222.27349
## 1933 1934 1935 1936 1937 1938
## 502.11162 1160.63832 11920.31815 845.69317 2234.11813 6352.83859
## 1939 1940 1941 1942 1943 1944
## 1022.90987 2290.05819 5046.41533 10309.64250 2438.26388 3411.29435
## 1945 1946 1947 1948 1949 1950
## 1866.58048 2837.36561 1821.00417 5933.35310 9837.49616 8157.20434
## 1951 1952 1953 1954 1955 1956
## 9115.16425 625.21998 6589.42134 3176.39477 1259.57638 5645.69969
## 1957 1958 1959 1960 1961 1962
## 9437.98113 3204.50711 1407.06262 3406.78326 7060.66750 3748.48823
## 1963 1964 1965 1966 1967 1968
## 10818.87421 8333.07459 2506.06345 12419.08920 7178.21966 7821.64355
## 1969 1970 1971 1972 1973 1974
## 4253.38318 5689.92659 1420.26694 6495.10090 3581.91828 7605.69205
## 1975 1976 1977 1978 1979 1980
## 1162.93594 1567.05846 6233.67279 1379.43238 2449.64580 204.16648
## 1981 1982 1983 1984 1985 1986
## 9977.86613 9457.08596 868.83840 4314.26803 8200.15517 2549.26025
## 1987 1988 1989 1990 1991 1992
## 2239.40771 1830.87950 627.53934 7818.23035 1617.22137 3673.61405
## 1993 1994 1995 1996 1997 1998
## 1533.94309 2940.48202 8439.80977 2968.87057 8882.49835 11613.43407
## 1999 2000
## 729.94988 7709.51312
# Tableau croisé et test du Chi² --------
tab <- xtabs(poids ~ sexe + sport, data = hdv2003)
tab
## sport
## sexe Non Oui
## Homme 2850210 2299173
## Femme 3864550 2057293
rprop(tab)
## sport
## sexe Non Oui Total
## Homme 55.4 44.6 100.0
## Femme 65.3 34.7 100.0
## Ensemble 60.7 39.3 100.0
chisq.test(tab) # bad !!!!
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: tab
## X-squared = 113312, df = 1, p-value < 2.2e-16
tab <- svytable(~ sexe + sport, design = dp)
tab
## sport
## sexe Non Oui
## Homme 2850210 2299173
## Femme 3864550 2057293
rprop(tab)
## sport
## sexe Non Oui Total
## Homme 55.4 44.6 100.0
## Femme 65.3 34.7 100.0
## Ensemble 60.7 39.3 100.0
svychisq(~ sexe + sport, design = dp)
##
## Pearson's X^2: Rao & Scott adjustment
##
## data: svychisq(~sexe + sport, design = dp)
## F = 12.444, ndf = 1, ddf = 1999, p-value = 0.0004289
svytable(~ sexe + sport, design = dp_grappes)
## sport
## sexe Non Oui
## Homme 2850210 2299173
## Femme 3864550 2057293
svychisq(~ sexe + sport, design = dp_grappes)
##
## Pearson's X^2: Rao & Scott adjustment
##
## data: svychisq(~sexe + sport, design = dp_grappes)
## F = 19.165, ndf = 1, ddf = 24, p-value = 0.0002021
svychisq(~ sexe + sport, design = dp_strates)
##
## Pearson's X^2: Rao & Scott adjustment
##
## data: svychisq(~sexe + sport, design = dp_strates)
## F = 12.45, ndf = 1, ddf = 1997, p-value = 0.0004274
svychisq(~ sexe + sport, design = dp_strates_grappes)
##
## Pearson's X^2: Rao & Scott adjustment
##
## data: svychisq(~sexe + sport, design = dp_strates_grappes)
## F = 22.141, ndf = 1, ddf = 22, p-value = 0.0001078
# gtsummary::tbl_svysummary ------
library(gtsummary)
dp %>%
tbl_svysummary(include = c("sexe", "sport", "cuisine"))
## Warning: The `.dots` argument of `group_by()` is deprecated as of dplyr 1.0.0.
Characteristic | N = 11,071,2261 |
---|---|
sexe | |
Homme | 5,149,382 (47%) |
Femme | 5,921,844 (53%) |
sport | |
Non | 6,714,760 (61%) |
Oui | 4,356,466 (39%) |
cuisine | |
Non | 6,356,851 (57%) |
Oui | 4,714,376 (43%) |
1
n (%)
|
dp %>%
tbl_svysummary(
include = c("sexe", "sport", "cuisine"),
by = "sexe",
statistic = all_categorical() ~ "{p}% (obs. : {n_unweighted})"
) %>%
modify_header(update = all_stat_cols() ~ "**{level}**, N = {n_unweighted}") %>%
add_overall(last = TRUE, col_label = "**Overall**, N = {N_unweighted}") %>%
add_p()
Characteristic | Homme, N = 8991 | Femme, N = 11011 | Overall, N = 20001 | p-value2 |
---|---|---|---|---|
sport | <0.001 | |||
Non | 55% (obs. : 530) | 65% (obs. : 747) | 61% (obs. : 1,277) | |
Oui | 45% (obs. : 369) | 35% (obs. : 354) | 39% (obs. : 723) | |
cuisine | <0.001 | |||
Non | 69% (obs. : 629) | 48% (obs. : 490) | 57% (obs. : 1,119) | |
Oui | 31% (obs. : 270) | 52% (obs. : 611) | 43% (obs. : 881) | |
1
% (obs. : n_unweighted)
2
chi-squared test with Rao & Scott's second-order correction
|
# Graphiques ggplot2 ------
library(GGally)
## Registered S3 method overwritten by 'GGally':
## method from
## +.gg ggplot2
ggplot(hdv2003) +
aes(x = sexe, fill = sport, weight = poids, by = sexe) +
geom_bar(position = "fill") +
geom_text(stat = "prop", position = position_fill(.5))
questionr::ggsurvey(dp) +
aes(x = sexe, fill = sport, by = sexe) +
geom_bar(position = "fill") +
geom_text(stat = "prop", position = position_fill(.5))