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1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 405.002592353822, 
479.360356183825, 526.548105855472, 810.005184707644, 312.321528531308, 
930.961115757095, 567.383058387095, 475.323944260643, 1226.91439266118, 
517.086839792615, 1200.2669656949, 810.005184707644, 656.723784884795, 
605.370463928298, 668.467435759576, 558.112457492436, 793.751055244424, 
479.360356183825, 1226.91439266118, 1606.54816212786, 1657.48609449633, 
300.803580980276, 605.370463928298, 1140.55078447979, 669.102760422943, 
810.005184707644, 1657.48609449633, 305.569853371963, 2994.30343152033, 
762.922030382216, 479.360356183825, 1147.36030437824, 668.467435759576, 
517.086839792615, 479.360356183825, 399.141865860217, 656.723784884795, 
913.364738988386, 312.321528531308, 569.10576379231, 775.630259688922, 
1207.22952429547, 1053.09621171094, 1140.55078447979, 314.857225320909, 
668.467435759576, 2416.57081451012, 573.680152189121, 396.875527622212, 
605.370463928298, 1036.3159447043, 3088.62283807823, 569.10576379231, 
1140.55078447979, 2416.57081451012, 1147.36030437824, 762.922030382216, 
702.064141140629, 351.032070570315, 629.714450641817, 517.086839792615, 
1996.20228768022, 828.743047248167, 475.323944260643, 920.185794495882, 
793.751055244424, 796.08788273764, 1197.42559758065, 405.002592353822, 
418.584343119327, 300.803580980276, 654.76828203733, 2740.09421696516, 
351.032070570315, 1069.6202614693, 2094.91447516374, 399.141865860217, 
654.76828203733, 1003.65414063441, 573.680152189121, 851.074587580641, 
913.364738988386, 762.922030382216, 1034.17367958523, 573.680152189121, 
479.360356183825, 3208.8607844079, 654.76828203733, 908.055695892447, 
328.361892442398, 1036.3159447043, 702.064141140629, 613.457196330588, 
601.607161960551, 567.383058387095, 479.360356183825, 306.261087672466, 
920.185794495882, 654.76828203733, 828.743047248167, 312.321528531308, 
2376.6523963739, 434.064724265343, 828.743047248167, 2051.48554127643, 
629.714450641817, 1213.95583923136, 558.112457492436, 1606.54816212786, 
300.803580980276, 1140.55078447979, 1002.70115363936, 620.640743838063, 
558.112457492436, 334.551380211471, 3564.97859456085, 654.76828203733, 
300.803580980276, 691.673925213658, 798.283731720433, 1826.72947797677, 
1588.10460615457, 312.321528531308, 334.233717879788, 798.283731720433, 
518.157972352151, 300.803580980276, 1840.37158899176, 378.802591428053, 
314.857225320909, 902.410742940827, 656.723784884795, 320.984428005494, 
458.504067562676, 2740.09421696516, 434.064724265343, 378.802591428053, 
300.803580980276, 1147.36030437824, 526.548105855472, 3564.97859456085, 
846.139135570888, 982.152423055995, 3176.20921230913, 654.76828203733, 
1138.21152758462, 300.803580980276, 601.607161960551, 300.803580980276, 
913.364738988386, 656.723784884795, 530.725255158427, 691.673925213658, 
669.102760422943, 762.922030382216, 920.185794495882, 656.723784884795, 
558.112457492436, 334.233717879788, 669.102760422943, 1034.17367958523, 
2486.2291417445, 305.569853371963, 1226.91439266118, 334.233717879788, 
2107.39223484599, 1588.10460615457, 300.803580980276, 300.803580980276, 
1604.43039220395, 1702.14917516128, 796.08788273764, 1207.22952429547, 
828.743047248167, 518.157972352151, 656.723784884795, 530.725255158427, 
837.168686238654, 530.725255158427, 2094.91447516374, 828.743047248167, 
314.857225320909, 334.551380211471, 1226.91439266118, 654.76828203733, 
1826.72947797677, 351.032070570315, 1588.10460615457, 1210.7409278566, 
1453.48622326765, 668.467435759576, 1226.91439266118, 1425.97183278193, 
1147.36030437824, 434.064724265343, 1996.20228768022, 1138.21152758462, 
654.76828203733, 828.743047248167, 668.467435759576, 1207.22952429547, 
517.086839792615, 300.803580980276, 762.922030382216, 668.467435759576, 
3564.97859456085, 1383.34785042732, 300.803580980276, 512.028613666402, 
314.857225320909, 601.607161960551, 793.751055244424, 1692.27827114178, 
803.274081063929, 306.261087672466, 1606.54816212786, 1138.21152758462, 
328.361892442398, 312.321528531308, 378.802591428053, 3564.97859456085, 
399.141865860217, 654.76828203733, 828.743047248167, 944.571675962726, 
669.102760422943, 312.321528531308, 1147.36030437824, 1140.55078447979, 
1147.36030437824, 682.70481822187, 603.614762147734, 1207.22952429547, 
312.321528531308, 405.002592353822, 598.712798790326, 3088.62283807823, 
601.607161960551, 837.168686238654, 1036.3159447043, 762.922030382216, 
1188.32619818695, 712.985916390964, 605.370463928298, 1034.17367958523, 
1606.54816212786, 607.503888530733, 2107.39223484599, 567.383058387095, 
1140.55078447979, 846.139135570888, 558.112457492436, 793.751055244424, 
328.361892442398, 1241.28148767613, 828.743047248167, 1069.6202614693, 
828.743047248167, 1036.3159447043, 434.064724265343, 796.08788273764, 
810.005184707644, 434.064724265343, 1053.696117423, 1069.6202614693, 
1147.36030437824, 810.005184707644, 828.743047248167, 306.261087672466, 
654.76828203733, 1826.72947797677, 1707.31729137693, 518.157972352151, 
378.802591428053, 1588.10460615457, 762.922030382216, 558.112457492436, 
950.647888521286, 530.725255158427, 327.384141018665, 334.551380211471, 
1657.48609449633, 300.803580980276, 1034.17367958523, 798.283731720433, 
1208.28540725506, 1657.48609449633, 2427.91167846272, 300.803580980276, 
1702.14917516128, 327.384141018665, 846.139135570888, 1134.76611677419, 
828.743047248167, 475.323944260643, 558.112457492436, 668.467435759576, 
1053.696117423, 312.321528531308, 300.803580980276, 1213.95583923136, 
300.803580980276, 517.086839792615, 300.803580980276, 594.163099093474, 
913.364738988386, 517.086839792615, 598.712798790326, 1138.21152758462, 
851.074587580641, 603.614762147734, 2994.30343152033, 601.607161960551, 
837.168686238654, 917.008135125352, 1810.8442864432, 762.922030382216, 
1147.36030437824, 605.370463928298, 302.685231964149, 526.945925927366, 
702.064141140629, 668.467435759576, 1551.26051937784, 405.002592353822, 
762.922030382216, 300.803580980276, 2376.6523963739, 3088.62283807823, 
306.261087672466, 668.467435759576, 300.803580980276, 2416.57081451012, 
613.457196330588, 334.551380211471, 501.350576819682, 810.005184707644, 
1138.21152758462, 668.467435759576, 399.141865860217, 1996.20228768022, 
629.714450641817, 1226.91439266118, 1606.54816212786, 930.961115757095, 
1606.54816212786, 1588.10460615457, 1606.54816212786, 913.364738988386, 
920.185794495882, 399.141865860217, 851.074587580641, 479.360356183825, 
1588.10460615457, 300.803580980276, 314.857225320909, 702.064141140629, 
306.728598165294, 334.233717879788, 569.10576379231, 312.321528531308, 
1707.31729137693, 654.76828203733, 334.551380211471, 605.370463928298, 
327.384141018665, 399.141865860217, 1840.37158899176, 1210.7409278566, 
312.321528531308, 301.289126432632, 762.922030382216, 1861.92223151419, 
573.680152189121, 1036.3159447043, 603.614762147734, 1816.11139178489, 
312.321528531308, 620.640743838063, 810.005184707644, 828.743047248167, 
1604.43039220395, 668.467435759576, 300.803580980276, 654.76828203733, 
300.803580980276, 300.803580980276, 1003.65414063441, 2416.57081451012, 
2416.57081451012, 523.728618790936, 2139.2405229386, 613.457196330588, 
668.467435759576, 491.076211527998, 601.607161960551, 378.802591428053, 
517.086839792615, 1707.31729137693, 499.050571920056, 399.141865860217, 
682.70481822187, 300.803580980276, 305.569853371963, 517.086839792615, 
917.008135125352, 3176.20921230913, 328.361892442398, 1604.43039220395, 
1996.20228768022, 1053.696117423, 656.723784884795, 1383.34785042732, 
479.360356183825, 518.157972352151, 1226.91439266118, 1657.48609449633, 
702.064141140629, 475.323944260643, 530.725255158427, 828.743047248167, 
3077.22831191465, 1207.22952429547, 613.457196330588, 775.630259688922, 
1702.14917516128, 1140.55078447979, 601.607161960551, 902.410742940827, 
479.360356183825, 328.361892442398, 1425.97183278193, 1370.04710848258, 
381.461015191108, 762.922030382216, 569.10576379231, 682.70481822187, 
1188.32619818695, 1383.34785042732, 629.714450641817, 1147.36030437824, 
605.370463928298, 656.723784884795, 1692.27827114178, 1707.31729137693, 
762.922030382216, 595.313291433317, 1588.10460615457, 620.640743838063, 
902.410742940827, 300.803580980276, 312.321528531308, 1840.37158899176, 
398.04394136882, 1036.3159447043, 1370.04710848258, 1702.14917516128, 
573.680152189121, 1383.34785042732, 300.803580980276, 1226.91439266118, 
2416.57081451012, 300.803580980276, 2376.6523963739, 328.361892442398, 
341.352409110935, 828.743047248167, 668.467435759576, 1053.696117423, 
334.551380211471, 1210.7409278566, 530.725255158427, 399.141865860217, 
691.673925213658, 381.461015191108, 300.803580980276, 651.097086398014, 
2416.57081451012, 1138.21152758462, 1204.91112159589, 526.945925927366, 
846.139135570888, 1138.21152758462, 803.274081063929, 1826.72947797677, 
1003.65414063441, 312.321528531308, 691.673925213658, 327.384141018665, 
598.712798790326, 606.977919615681, 691.673925213658, 351.297283951577, 
300.803580980276, 598.712798790326, 719.040534275737, 451.205371470414, 
2051.48554127643, 702.064141140629, 1025.74277063822, 2090.51387672074, 
300.803580980276, 828.743047248167, 300.803580980276, 1036.3159447043, 
327.384141018665, 2376.6523963739, 762.922030382216, 1207.22952429547, 
775.630259688922, 1144.38304557332, 479.360356183825, 601.607161960551, 
517.086839792615, 479.360356183825, 1497.15171576017, 1213.95583923136, 
558.112457492436, 719.040534275737, 558.112457492436, 530.725255158427, 
1053.696117423, 399.141865860217, 1609.23162869389, 1425.97183278193, 
1204.91112159589, 1702.14917516128, 810.005184707644, 458.504067562676, 
2119.24604439241, 2994.30343152033, 1840.37158899176, 328.361892442398, 
629.714450641817, 654.76828203733, 530.725255158427, 669.102760422943, 
1034.17367958523, 603.614762147734, 300.803580980276, 828.743047248167, 
629.714450641817, 300.803580980276, 1208.28540725506, 501.350576819682, 
1554.47391705645, 1036.3159447043, 399.141865860217, 305.569853371963, 
793.751055244424, 312.321528531308, 1034.17367958523, 603.614762147734, 
458.504067562676, 3564.97859456085, 1003.65414063441, 601.607161960551, 
837.168686238654, 762.922030382216, 1996.20228768022, 1188.32619818695, 
573.680152189121, 1147.36030437824, 2427.91167846272, 803.274081063929, 
300.803580980276, 691.673925213658, 334.551380211471, 629.714450641817, 
1241.28148767613, 601.607161960551, 351.032070570315, 793.751055244424, 
300.803580980276, 654.76828203733, 381.461015191108, 1425.97183278193, 
1124.83282509616, 314.857225320909, 2376.6523963739, 558.112457492436, 
719.040534275737, 1241.28148767613, 1657.48609449633, 1147.36030437824, 
2107.39223484599, 334.233717879788, 558.112457492436, 434.064724265343, 
479.360356183825, 3208.8607844079, 530.725255158427, 300.803580980276, 
668.467435759576, 605.370463928298, 601.607161960551, 1034.17367958523, 
526.945925927366, 517.086839792615, 603.614762147734, 396.875527622212, 
810.005184707644, 558.112457492436, 762.922030382216, 328.361892442398, 
300.803580980276, 491.076211527998, 917.008135125352, 920.185794495882, 
300.803580980276, 518.157972352151, 1140.55078447979, 351.032070570315, 
1826.72947797677, 434.064724265343, 702.064141140629, 512.028613666402, 
598.712798790326, 1657.48609449633, 1002.70115363936, 810.005184707644, 
300.803580980276, 930.961115757095, 1226.91439266118, 1036.3159447043, 
2107.39223484599, 1657.48609449633, 312.321528531308, 668.467435759576, 
691.673925213658, 762.922030382216, 530.725255158427, 1588.10460615457, 
810.005184707644, 334.551380211471, 2107.39223484599, 1147.36030437824, 
603.614762147734, 418.584343119327, 328.361892442398, 328.361892442398, 
1826.72947797677, 810.005184707644, 328.361892442398, 1147.36030437824, 
920.185794495882, 558.112457492436, 2740.09421696516, 917.008135125352, 
359.520267137869, 702.064141140629, 668.467435759576, 1036.3159447043, 
629.714450641817, 300.803580980276, 3176.20921230913, 312.321528531308, 
603.614762147734, 712.985916390964, 351.032070570315, 828.743047248167, 
1816.11139178489, 570.275392239897, 570.275392239897, 1147.36030437824, 
654.76828203733, 810.005184707644, 1207.22952429547, 479.360356183825, 
1721.04045656737, 1383.34785042732, 300.803580980276, 798.283731720433, 
479.360356183825, 434.064724265343, 668.467435759576, 434.064724265343, 
603.614762147734, 656.723784884795, 3176.20921230913, 702.064141140629, 
1588.10460615457, 1147.36030437824, 1692.27827114178, 828.743047248167, 
1840.37158899176, 3564.97859456085, 601.607161960551, 530.725255158427, 
1003.65414063441, 1383.34785042732, 2585.83321682631, 3208.8607844079, 
1208.28540725506, 458.504067562676, 1207.22952429547, 378.802591428053, 
300.803580980276, 1425.97183278193, 601.607161960551, 475.323944260643, 
381.461015191108, 1721.04045656737, 398.04394136882, 1383.34785042732, 
306.261087672466, 458.504067562676, 1144.38304557332, 300.803580980276, 
378.802591428053, 518.157972352151, 668.467435759576, 1996.20228768022, 
300.803580980276, 381.461015191108, 399.141865860217, 312.321528531308, 
1606.54816212786, 378.802591428053, 620.640743838063, 351.032070570315, 
762.922030382216, 629.714450641817, 605.370463928298, 762.922030382216, 
300.803580980276, 603.614762147734, 810.005184707644, 312.321528531308, 
913.364738988386, 603.614762147734, 314.857225320909, 851.074587580641, 
526.548105855472, 396.875527622212, 1215.00777706147, 1657.48609449633, 
798.283731720433, 654.76828203733, 1657.48609449633, 530.725255158427, 
351.032070570315, 378.802591428053, 803.274081063929, 312.321528531308, 
1034.17367958523, 810.005184707644, 1053.696117423, 762.922030382216, 
396.875527622212, 479.360356183825, 2740.09421696516, 569.10576379231, 
3286.81183075927, 762.922030382216, 1197.42559758065, 828.743047248167, 
334.233717879788, 458.504067562676, 669.102760422943, 1226.91439266118, 
620.640743838063, 1226.91439266118, 327.384141018665, 300.803580980276, 
605.370463928298, 434.064724265343, 1782.48929728042, 2119.24604439241, 
300.803580980276, 762.922030382216, 803.274081063929, 314.857225320909, 
530.725255158427, 300.803580980276, 601.607161960551, 311.792144497738, 
669.102760422943, 860.520228283683, 828.743047248167, 327.384141018665, 
594.163099093474, 328.361892442398, 1138.21152758462, 1826.72947797677, 
530.725255158427, 601.607161960551, 2994.30343152033, 312.321528531308, 
668.467435759576, 669.102760422943, 656.723784884795, 1036.3159447043, 
668.467435759576, 985.085677327194, 803.274081063929, 518.157972352151, 
598.712798790326, 300.803580980276, 2107.39223484599, 902.410742940827, 
846.139135570888, 654.76828203733, 1657.48609449633, 1383.34785042732, 
334.551380211471, 458.504067562676, 669.102760422943, 702.064141140629, 
1036.3159447043, 2409.82224319179, 629.714450641817, 1606.54816212786, 
2075.02177564097, 300.803580980276, 1034.17367958523, 418.584343119327, 
300.803580980276, 1213.95583923136, 1606.54816212786, 328.361892442398, 
668.467435759576, 518.157972352151, 1002.70115363936, 334.551380211471, 
1036.3159447043, 570.275392239897, 312.321528531308, 351.032070570315, 
328.361892442398, 1692.27827114178, 1226.91439266118, 1604.43039220395, 
913.364738988386, 359.520267137869, 656.723784884795, 613.457196330588, 
669.102760422943, 1840.37158899176, 853.658645688465, 762.922030382216, 
2787.35183562765, 1002.70115363936, 1996.20228768022, 944.571675962726, 
2051.48554127643, 334.233717879788, 702.064141140629, 328.361892442398, 
654.76828203733, 1453.48622326765, 328.361892442398, 479.360356183825, 
334.551380211471, 1147.36030437824, 629.714450641817, 1861.92223151419, 
1138.21152758462, 828.743047248167, 396.875527622212, 405.002592353822, 
656.723784884795, 793.751055244424, 300.803580980276, 300.803580980276, 
2094.91447516374, 396.875527622212, 803.274081063929, 669.102760422943, 
682.70481822187, 573.680152189121, 668.467435759576, 1207.22952429547, 
518.157972352151, 300.803580980276, 604.14270362753, 1226.91439266118, 
668.467435759576, 654.76828203733, 917.008135125352, 798.283731720433, 
501.350576819682, 828.743047248167, 930.961115757095, 851.074587580641, 
3375.86290466443, 762.922030382216, 917.008135125352, 762.922030382216, 
319.535092804739, 798.283731720433, 1034.17367958523, 1197.42559758065, 
572.191522786662, 341.352409110935, 613.457196330588, 1588.10460615457, 
1588.10460615457, 702.064141140629, 558.112457492436, 2376.6523963739, 
1370.04710848258, 605.370463928298, 312.321528531308, 828.743047248167, 
451.205371470414, 1657.48609449633, 1702.14917516128, 1207.22952429547, 
629.714450641817, 526.548105855472, 613.457196330588, 598.712798790326, 
1210.7409278566, 920.185794495882, 1996.20228768022, 1826.72947797677, 
668.467435759576, 1588.10460615457, 2376.6523963739, 1657.48609449633, 
798.283731720433, 828.743047248167, 1226.91439266118, 305.569853371963, 
1024.0572273328, 1147.36030437824, 312.321528531308, 1692.27827114178, 
1425.97183278193, 601.607161960551, 1816.11139178489, 1606.54816212786, 
998.101143840112, 573.680152189121, 334.233717879788, 803.274081063929, 
1861.92223151419, 312.321528531308, 328.361892442398, 702.064141140629, 
300.803580980276, 351.032070570315, 762.922030382216, 517.086839792615, 
314.857225320909, 1226.91439266118, 687.756101344014, 319.535092804739, 
654.76828203733, 654.76828203733, 501.350576819682, 651.097086398014, 
1425.97183278193, 668.467435759576, 1657.48609449633, 530.725255158427, 
351.032070570315, 668.467435759576, 3161.08835226899, 798.283731720433, 
654.76828203733, 1702.14917516128, 2119.24604439241, 1053.696117423, 
1226.91439266118, 405.002592353822, 2089.55038690015, 1207.22952429547, 
418.584343119327, 1657.48609449633, 334.233717879788, 828.743047248167, 
328.361892442398, 518.157972352151, 300.803580980276, 598.712798790326, 
2427.91167846272, 396.875527622212, 396.875527622212, 620.640743838063, 
1140.55078447979, 1782.48929728042, 1147.36030437824, 3564.97859456085, 
312.321528531308, 300.803580980276, 306.261087672466, 306.261087672466, 
530.725255158427, 300.803580980276, 300.803580980276, 300.803580980276, 
613.457196330588, 334.233717879788, 312.321528531308, 1047.45723758187, 
810.005184707644, 601.607161960551, 300.803580980276), .Dim = c(1000L, 
2L))

当我

WEIGHT BY wGEDA09pop. 
FREQUENCIES VARIABLES=sex 
  /ORDER=ANALYSIS.

在 SPSS 中进行操作时,结果是 48.5% 男性 (1) 和 51.5% 女性 (2)。

如果我这样做,

round(prop.table(xtabs(test[,2] ~ test[,1], test)),3)

我会得到 49.2% 的男性 (1) 和 50.8% 的女性 (2),测试数据集有 47.8% 的男性和 52.2% 的女性。

有人知道它们为什么不同以及我如何像 SPSS 中那样设置权重,以便该权重对所有程序都有效,例如 pca...?

多谢。 多米尼克

I have a dataset like this:

    structure(c(1, 2, 1, 1, 2, 2, 2, 1, 2, 1, 2, 1, 2, 2, 2, 2, 1, 
2, 2, 1, 2, 2, 2, 2, 1, 1, 2, 1, 1, 1, 2, 2, 2, 1, 2, 1, 2, 1, 
2, 2, 1, 2, 1, 2, 2, 2, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 1, 1, 
2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, 1, 2, 
2, 1, 1, 1, 2, 2, 1, 1, 2, 2, 2, 1, 2, 2, 2, 2, 1, 2, 1, 2, 2, 
1, 2, 2, 1, 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1, 2, 2, 1, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 2, 
2, 1, 2, 1, 2, 1, 2, 1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 2, 1, 2, 2, 
1, 2, 2, 1, 1, 2, 2, 2, 2, 1, 2, 2, 2, 1, 2, 1, 2, 1, 1, 2, 2, 
2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 
2, 2, 1, 1, 2, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 
1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 
2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 2, 2, 1, 1, 2, 2, 1, 
2, 1, 2, 2, 1, 2, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 2, 2, 2, 1, 
2, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 1, 2, 2, 2, 1, 2, 1, 1, 1, 
2, 2, 1, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 1, 
2, 1, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 405.002592353822, 
479.360356183825, 526.548105855472, 810.005184707644, 312.321528531308, 
930.961115757095, 567.383058387095, 475.323944260643, 1226.91439266118, 
517.086839792615, 1200.2669656949, 810.005184707644, 656.723784884795, 
605.370463928298, 668.467435759576, 558.112457492436, 793.751055244424, 
479.360356183825, 1226.91439266118, 1606.54816212786, 1657.48609449633, 
300.803580980276, 605.370463928298, 1140.55078447979, 669.102760422943, 
810.005184707644, 1657.48609449633, 305.569853371963, 2994.30343152033, 
762.922030382216, 479.360356183825, 1147.36030437824, 668.467435759576, 
517.086839792615, 479.360356183825, 399.141865860217, 656.723784884795, 
913.364738988386, 312.321528531308, 569.10576379231, 775.630259688922, 
1207.22952429547, 1053.09621171094, 1140.55078447979, 314.857225320909, 
668.467435759576, 2416.57081451012, 573.680152189121, 396.875527622212, 
605.370463928298, 1036.3159447043, 3088.62283807823, 569.10576379231, 
1140.55078447979, 2416.57081451012, 1147.36030437824, 762.922030382216, 
702.064141140629, 351.032070570315, 629.714450641817, 517.086839792615, 
1996.20228768022, 828.743047248167, 475.323944260643, 920.185794495882, 
793.751055244424, 796.08788273764, 1197.42559758065, 405.002592353822, 
418.584343119327, 300.803580980276, 654.76828203733, 2740.09421696516, 
351.032070570315, 1069.6202614693, 2094.91447516374, 399.141865860217, 
654.76828203733, 1003.65414063441, 573.680152189121, 851.074587580641, 
913.364738988386, 762.922030382216, 1034.17367958523, 573.680152189121, 
479.360356183825, 3208.8607844079, 654.76828203733, 908.055695892447, 
328.361892442398, 1036.3159447043, 702.064141140629, 613.457196330588, 
601.607161960551, 567.383058387095, 479.360356183825, 306.261087672466, 
920.185794495882, 654.76828203733, 828.743047248167, 312.321528531308, 
2376.6523963739, 434.064724265343, 828.743047248167, 2051.48554127643, 
629.714450641817, 1213.95583923136, 558.112457492436, 1606.54816212786, 
300.803580980276, 1140.55078447979, 1002.70115363936, 620.640743838063, 
558.112457492436, 334.551380211471, 3564.97859456085, 654.76828203733, 
300.803580980276, 691.673925213658, 798.283731720433, 1826.72947797677, 
1588.10460615457, 312.321528531308, 334.233717879788, 798.283731720433, 
518.157972352151, 300.803580980276, 1840.37158899176, 378.802591428053, 
314.857225320909, 902.410742940827, 656.723784884795, 320.984428005494, 
458.504067562676, 2740.09421696516, 434.064724265343, 378.802591428053, 
300.803580980276, 1147.36030437824, 526.548105855472, 3564.97859456085, 
846.139135570888, 982.152423055995, 3176.20921230913, 654.76828203733, 
1138.21152758462, 300.803580980276, 601.607161960551, 300.803580980276, 
913.364738988386, 656.723784884795, 530.725255158427, 691.673925213658, 
669.102760422943, 762.922030382216, 920.185794495882, 656.723784884795, 
558.112457492436, 334.233717879788, 669.102760422943, 1034.17367958523, 
2486.2291417445, 305.569853371963, 1226.91439266118, 334.233717879788, 
2107.39223484599, 1588.10460615457, 300.803580980276, 300.803580980276, 
1604.43039220395, 1702.14917516128, 796.08788273764, 1207.22952429547, 
828.743047248167, 518.157972352151, 656.723784884795, 530.725255158427, 
837.168686238654, 530.725255158427, 2094.91447516374, 828.743047248167, 
314.857225320909, 334.551380211471, 1226.91439266118, 654.76828203733, 
1826.72947797677, 351.032070570315, 1588.10460615457, 1210.7409278566, 
1453.48622326765, 668.467435759576, 1226.91439266118, 1425.97183278193, 
1147.36030437824, 434.064724265343, 1996.20228768022, 1138.21152758462, 
654.76828203733, 828.743047248167, 668.467435759576, 1207.22952429547, 
517.086839792615, 300.803580980276, 762.922030382216, 668.467435759576, 
3564.97859456085, 1383.34785042732, 300.803580980276, 512.028613666402, 
314.857225320909, 601.607161960551, 793.751055244424, 1692.27827114178, 
803.274081063929, 306.261087672466, 1606.54816212786, 1138.21152758462, 
328.361892442398, 312.321528531308, 378.802591428053, 3564.97859456085, 
399.141865860217, 654.76828203733, 828.743047248167, 944.571675962726, 
669.102760422943, 312.321528531308, 1147.36030437824, 1140.55078447979, 
1147.36030437824, 682.70481822187, 603.614762147734, 1207.22952429547, 
312.321528531308, 405.002592353822, 598.712798790326, 3088.62283807823, 
601.607161960551, 837.168686238654, 1036.3159447043, 762.922030382216, 
1188.32619818695, 712.985916390964, 605.370463928298, 1034.17367958523, 
1606.54816212786, 607.503888530733, 2107.39223484599, 567.383058387095, 
1140.55078447979, 846.139135570888, 558.112457492436, 793.751055244424, 
328.361892442398, 1241.28148767613, 828.743047248167, 1069.6202614693, 
828.743047248167, 1036.3159447043, 434.064724265343, 796.08788273764, 
810.005184707644, 434.064724265343, 1053.696117423, 1069.6202614693, 
1147.36030437824, 810.005184707644, 828.743047248167, 306.261087672466, 
654.76828203733, 1826.72947797677, 1707.31729137693, 518.157972352151, 
378.802591428053, 1588.10460615457, 762.922030382216, 558.112457492436, 
950.647888521286, 530.725255158427, 327.384141018665, 334.551380211471, 
1657.48609449633, 300.803580980276, 1034.17367958523, 798.283731720433, 
1208.28540725506, 1657.48609449633, 2427.91167846272, 300.803580980276, 
1702.14917516128, 327.384141018665, 846.139135570888, 1134.76611677419, 
828.743047248167, 475.323944260643, 558.112457492436, 668.467435759576, 
1053.696117423, 312.321528531308, 300.803580980276, 1213.95583923136, 
300.803580980276, 517.086839792615, 300.803580980276, 594.163099093474, 
913.364738988386, 517.086839792615, 598.712798790326, 1138.21152758462, 
851.074587580641, 603.614762147734, 2994.30343152033, 601.607161960551, 
837.168686238654, 917.008135125352, 1810.8442864432, 762.922030382216, 
1147.36030437824, 605.370463928298, 302.685231964149, 526.945925927366, 
702.064141140629, 668.467435759576, 1551.26051937784, 405.002592353822, 
762.922030382216, 300.803580980276, 2376.6523963739, 3088.62283807823, 
306.261087672466, 668.467435759576, 300.803580980276, 2416.57081451012, 
613.457196330588, 334.551380211471, 501.350576819682, 810.005184707644, 
1138.21152758462, 668.467435759576, 399.141865860217, 1996.20228768022, 
629.714450641817, 1226.91439266118, 1606.54816212786, 930.961115757095, 
1606.54816212786, 1588.10460615457, 1606.54816212786, 913.364738988386, 
920.185794495882, 399.141865860217, 851.074587580641, 479.360356183825, 
1588.10460615457, 300.803580980276, 314.857225320909, 702.064141140629, 
306.728598165294, 334.233717879788, 569.10576379231, 312.321528531308, 
1707.31729137693, 654.76828203733, 334.551380211471, 605.370463928298, 
327.384141018665, 399.141865860217, 1840.37158899176, 1210.7409278566, 
312.321528531308, 301.289126432632, 762.922030382216, 1861.92223151419, 
573.680152189121, 1036.3159447043, 603.614762147734, 1816.11139178489, 
312.321528531308, 620.640743838063, 810.005184707644, 828.743047248167, 
1604.43039220395, 668.467435759576, 300.803580980276, 654.76828203733, 
300.803580980276, 300.803580980276, 1003.65414063441, 2416.57081451012, 
2416.57081451012, 523.728618790936, 2139.2405229386, 613.457196330588, 
668.467435759576, 491.076211527998, 601.607161960551, 378.802591428053, 
517.086839792615, 1707.31729137693, 499.050571920056, 399.141865860217, 
682.70481822187, 300.803580980276, 305.569853371963, 517.086839792615, 
917.008135125352, 3176.20921230913, 328.361892442398, 1604.43039220395, 
1996.20228768022, 1053.696117423, 656.723784884795, 1383.34785042732, 
479.360356183825, 518.157972352151, 1226.91439266118, 1657.48609449633, 
702.064141140629, 475.323944260643, 530.725255158427, 828.743047248167, 
3077.22831191465, 1207.22952429547, 613.457196330588, 775.630259688922, 
1702.14917516128, 1140.55078447979, 601.607161960551, 902.410742940827, 
479.360356183825, 328.361892442398, 1425.97183278193, 1370.04710848258, 
381.461015191108, 762.922030382216, 569.10576379231, 682.70481822187, 
1188.32619818695, 1383.34785042732, 629.714450641817, 1147.36030437824, 
605.370463928298, 656.723784884795, 1692.27827114178, 1707.31729137693, 
762.922030382216, 595.313291433317, 1588.10460615457, 620.640743838063, 
902.410742940827, 300.803580980276, 312.321528531308, 1840.37158899176, 
398.04394136882, 1036.3159447043, 1370.04710848258, 1702.14917516128, 
573.680152189121, 1383.34785042732, 300.803580980276, 1226.91439266118, 
2416.57081451012, 300.803580980276, 2376.6523963739, 328.361892442398, 
341.352409110935, 828.743047248167, 668.467435759576, 1053.696117423, 
334.551380211471, 1210.7409278566, 530.725255158427, 399.141865860217, 
691.673925213658, 381.461015191108, 300.803580980276, 651.097086398014, 
2416.57081451012, 1138.21152758462, 1204.91112159589, 526.945925927366, 
846.139135570888, 1138.21152758462, 803.274081063929, 1826.72947797677, 
1003.65414063441, 312.321528531308, 691.673925213658, 327.384141018665, 
598.712798790326, 606.977919615681, 691.673925213658, 351.297283951577, 
300.803580980276, 598.712798790326, 719.040534275737, 451.205371470414, 
2051.48554127643, 702.064141140629, 1025.74277063822, 2090.51387672074, 
300.803580980276, 828.743047248167, 300.803580980276, 1036.3159447043, 
327.384141018665, 2376.6523963739, 762.922030382216, 1207.22952429547, 
775.630259688922, 1144.38304557332, 479.360356183825, 601.607161960551, 
517.086839792615, 479.360356183825, 1497.15171576017, 1213.95583923136, 
558.112457492436, 719.040534275737, 558.112457492436, 530.725255158427, 
1053.696117423, 399.141865860217, 1609.23162869389, 1425.97183278193, 
1204.91112159589, 1702.14917516128, 810.005184707644, 458.504067562676, 
2119.24604439241, 2994.30343152033, 1840.37158899176, 328.361892442398, 
629.714450641817, 654.76828203733, 530.725255158427, 669.102760422943, 
1034.17367958523, 603.614762147734, 300.803580980276, 828.743047248167, 
629.714450641817, 300.803580980276, 1208.28540725506, 501.350576819682, 
1554.47391705645, 1036.3159447043, 399.141865860217, 305.569853371963, 
793.751055244424, 312.321528531308, 1034.17367958523, 603.614762147734, 
458.504067562676, 3564.97859456085, 1003.65414063441, 601.607161960551, 
837.168686238654, 762.922030382216, 1996.20228768022, 1188.32619818695, 
573.680152189121, 1147.36030437824, 2427.91167846272, 803.274081063929, 
300.803580980276, 691.673925213658, 334.551380211471, 629.714450641817, 
1241.28148767613, 601.607161960551, 351.032070570315, 793.751055244424, 
300.803580980276, 654.76828203733, 381.461015191108, 1425.97183278193, 
1124.83282509616, 314.857225320909, 2376.6523963739, 558.112457492436, 
719.040534275737, 1241.28148767613, 1657.48609449633, 1147.36030437824, 
2107.39223484599, 334.233717879788, 558.112457492436, 434.064724265343, 
479.360356183825, 3208.8607844079, 530.725255158427, 300.803580980276, 
668.467435759576, 605.370463928298, 601.607161960551, 1034.17367958523, 
526.945925927366, 517.086839792615, 603.614762147734, 396.875527622212, 
810.005184707644, 558.112457492436, 762.922030382216, 328.361892442398, 
300.803580980276, 491.076211527998, 917.008135125352, 920.185794495882, 
300.803580980276, 518.157972352151, 1140.55078447979, 351.032070570315, 
1826.72947797677, 434.064724265343, 702.064141140629, 512.028613666402, 
598.712798790326, 1657.48609449633, 1002.70115363936, 810.005184707644, 
300.803580980276, 930.961115757095, 1226.91439266118, 1036.3159447043, 
2107.39223484599, 1657.48609449633, 312.321528531308, 668.467435759576, 
691.673925213658, 762.922030382216, 530.725255158427, 1588.10460615457, 
810.005184707644, 334.551380211471, 2107.39223484599, 1147.36030437824, 
603.614762147734, 418.584343119327, 328.361892442398, 328.361892442398, 
1826.72947797677, 810.005184707644, 328.361892442398, 1147.36030437824, 
920.185794495882, 558.112457492436, 2740.09421696516, 917.008135125352, 
359.520267137869, 702.064141140629, 668.467435759576, 1036.3159447043, 
629.714450641817, 300.803580980276, 3176.20921230913, 312.321528531308, 
603.614762147734, 712.985916390964, 351.032070570315, 828.743047248167, 
1816.11139178489, 570.275392239897, 570.275392239897, 1147.36030437824, 
654.76828203733, 810.005184707644, 1207.22952429547, 479.360356183825, 
1721.04045656737, 1383.34785042732, 300.803580980276, 798.283731720433, 
479.360356183825, 434.064724265343, 668.467435759576, 434.064724265343, 
603.614762147734, 656.723784884795, 3176.20921230913, 702.064141140629, 
1588.10460615457, 1147.36030437824, 1692.27827114178, 828.743047248167, 
1840.37158899176, 3564.97859456085, 601.607161960551, 530.725255158427, 
1003.65414063441, 1383.34785042732, 2585.83321682631, 3208.8607844079, 
1208.28540725506, 458.504067562676, 1207.22952429547, 378.802591428053, 
300.803580980276, 1425.97183278193, 601.607161960551, 475.323944260643, 
381.461015191108, 1721.04045656737, 398.04394136882, 1383.34785042732, 
306.261087672466, 458.504067562676, 1144.38304557332, 300.803580980276, 
378.802591428053, 518.157972352151, 668.467435759576, 1996.20228768022, 
300.803580980276, 381.461015191108, 399.141865860217, 312.321528531308, 
1606.54816212786, 378.802591428053, 620.640743838063, 351.032070570315, 
762.922030382216, 629.714450641817, 605.370463928298, 762.922030382216, 
300.803580980276, 603.614762147734, 810.005184707644, 312.321528531308, 
913.364738988386, 603.614762147734, 314.857225320909, 851.074587580641, 
526.548105855472, 396.875527622212, 1215.00777706147, 1657.48609449633, 
798.283731720433, 654.76828203733, 1657.48609449633, 530.725255158427, 
351.032070570315, 378.802591428053, 803.274081063929, 312.321528531308, 
1034.17367958523, 810.005184707644, 1053.696117423, 762.922030382216, 
396.875527622212, 479.360356183825, 2740.09421696516, 569.10576379231, 
3286.81183075927, 762.922030382216, 1197.42559758065, 828.743047248167, 
334.233717879788, 458.504067562676, 669.102760422943, 1226.91439266118, 
620.640743838063, 1226.91439266118, 327.384141018665, 300.803580980276, 
605.370463928298, 434.064724265343, 1782.48929728042, 2119.24604439241, 
300.803580980276, 762.922030382216, 803.274081063929, 314.857225320909, 
530.725255158427, 300.803580980276, 601.607161960551, 311.792144497738, 
669.102760422943, 860.520228283683, 828.743047248167, 327.384141018665, 
594.163099093474, 328.361892442398, 1138.21152758462, 1826.72947797677, 
530.725255158427, 601.607161960551, 2994.30343152033, 312.321528531308, 
668.467435759576, 669.102760422943, 656.723784884795, 1036.3159447043, 
668.467435759576, 985.085677327194, 803.274081063929, 518.157972352151, 
598.712798790326, 300.803580980276, 2107.39223484599, 902.410742940827, 
846.139135570888, 654.76828203733, 1657.48609449633, 1383.34785042732, 
334.551380211471, 458.504067562676, 669.102760422943, 702.064141140629, 
1036.3159447043, 2409.82224319179, 629.714450641817, 1606.54816212786, 
2075.02177564097, 300.803580980276, 1034.17367958523, 418.584343119327, 
300.803580980276, 1213.95583923136, 1606.54816212786, 328.361892442398, 
668.467435759576, 518.157972352151, 1002.70115363936, 334.551380211471, 
1036.3159447043, 570.275392239897, 312.321528531308, 351.032070570315, 
328.361892442398, 1692.27827114178, 1226.91439266118, 1604.43039220395, 
913.364738988386, 359.520267137869, 656.723784884795, 613.457196330588, 
669.102760422943, 1840.37158899176, 853.658645688465, 762.922030382216, 
2787.35183562765, 1002.70115363936, 1996.20228768022, 944.571675962726, 
2051.48554127643, 334.233717879788, 702.064141140629, 328.361892442398, 
654.76828203733, 1453.48622326765, 328.361892442398, 479.360356183825, 
334.551380211471, 1147.36030437824, 629.714450641817, 1861.92223151419, 
1138.21152758462, 828.743047248167, 396.875527622212, 405.002592353822, 
656.723784884795, 793.751055244424, 300.803580980276, 300.803580980276, 
2094.91447516374, 396.875527622212, 803.274081063929, 669.102760422943, 
682.70481822187, 573.680152189121, 668.467435759576, 1207.22952429547, 
518.157972352151, 300.803580980276, 604.14270362753, 1226.91439266118, 
668.467435759576, 654.76828203733, 917.008135125352, 798.283731720433, 
501.350576819682, 828.743047248167, 930.961115757095, 851.074587580641, 
3375.86290466443, 762.922030382216, 917.008135125352, 762.922030382216, 
319.535092804739, 798.283731720433, 1034.17367958523, 1197.42559758065, 
572.191522786662, 341.352409110935, 613.457196330588, 1588.10460615457, 
1588.10460615457, 702.064141140629, 558.112457492436, 2376.6523963739, 
1370.04710848258, 605.370463928298, 312.321528531308, 828.743047248167, 
451.205371470414, 1657.48609449633, 1702.14917516128, 1207.22952429547, 
629.714450641817, 526.548105855472, 613.457196330588, 598.712798790326, 
1210.7409278566, 920.185794495882, 1996.20228768022, 1826.72947797677, 
668.467435759576, 1588.10460615457, 2376.6523963739, 1657.48609449633, 
798.283731720433, 828.743047248167, 1226.91439266118, 305.569853371963, 
1024.0572273328, 1147.36030437824, 312.321528531308, 1692.27827114178, 
1425.97183278193, 601.607161960551, 1816.11139178489, 1606.54816212786, 
998.101143840112, 573.680152189121, 334.233717879788, 803.274081063929, 
1861.92223151419, 312.321528531308, 328.361892442398, 702.064141140629, 
300.803580980276, 351.032070570315, 762.922030382216, 517.086839792615, 
314.857225320909, 1226.91439266118, 687.756101344014, 319.535092804739, 
654.76828203733, 654.76828203733, 501.350576819682, 651.097086398014, 
1425.97183278193, 668.467435759576, 1657.48609449633, 530.725255158427, 
351.032070570315, 668.467435759576, 3161.08835226899, 798.283731720433, 
654.76828203733, 1702.14917516128, 2119.24604439241, 1053.696117423, 
1226.91439266118, 405.002592353822, 2089.55038690015, 1207.22952429547, 
418.584343119327, 1657.48609449633, 334.233717879788, 828.743047248167, 
328.361892442398, 518.157972352151, 300.803580980276, 598.712798790326, 
2427.91167846272, 396.875527622212, 396.875527622212, 620.640743838063, 
1140.55078447979, 1782.48929728042, 1147.36030437824, 3564.97859456085, 
312.321528531308, 300.803580980276, 306.261087672466, 306.261087672466, 
530.725255158427, 300.803580980276, 300.803580980276, 300.803580980276, 
613.457196330588, 334.233717879788, 312.321528531308, 1047.45723758187, 
810.005184707644, 601.607161960551, 300.803580980276), .Dim = c(1000L, 
2L))

When I do

WEIGHT BY wGEDA09pop. 
FREQUENCIES VARIABLES=sex 
  /ORDER=ANALYSIS.

in SPSS, I got 48,5% male (1) and 51,5% female (2) as result.

If I do

round(prop.table(xtabs(test[,2] ~ test[,1], test)),3)

I got 49,2 % male (1) and 50,8 % female (2) with the test dataset 47,8% male and 52,2% female.

Does someone know why they differ and how I can set a weight like in SPSS so that the weight is valid for all procedures e.g. pca... ?

Thanks a lot.
Dominik

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

权谋诡计 2024-12-05 14:37:16

通过在该问题的第 2 部分版本中的讨论,很明显调查包中的方法将为分析提供一致的基础。它具有列联表、平均值、分位数、绘图等方法。

With the discussion in your Part 2 version of this question, it became clear that the methods in the survey package would provide a consistent basis for analysis. It has methods for contingency tables, means, quantiles, plotting, etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文