Knowledge

User:Vossman/Weighted running sums

Source 📝

815: 1361: 1070: 825:
for the population variance. In normal unweighted samples, the N in the denominator (corresponding to the sample size) is changed to N-1. While this is simple in unweighted samples, it becomes tedious for weighted samples. Thus, the unbiased estimator of weighted population variance is given by
548: 1082: 835: 477: 314: 810:{\displaystyle \sigma _{normal}^{2}\ ={\frac {\sum _{i=1}^{N}{\left(x_{i}-\mu \right)^{2}}}{N}}\;\;\;\sigma _{weighted}^{2}\ ={\frac {\sum _{i=1}^{N}{{w_{i}}\left(x_{i}-\mu \right)^{2}}}{\sum _{i=1}^{N}{w_{i}}}}} 1356:{\displaystyle s^{2}\ ={\frac {\sum _{i=1}^{N}{w_{i}{x_{i}}^{2}}\sum _{i=1}^{N}{w_{i}}-\left(\sum _{i=1}^{N}{w_{i}x_{i}}\right)^{2}}{\left(\sum _{i=1}^{N}{w_{i}}\right)^{2}-\sum _{i=1}^{N}{{w_{i}}^{2}}}}} 1065:{\displaystyle s^{2}\ ={\frac {\sum _{i=1}^{N}{w_{i}}}{\left(\sum _{i=1}^{N}{w_{i}}\right)^{2}-\sum _{i=1}^{N}{{w_{i}}^{2}}}}\ \sum _{i=1}^{N}{{w_{i}}\left(x_{i}-\mu \right)^{2}}} 325: 514:
In the special case, often encountered in practice, where the weights are normalized (i.e. are nonnegative and sum up to 1), the denominator of the fraction simplifies to 1.
193: 115: 489:. While weighted means generally behave in a similar fashion to arithmetic means, they do have a few counter-intuitive properties, as captured for instance in 204: 530:
of that mean. When a weighted mean is used, the variance of the weighted sample is different from the variance of the unweighted sample. The
482:
So data elements with a high weight contribute more to the weighted mean than do elements with a low weight.
497: 508: 501: 472:{\displaystyle {\bar {x}}={\frac {w_{1}x_{1}+w_{2}x_{2}+\cdots +w_{n}x_{n}}{w_{1}+w_{2}+\cdots +w_{n}}}.} 496:
Weighted versions of other means can also be calculated. Examples of such weighted means include the
490: 822: 527: 827: 535: 486: 121: 29: 129: 51: 309:{\displaystyle {\bar {x}}={\frac {\sum _{i=1}^{n}w_{i}x_{i}}{\sum _{i=1}^{n}w_{i}}},} 17: 511:
and also occurs in a more general form in several other areas of mathematics.
523: 1366:
The standard deviation is simply the square root of the variance above.
485:
If all the weights are equal, then the weighted mean is the same as the
1076:
Which can also be written in terms of running sums for programming as:
198:
at least one of which is positive, is the quantity calculated by
522:
Typically when you calculate a mean it is important to know the
821:
For small sample of populations, it is customary to use an
1085: 838: 551: 328: 207: 132: 54: 1355: 1064: 809: 471: 308: 187: 109: 8: 507:The notion of weighted mean plays a role in 655: 654: 653: 1343: 1336: 1331: 1329: 1323: 1312: 1299: 1287: 1282: 1276: 1265: 1247: 1235: 1225: 1220: 1214: 1203: 1183: 1178: 1172: 1161: 1150: 1143: 1138: 1131: 1126: 1120: 1109: 1102: 1090: 1084: 1055: 1038: 1021: 1016: 1015: 1009: 998: 981: 974: 969: 967: 961: 950: 937: 925: 920: 914: 903: 884: 879: 873: 862: 855: 843: 837: 797: 792: 786: 775: 762: 745: 728: 723: 722: 716: 705: 698: 686: 660: 640: 623: 612: 606: 595: 588: 576: 556: 550: 457: 438: 425: 413: 403: 384: 374: 361: 351: 344: 330: 329: 327: 294: 284: 273: 261: 251: 241: 230: 223: 209: 208: 206: 181: 172: 153: 140: 131: 103: 94: 75: 62: 53: 7: 538:is defined similarly to the normal 24: 120:with corresponding non-negative 335: 214: 178: 133: 100: 55: 45:, of a non-empty list of data 1: 1380: 518:Weighted sample variance 32:for the continuous case. 498:weighted geometric mean 1357: 1328: 1281: 1219: 1177: 1125: 1066: 1014: 966: 919: 878: 811: 791: 721: 611: 509:descriptive statistics 502:weighted harmonic mean 473: 310: 289: 246: 189: 111: 1358: 1308: 1261: 1199: 1157: 1105: 1067: 994: 946: 899: 858: 812: 771: 701: 591: 474: 311: 269: 226: 190: 112: 1083: 836: 549: 326: 205: 130: 52: 691: 581: 188:{\displaystyle \,,} 110:{\displaystyle \,,} 1353: 1062: 823:unbiased estimator 807: 656: 552: 528:standard deviation 469: 306: 185: 107: 1351: 1098: 993: 989: 851: 805: 694: 651: 584: 542:sample variance: 491:Simpson's paradox 464: 338: 301: 217: 1371: 1362: 1360: 1359: 1354: 1352: 1350: 1349: 1348: 1347: 1342: 1341: 1340: 1327: 1322: 1304: 1303: 1298: 1294: 1293: 1292: 1291: 1280: 1275: 1253: 1252: 1251: 1246: 1242: 1241: 1240: 1239: 1230: 1229: 1218: 1213: 1189: 1188: 1187: 1176: 1171: 1156: 1155: 1154: 1149: 1148: 1147: 1136: 1135: 1124: 1119: 1103: 1096: 1095: 1094: 1071: 1069: 1068: 1063: 1061: 1060: 1059: 1054: 1050: 1043: 1042: 1027: 1026: 1025: 1013: 1008: 991: 990: 988: 987: 986: 985: 980: 979: 978: 965: 960: 942: 941: 936: 932: 931: 930: 929: 918: 913: 891: 890: 889: 888: 877: 872: 856: 849: 848: 847: 816: 814: 813: 808: 806: 804: 803: 802: 801: 790: 785: 769: 768: 767: 766: 761: 757: 750: 749: 734: 733: 732: 720: 715: 699: 692: 690: 685: 652: 647: 646: 645: 644: 639: 635: 628: 627: 610: 605: 589: 582: 580: 575: 478: 476: 475: 470: 465: 463: 462: 461: 443: 442: 430: 429: 419: 418: 417: 408: 407: 389: 388: 379: 378: 366: 365: 356: 355: 345: 340: 339: 331: 315: 313: 312: 307: 302: 300: 299: 298: 288: 283: 267: 266: 265: 256: 255: 245: 240: 224: 219: 218: 210: 194: 192: 191: 186: 177: 176: 158: 157: 145: 144: 116: 114: 113: 108: 99: 98: 80: 79: 67: 66: 43:weighted average 1379: 1378: 1374: 1373: 1372: 1370: 1369: 1368: 1332: 1330: 1283: 1260: 1256: 1255: 1254: 1231: 1221: 1198: 1194: 1193: 1179: 1139: 1137: 1127: 1104: 1086: 1081: 1080: 1075: 1034: 1033: 1029: 1028: 1017: 970: 968: 921: 898: 894: 893: 892: 880: 857: 839: 834: 833: 820: 793: 770: 741: 740: 736: 735: 724: 700: 619: 618: 614: 613: 590: 547: 546: 536:sample variance 520: 487:arithmetic mean 453: 434: 421: 420: 409: 399: 380: 370: 357: 347: 346: 324: 323: 290: 268: 257: 247: 225: 203: 202: 168: 149: 136: 128: 127: 90: 71: 58: 50: 49: 30:weight function 22: 21: 20: 12: 11: 5: 1377: 1375: 1364: 1363: 1346: 1339: 1335: 1326: 1321: 1318: 1315: 1311: 1307: 1302: 1297: 1290: 1286: 1279: 1274: 1271: 1268: 1264: 1259: 1250: 1245: 1238: 1234: 1228: 1224: 1217: 1212: 1209: 1206: 1202: 1197: 1192: 1186: 1182: 1175: 1170: 1167: 1164: 1160: 1153: 1146: 1142: 1134: 1130: 1123: 1118: 1115: 1112: 1108: 1101: 1093: 1089: 1073: 1072: 1058: 1053: 1049: 1046: 1041: 1037: 1032: 1024: 1020: 1012: 1007: 1004: 1001: 997: 984: 977: 973: 964: 959: 956: 953: 949: 945: 940: 935: 928: 924: 917: 912: 909: 906: 902: 897: 887: 883: 876: 871: 868: 865: 861: 854: 846: 842: 818: 817: 800: 796: 789: 784: 781: 778: 774: 765: 760: 756: 753: 748: 744: 739: 731: 727: 719: 714: 711: 708: 704: 697: 689: 684: 681: 678: 675: 672: 669: 666: 663: 659: 650: 643: 638: 634: 631: 626: 622: 617: 609: 604: 601: 598: 594: 587: 579: 574: 571: 568: 565: 562: 559: 555: 519: 516: 480: 479: 468: 460: 456: 452: 449: 446: 441: 437: 433: 428: 424: 416: 412: 406: 402: 398: 395: 392: 387: 383: 377: 373: 369: 364: 360: 354: 350: 343: 337: 334: 317: 316: 305: 297: 293: 287: 282: 279: 276: 272: 264: 260: 254: 250: 244: 239: 236: 233: 229: 222: 216: 213: 196: 195: 184: 180: 175: 171: 167: 164: 161: 156: 152: 148: 143: 139: 135: 118: 117: 106: 102: 97: 93: 89: 86: 83: 78: 74: 70: 65: 61: 57: 35: 34: 23: 15: 14: 13: 10: 9: 6: 4: 3: 2: 1376: 1367: 1344: 1337: 1333: 1324: 1319: 1316: 1313: 1309: 1305: 1300: 1295: 1288: 1284: 1277: 1272: 1269: 1266: 1262: 1257: 1248: 1243: 1236: 1232: 1226: 1222: 1215: 1210: 1207: 1204: 1200: 1195: 1190: 1184: 1180: 1173: 1168: 1165: 1162: 1158: 1151: 1144: 1140: 1132: 1128: 1121: 1116: 1113: 1110: 1106: 1099: 1091: 1087: 1079: 1078: 1077: 1056: 1051: 1047: 1044: 1039: 1035: 1030: 1022: 1018: 1010: 1005: 1002: 999: 995: 982: 975: 971: 962: 957: 954: 951: 947: 943: 938: 933: 926: 922: 915: 910: 907: 904: 900: 895: 885: 881: 874: 869: 866: 863: 859: 852: 844: 840: 832: 831: 830: 828: 824: 798: 794: 787: 782: 779: 776: 772: 763: 758: 754: 751: 746: 742: 737: 729: 725: 717: 712: 709: 706: 702: 695: 687: 682: 679: 676: 673: 670: 667: 664: 661: 657: 648: 641: 636: 632: 629: 624: 620: 615: 607: 602: 599: 596: 592: 585: 577: 572: 569: 566: 563: 560: 557: 553: 545: 544: 543: 541: 537: 533: 529: 525: 517: 515: 512: 510: 505: 503: 499: 494: 492: 488: 483: 466: 458: 454: 450: 447: 444: 439: 435: 431: 426: 422: 414: 410: 404: 400: 396: 393: 390: 385: 381: 375: 371: 367: 362: 358: 352: 348: 341: 332: 322: 321: 320: 319:which means: 303: 295: 291: 285: 280: 277: 274: 270: 262: 258: 252: 248: 242: 237: 234: 231: 227: 220: 211: 201: 200: 199: 182: 173: 169: 165: 162: 159: 154: 150: 146: 141: 137: 126: 125: 124: 123: 104: 95: 91: 87: 84: 81: 76: 72: 68: 63: 59: 48: 47: 46: 44: 40: 39:weighted mean 33: 31: 26: 25: 19: 1365: 1074: 819: 539: 531: 521: 513: 506: 495: 484: 481: 318: 197: 119: 42: 38: 36: 27: 18:User:Vossman 1310:∑ 1306:− 1263:∑ 1201:∑ 1191:− 1159:∑ 1107:∑ 1048:μ 1045:− 996:∑ 948:∑ 944:− 901:∑ 860:∑ 773:∑ 755:μ 752:− 703:∑ 658:σ 633:μ 630:− 593:∑ 554:σ 534:weighted 448:⋯ 394:⋯ 336:¯ 271:∑ 228:∑ 215:¯ 163:… 85:… 524:variance 500:and the 122:weights 1097:  992:  850:  693:  583:  540:biased 532:biased 41:, or 16:< 526:and 37:The 28:See 829:: 504:. 493:. 1345:2 1338:i 1334:w 1325:N 1320:1 1317:= 1314:i 1301:2 1296:) 1289:i 1285:w 1278:N 1273:1 1270:= 1267:i 1258:( 1249:2 1244:) 1237:i 1233:x 1227:i 1223:w 1216:N 1211:1 1208:= 1205:i 1196:( 1185:i 1181:w 1174:N 1169:1 1166:= 1163:i 1152:2 1145:i 1141:x 1133:i 1129:w 1122:N 1117:1 1114:= 1111:i 1100:= 1092:2 1088:s 1057:2 1052:) 1040:i 1036:x 1031:( 1023:i 1019:w 1011:N 1006:1 1003:= 1000:i 983:2 976:i 972:w 963:N 958:1 955:= 952:i 939:2 934:) 927:i 923:w 916:N 911:1 908:= 905:i 896:( 886:i 882:w 875:N 870:1 867:= 864:i 853:= 845:2 841:s 799:i 795:w 788:N 783:1 780:= 777:i 764:2 759:) 747:i 743:x 738:( 730:i 726:w 718:N 713:1 710:= 707:i 696:= 688:2 683:d 680:e 677:t 674:h 671:g 668:i 665:e 662:w 649:N 642:2 637:) 625:i 621:x 616:( 608:N 603:1 600:= 597:i 586:= 578:2 573:l 570:a 567:m 564:r 561:o 558:n 467:. 459:n 455:w 451:+ 445:+ 440:2 436:w 432:+ 427:1 423:w 415:n 411:x 405:n 401:w 397:+ 391:+ 386:2 382:x 376:2 372:w 368:+ 363:1 359:x 353:1 349:w 342:= 333:x 304:, 296:i 292:w 286:n 281:1 278:= 275:i 263:i 259:x 253:i 249:w 243:n 238:1 235:= 232:i 221:= 212:x 183:, 179:] 174:n 170:w 166:, 160:, 155:2 151:w 147:, 142:1 138:w 134:[ 105:, 101:] 96:n 92:x 88:, 82:, 77:2 73:x 69:, 64:1 60:x 56:[

Index

User:Vossman
weight function
weights
arithmetic mean
Simpson's paradox
weighted geometric mean
weighted harmonic mean
descriptive statistics
variance
standard deviation
sample variance
unbiased estimator

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.