Path: | rdoc/stats.rdoc |
Last Update: | Sun Nov 14 22:53:48 +0000 2010 |
Arithmetic mean.
>> require("gsl") => true >> v = Vector[1..7] => GSL::Vector: [ 1.000e+00 2.000e+00 3.000e+00 4.000e+00 5.000e+00 6.000e+00 7.000e+00 ] >> v.mean => 4.0 >> Stats::mean(v) => 4.0
Returns the total sum of squares about self.mean. (Requires GSL 1.11)
Returns the total sum of squares about mean. (Requires GSL 1.11)
Variance of v relative to the given value of mean.
Standard deviation.
(GSL-1.11 or later) These methods return the total sum of squares (TSS) of data about the mean.
Unbiased estimate of the variance of v when the population mean mean of the underlying distribution is known a priori.
Unbiased estimate of the variance of v when the population mean mean of the underlying distribution is known a priori.
Compute the absolute deviation (from the mean mean if given).
Skewness
Kurtosis
The lag-1 autocorrelation
Covariance of vectors v1, v2.
This efficiently computes the Pearson correlation coefficient between the vectors v1, v2. (>= GSL-1.10)
Return the maximum value in data.
Return the minimum value in data.
Find both the minimum and maximum values in data and returns them.
Return the index of the maximum value in data. The maximum value is defined as the value of the element x_i which satisfies x_i >= x_j for all j. When there are several equal maximum elements then the first one is chosen.
Returns the index of the minimum value in data. The minimum value is defined as the value of the element x_i which satisfies x_i >= x_j for all j. When there are several equal minimum elements then the first one is chosen.
Return the indexes of the minimum and maximum values in data in a single pass.
Return the median value. The elements of the data must be in ascending numerical order. There are no checks to see whether the data are sorted, so the method GSL::Vector#sort should always be used first.
Return the quantile value. The elements of the data must be in ascending numerical order. There are no checks to see whether the data are sorted, so the method GSL::Vector#sort should always be used first.
#!/usr/bin/env ruby require 'gsl' ary = [17.2, 18.1, 16.5, 18.3, 12.6] data = Vector.alloc(ary) mean = data.mean() variance = data.stats_variance() largest = data.stats_max() smallest = data.stats_min() printf("The dataset is %g, %g, %g, %g, %g\n", data[0], data[1], data[2], data[3], data[4]); printf("The sample mean is %g\n", mean); printf("The estimated variance is %g\n", variance); printf("The largest value is %g\n", largest); printf("The smallest value is %g\n", smallest);