Knowledge

Talk:Inverse transform sampling

Source đź“ť

179: 158: 84: 74: 53: 22: 430: 317:
For discrete distributions, the function cdfInverse (inverse of cumulative distribution function) can be calculated from samples as follows: for each element in the sample range (discrete values along the x-axis), calculating the total samples before it. Normalize this new discrete distribution. This
335:
will have some way to represent probability distributions and sample from them. This functionality might even have been developed in third-party libraries. Such packages greatly facilitate such sampling, most likely have optimizations for common distributions, and are likely to be more elegant than
313:
define function sampleFrom(cdfInverse (type="function")): // input: // cdfInverse(x) - the inverse of the CDF of the probability distribution // example: if distribution is ], one can use a ] of the inverse of ](x) // example: if distribution is discrete, see explanation below
266:
Can this page also show up on a search for "Inversion Method"? I have looked all over for this article, and then found it through a link somewhere else which then linked through to this article with the text "Inversion Method". I would do this but am not sure how.
314:
pseudocode // output: // type="real number" - a value sampled from the probability distribution represented by cdfInverse r = random() while(r == 0): (make sure r is not equal to 0; discontinuity possible) r = random() return cdfInverse(r)
310:(easy to calculate with a discrete distribution, can be approximated for continuous distributions) and a computational primitive called "random()" which returns an arbitrary-precision floating-point-value in the range of [0,1). 318:
new discrete distribution is the CDF, and can be turned into an object which acts like a function: calling cdfInverse(query) returns the smallest x-value such that the CDF is greater than or equal to the query.
321:
define function dataToCdfInverse(discreteDistribution (type="dictionary")) // input: // discreteDistribution - a mapping from possible values to frequencies/probabilities // example: {0 -: -->
229: 140: 445:
I think the intro should be much more concise, and clearly get to the point. I shouldn't need to dig through the article for 2 minutes to figure out how inverse transform sampling works.
306:
The following algorithm lets one sample from a probability distribution (either discrete or continuous). This algorithm assumes that one has access to the inverse of the
325:"tails" // output: // type="function" - a function that represents (CDF^-1)(x) define function cdfInverse(x): integral = 0 go through mapping (key-: --> 494: 219: 484: 130: 442:
The concept is pretty simple: to generate a random sample X with CDF, you can take Y from a uniform distribution and transform it via X = invCDF(Y).
499: 106: 479: 195: 489: 363: 97: 58: 401: 186: 163: 460: 33: 301: 323:
p} would be a ] with chance=p // example: setting p=0.5 in the above example, this is a ] where P(X=1)-: -->
332: 307: 286: 39: 268: 83: 347:
I heard that the the inverse method also works for the discontinuous case, despite the discontinuity.
178: 157: 448: 397: 389: 386:
Someone should edit 1-2^{-52} to something that makes sense. is it supposed to be 1 - 1/(2^{52})  ??
21: 367: 194:
on Knowledge. If you would like to participate, please visit the project page, where you can join
105:
on Knowledge. If you would like to participate, please visit the project page, where you can join
371: 89: 73: 52: 456: 417: 352: 282: 362:
In fact, it works for the general case using the generalized inverse. Details can be found
251:
The link in the reference at the bottom is 404'ed. (Non-Uniform Random Variate Generation)
393: 464: 421: 405: 375: 356: 290: 271: 473: 452: 413: 348: 326:
value) in sorted order, adding value to integral... stop when integral : -->
256: 259: 102: 191: 79: 412:
Yes; that's it; I've re-formatted with a superscript to make this clearer.
328:= x, doesn't matter) return last key we added return cdfInverse 15: 190:, a collaborative effort to improve the coverage of 101:, a collaborative effort to improve the coverage of 331:Note that often, mathematics environments and 8: 281:This could be incorporated here somewhere 152: 47: 154: 49: 19: 7: 184:This article is within the scope of 95:This article is within the scope of 277:Moved from probability distribution 38:It is of interest to the following 495:Low-importance Statistics articles 14: 485:Low-priority mathematics articles 115:Knowledge:WikiProject Mathematics 428: 262:as of 13:45, 4 August 2006 (UTC) 204:Knowledge:WikiProject Statistics 177: 156: 118:Template:WikiProject Mathematics 82: 72: 51: 20: 500:WikiProject Statistics articles 336:the above bare-bones solution. 224:This article has been rated as 207:Template:WikiProject Statistics 135:This article has been rated as 1: 465:20:04, 21 December 2021 (UTC) 272:17:29, 6 September 2007 (UTC) 198:and see a list of open tasks. 109:and see a list of open tasks. 480:B-Class mathematics articles 357:22:38, 28 January 2011 (UTC) 291:00:37, 22 October 2010 (UTC) 490:B-Class Statistics articles 376:09:24, 3 January 2023 (UTC) 516: 426: 406:17:29, 9 August 2018 (UTC) 302:Inverse transform sampling 299: 422:10:15, 24 June 2021 (UTC) 223: 172: 134: 67: 46: 333:computer algebra systems 324:"heads" and P(X=0)-: --> 255:Here are working links: 141:project's priority scale 308:cumulative distribution 98:WikiProject Mathematics 382:Unclear value in table 187:WikiProject Statistics 28:This article is rated 327:x (or integral : --> 121:mathematics articles 210:Statistics articles 343:Discontinuous case 296:Simulated sampling 90:Mathematics portal 34:content assessment 451:comment added by 438:Long-winded intro 392:comment added by 244: 243: 240: 239: 236: 235: 151: 150: 147: 146: 507: 467: 432: 431: 408: 230:importance scale 212: 211: 208: 205: 202: 181: 174: 173: 168: 160: 153: 123: 122: 119: 116: 113: 92: 87: 86: 76: 69: 68: 63: 55: 48: 31: 25: 24: 16: 515: 514: 510: 509: 508: 506: 505: 504: 470: 469: 446: 440: 435: 434: 429: 387: 384: 345: 329: 315: 304: 298: 279: 249: 209: 206: 203: 200: 199: 166: 120: 117: 114: 111: 110: 88: 81: 61: 32:on Knowledge's 29: 12: 11: 5: 513: 511: 503: 502: 497: 492: 487: 482: 472: 471: 439: 436: 427: 425: 424: 383: 380: 379: 378: 344: 341: 339: 320: 312: 300:Main article: 297: 294: 278: 275: 264: 263: 248: 245: 242: 241: 238: 237: 234: 233: 226:Low-importance 222: 216: 215: 213: 196:the discussion 182: 170: 169: 167:Low‑importance 161: 149: 148: 145: 144: 133: 127: 126: 124: 107:the discussion 94: 93: 77: 65: 64: 56: 44: 43: 37: 26: 13: 10: 9: 6: 4: 3: 2: 512: 501: 498: 496: 493: 491: 488: 486: 483: 481: 478: 477: 475: 468: 466: 462: 458: 454: 450: 443: 437: 423: 419: 415: 411: 410: 409: 407: 403: 399: 395: 391: 381: 377: 373: 369: 365: 361: 360: 359: 358: 354: 350: 342: 340: 337: 334: 322:1-p, 1 -: --> 319: 311: 309: 303: 295: 293: 292: 288: 284: 276: 274: 273: 270: 261: 258: 254: 253: 252: 246: 231: 227: 221: 218: 217: 214: 197: 193: 189: 188: 183: 180: 176: 175: 171: 165: 162: 159: 155: 142: 138: 132: 129: 128: 125: 108: 104: 100: 99: 91: 85: 80: 78: 75: 71: 70: 66: 60: 57: 54: 50: 45: 41: 35: 27: 23: 18: 17: 447:— Preceding 444: 441: 388:— Preceding 385: 346: 338: 330: 316: 305: 280: 269:89.244.181.5 265: 250: 225: 185: 137:Low-priority 136: 96: 62:Low‑priority 40:WikiProjects 283:MisterSheik 112:Mathematics 103:mathematics 59:Mathematics 474:Categories 394:Aditya8795 201:Statistics 192:statistics 164:Statistics 260:Chapter 2 461:contribs 449:unsigned 433:Resolved 402:contribs 390:unsigned 368:Sowhates 453:Azmisov 414:Klbrain 349:Jackzhp 228:on the 139:on the 30:B-class 36:scale. 457:talk 418:talk 398:talk 372:talk 364:here 353:talk 287:talk 257:Book 247:Link 220:Low 131:Low 476:: 463:) 459:• 420:) 404:) 400:• 374:) 366:. 355:) 289:) 455:( 416:( 396:( 370:( 351:( 285:( 232:. 143:. 42::

Index


content assessment
WikiProjects
WikiProject icon
Mathematics
WikiProject icon
icon
Mathematics portal
WikiProject Mathematics
mathematics
the discussion
Low
project's priority scale
WikiProject icon
Statistics
WikiProject icon
WikiProject Statistics
statistics
the discussion
Low
importance scale
Book
Chapter 2
89.244.181.5
17:29, 6 September 2007 (UTC)
MisterSheik
talk
00:37, 22 October 2010 (UTC)
Inverse transform sampling
cumulative distribution

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

↑