Changeset 37174 in project
 Timestamp:
 02/01/19 01:31:36 (3 weeks ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

wiki/eggref/5/statistics
r36305 r37174 12 12 To use this library, you need to understand the underlying statistics. In brief: 13 13 14 The [[http://en.wikipedia.org/wiki/Binomial_distributionBinomial distribution]] is used when counting discrete events in a series of trials, each of which events has a probability p of producing a positive outcome. An example would be tossing a coin {{n}} times: the probability of a head is {{p}}, and the distribution gives the expected number of heads in the {{n}} trials. The binomial distribution is defined as B(n, p). 15 16 The [[http://en.wikipedia.org/wiki/Poisson_distributionPoisson distribution]] is used to count discrete events which occur with a known average rate. A typical example is the decay of radioactive elements. A poisson distribution is defined Pois(mu). 17 18 The [[http://en.wikipedia.org/wiki/Normal_distributionNormal distribution]] is used for realvalued events which cluster around a specific mean with a symmetric variance. A typical example would be the distribution of people's heights. A normal distribution is defined N(mean, variance). 14 The [[http://en.wikipedia.org/wiki/Binomial_distributionBinomial 15 distribution]] is used when counting discrete events in a series of 16 trials, each of which events has a probability p of producing a 17 positive outcome. An example would be tossing a coin {{n}} times: the 18 probability of a head is {{p}}, and the distribution gives the 19 expected number of heads in the {{n}} trials. The binomial 20 distribution is defined as B(n, p). 21 22 The [[http://en.wikipedia.org/wiki/Poisson_distributionPoisson 23 distribution]] is used to count discrete events which occur with a 24 known average rate. A typical example is the decay of radioactive 25 elements. A poisson distribution is defined Pois(mu). 26 27 The [[http://en.wikipedia.org/wiki/Normal_distributionNormal 28 distribution]] is used for realvalued events which cluster around a 29 specific mean with a symmetric variance. A typical example would be 30 the distribution of people's heights. A normal distribution is 31 defined N(mean, variance). 19 32 20 33 === Provided Functions … … 436 449 ==== Correlation and regression 437 450 438 <procedure>(linearregression linedefn)</procedure> 439 Given a line definition as a list of point pairs, first prints to the terminal and then returns 5 '''values''' for the best fitting line through the points: 451 <procedure>(linearregression xs ys)</procedure> 452 453 Given a line definition as lists of point coordinates, first prints to 454 the terminal and then returns 5 '''values''' for the best fitting line 455 through the points: 440 456 441 457 * the yintercept … … 447 463 (This is also called the Pearson correlation; used when relation expected to be linear. Also see {{spearmanrankcorrelation}}.) 448 464 449 > (linearregression '( (1.0 0.1) (2.0 0.3) (3.0 0.8)))465 > (linearregression '(1.0 2.0 3.0) '(0.1 0.3 0.8)) 450 466 Intercept = 0.3, slope = 0.35, r = 0.970725343394151, R^2 = 0.942307692307692, p = 0.154420958311267 451 467 0.3 … … 456 472 ; 5 values 457 473 458 <procedure>(correlationcoefficient linedefn)</procedure>474 <procedure>(correlationcoefficient xs ys)</procedure> 459 475 As above, but only returns the value of ''r'': 460 476 461 > (correlationcoefficient '( (1.0 0.1) (2.0 0.3) (3.0 0.8)))477 > (correlationcoefficient '(1.0 2.0 3.0) '(0.1 0.3 0.8)) 462 478 0.970725343394151 463 479 … … 468 484 As above, but computes the correlations from given lists of points. 469 485 470 <procedure>(spearmanrankcorrelation points)</procedure>471 Returns two '''values''', the Spearman Rank measure of correlation between given list of points, and the psignificance of the correlation. (This correlation is used for nonlinear relations; compare with {{linearregression}}.)486 <procedure>(spearmanrankcorrelation xs ys)</procedure> 487 Returns two '''values''', the Spearman Rank measure of correlation between the given lists of point coordinates, and the psignificance of the correlation. (This correlation is used for nonlinear relations; compare with {{linearregression}}.) 472 488 473 489 ==== Significance test functions … … 508 524 === Version History 509 525 526 * 0.11: refactoring correlation and regression interface to take two separate dataset arguments 510 527 * 0.9: ported to CHICKEN 5 511 528 * 0.8: added cumsum and randomweightedsample
Note: See TracChangeset
for help on using the changeset viewer.