# Changeset 37174 in project

Ignore:
Timestamp:
02/01/19 01:31:36 (7 months ago)
Message:

statistics doc update

File:
1 edited

Unmodified
Added
Removed
• ## wiki/eggref/5/statistics

 r36305 To use this library, you need to understand the underlying statistics.  In brief: The [[http://en.wikipedia.org/wiki/Binomial_distribution|Binomial 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). The [[http://en.wikipedia.org/wiki/Poisson_distribution|Poisson 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). The [[http://en.wikipedia.org/wiki/Normal_distribution|Normal distribution]] is used for real-valued 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). The [[http://en.wikipedia.org/wiki/Binomial_distribution|Binomial 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). The [[http://en.wikipedia.org/wiki/Poisson_distribution|Poisson 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). The [[http://en.wikipedia.org/wiki/Normal_distribution|Normal distribution]] is used for real-valued 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). === Provided Functions ==== Correlation and regression (linear-regression line-defn) 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: (linear-regression xs ys) Given a line definition as lists of point coordinates, first prints to the terminal and then returns 5 '''values''' for the best fitting line through the points: * the y-intercept (This is also called the Pearson correlation; used when relation expected to be linear.  Also see {{spearman-rank-correlation}}.) > (linear-regression '((1.0 0.1) (2.0 0.3) (3.0 0.8))) > (linear-regression '(1.0 2.0 3.0) '(0.1 0.3 0.8)) Intercept = -0.3, slope = 0.35, r = 0.970725343394151, R^2 = 0.942307692307692, p = 0.154420958311267 -0.3 ; 5 values (correlation-coefficient line-defn)(correlation-coefficient xs ys) As above, but only returns the value of ''r'': > (correlation-coefficient '((1.0 0.1) (2.0 0.3) (3.0 0.8))) > (correlation-coefficient '(1.0 2.0 3.0) '(0.1 0.3 0.8)) 0.970725343394151 As above, but computes the correlations from given lists of points. (spearman-rank-correlation points) Returns two '''values''', the Spearman Rank measure of correlation between given list of points, and the p-significance of the correlation.  (This correlation is used for non-linear relations; compare with {{linear-regression}}.) (spearman-rank-correlation xs ys) Returns two '''values''', the Spearman Rank measure of correlation between the given lists of point coordinates, and the p-significance of the correlation.  (This correlation is used for non-linear relations; compare with {{linear-regression}}.) ==== Significance test functions === Version History * 0.11: refactoring correlation and regression interface to take two separate dataset arguments * 0.9: ported to CHICKEN 5 * 0.8: added cumsum and random-weighted-sample
Note: See TracChangeset for help on using the changeset viewer.