![]() |
|
These functions simply take in a GSL vector and return its mean, variance, or kurtosis; the covariance functions take two GSL vectors as inputs.
apop_vector_kurtosis and apop_vector_kurt are identical; pick the one which sounds better to you.
For apop_vector_var_m(vector, mean), mean is the mean of the vector. This saves the trouble of re-calcuating the mean if you've already done so. E.g.,
gsl_vector *v; double mean, var; //Allocate v and fill it with data here. mean = apop_vector_mean(v); var = apop_vector_var_m(v, mean); printf("Your vector has mean %g and variance %g\n", mean, var);
| #define apop_mean | ( | in | ) |
An alias for apop_vector_mean. Returns the mean of the data in the given vector.
Returns the mean of the elements of the vector v.
| #define apop_var | ( | in | ) | apop_vector_var(in) |
An alias for apop_vector_var. Returns the variance of the data in the given vector.
| #define apop_vector_kurt | ( | in | ) | apop_vector_kurtosis(in) |
Returns the sample kurtosis (divide by
) of the data in the given vector. This does not normalize the output: the kurtosis of a
is three, not zero.
An alias for apop_vector_kurtosis.
| #define apop_vector_mean | ( | in | ) |
Returns the mean of the data in the given vector.
Returns the mean of the elements of the vector v.
| #define apop_vector_var | ( | in | ) |
Returns the variance of the data in the given vector.
This uses (n-1) in the denominator of the sum; i.e., it corrects for the bias introduced by using
instead of
.
At the moment, there is no var_pop function. Just multiply this by (n-1)/n if you need that.
Returns the sample variance of the elements of the vector v.
| double apop_vector_correlation | ( | const gsl_vector * | ina, | |
| const gsl_vector * | inb | |||
| ) |
Returns the correllation coefficient of two vectors. It's just
| double apop_vector_cov | ( | const gsl_vector * | ina, | |
| const gsl_vector * | inb | |||
| ) |
Returns the covariance of two vectors
| double apop_vector_kurtosis | ( | const gsl_vector * | in | ) |
Returns the sample kurtosis (divide by
) of the data in the given vector. Corrections are made to produce an unbiased result.
This does not normalize the output: the kurtosis of a
is three
, not three, one, or zero.
| double apop_vector_kurtosis_pop | ( | const gsl_vector * | in | ) |
Returns the population kurtosis (
) of the data in the given vector.
Some people like to normalize the skew by dividing by variance squared, or by subtracting three; those things are not done here, so you'll have to do them separately if need be.
| double apop_vector_skew | ( | const gsl_vector * | in | ) |
Returns an unbiased estmate of the sample skew (population skew times y
) of the data in the given vector.
| double apop_vector_skew_pop | ( | const gsl_vector * | in | ) |
Returns the population skew
of the data in the given vector.
Some people like to normalize the skew by dividing by variance
; that's not done here, so you'll have to do so separately if need be.
| double apop_vector_var_m | ( | const gsl_vector * | in, | |
| const double | mean | |||
| ) |
Returns the variance of the data in the given vector, given that you've already calculated the mean.
| in | the vector in question | |
| mean | the mean, which you've already calculated using apop_vector_mean. |