1# This file was automatically generated by SWIG (http://www.swig.org). 2# Version 4.0.1 3# 4# Do not make changes to this file unless you know what you are doing--modify 5# the SWIG interface file instead. 6 7package Math::GSL::Statistics; 8use base qw(Exporter); 9use base qw(DynaLoader); 10package Math::GSL::Statisticsc; 11bootstrap Math::GSL::Statistics; 12package Math::GSL::Statistics; 13@EXPORT = qw(); 14 15# ---------- BASE METHODS ------------- 16 17package Math::GSL::Statistics; 18 19sub TIEHASH { 20 my ($classname,$obj) = @_; 21 return bless $obj, $classname; 22} 23 24sub CLEAR { } 25 26sub FIRSTKEY { } 27 28sub NEXTKEY { } 29 30sub FETCH { 31 my ($self,$field) = @_; 32 my $member_func = "swig_${field}_get"; 33 $self->$member_func(); 34} 35 36sub STORE { 37 my ($self,$field,$newval) = @_; 38 my $member_func = "swig_${field}_set"; 39 $self->$member_func($newval); 40} 41 42sub this { 43 my $ptr = shift; 44 return tied(%$ptr); 45} 46 47 48# ------- FUNCTION WRAPPERS -------- 49 50package Math::GSL::Statistics; 51 52*gsl_error = *Math::GSL::Statisticsc::gsl_error; 53*gsl_stream_printf = *Math::GSL::Statisticsc::gsl_stream_printf; 54*gsl_strerror = *Math::GSL::Statisticsc::gsl_strerror; 55*gsl_set_error_handler = *Math::GSL::Statisticsc::gsl_set_error_handler; 56*gsl_set_error_handler_off = *Math::GSL::Statisticsc::gsl_set_error_handler_off; 57*gsl_set_stream_handler = *Math::GSL::Statisticsc::gsl_set_stream_handler; 58*gsl_set_stream = *Math::GSL::Statisticsc::gsl_set_stream; 59*gsl_stats_mean = *Math::GSL::Statisticsc::gsl_stats_mean; 60*gsl_stats_variance = *Math::GSL::Statisticsc::gsl_stats_variance; 61*gsl_stats_sd = *Math::GSL::Statisticsc::gsl_stats_sd; 62*gsl_stats_variance_with_fixed_mean = *Math::GSL::Statisticsc::gsl_stats_variance_with_fixed_mean; 63*gsl_stats_sd_with_fixed_mean = *Math::GSL::Statisticsc::gsl_stats_sd_with_fixed_mean; 64*gsl_stats_tss = *Math::GSL::Statisticsc::gsl_stats_tss; 65*gsl_stats_tss_m = *Math::GSL::Statisticsc::gsl_stats_tss_m; 66*gsl_stats_absdev = *Math::GSL::Statisticsc::gsl_stats_absdev; 67*gsl_stats_skew = *Math::GSL::Statisticsc::gsl_stats_skew; 68*gsl_stats_kurtosis = *Math::GSL::Statisticsc::gsl_stats_kurtosis; 69*gsl_stats_lag1_autocorrelation = *Math::GSL::Statisticsc::gsl_stats_lag1_autocorrelation; 70*gsl_stats_covariance = *Math::GSL::Statisticsc::gsl_stats_covariance; 71*gsl_stats_correlation = *Math::GSL::Statisticsc::gsl_stats_correlation; 72*gsl_stats_spearman = *Math::GSL::Statisticsc::gsl_stats_spearman; 73*gsl_stats_variance_m = *Math::GSL::Statisticsc::gsl_stats_variance_m; 74*gsl_stats_sd_m = *Math::GSL::Statisticsc::gsl_stats_sd_m; 75*gsl_stats_absdev_m = *Math::GSL::Statisticsc::gsl_stats_absdev_m; 76*gsl_stats_skew_m_sd = *Math::GSL::Statisticsc::gsl_stats_skew_m_sd; 77*gsl_stats_kurtosis_m_sd = *Math::GSL::Statisticsc::gsl_stats_kurtosis_m_sd; 78*gsl_stats_lag1_autocorrelation_m = *Math::GSL::Statisticsc::gsl_stats_lag1_autocorrelation_m; 79*gsl_stats_covariance_m = *Math::GSL::Statisticsc::gsl_stats_covariance_m; 80*gsl_stats_wmean = *Math::GSL::Statisticsc::gsl_stats_wmean; 81*gsl_stats_wvariance = *Math::GSL::Statisticsc::gsl_stats_wvariance; 82*gsl_stats_wsd = *Math::GSL::Statisticsc::gsl_stats_wsd; 83*gsl_stats_wvariance_with_fixed_mean = *Math::GSL::Statisticsc::gsl_stats_wvariance_with_fixed_mean; 84*gsl_stats_wsd_with_fixed_mean = *Math::GSL::Statisticsc::gsl_stats_wsd_with_fixed_mean; 85*gsl_stats_wtss = *Math::GSL::Statisticsc::gsl_stats_wtss; 86*gsl_stats_wtss_m = *Math::GSL::Statisticsc::gsl_stats_wtss_m; 87*gsl_stats_wabsdev = *Math::GSL::Statisticsc::gsl_stats_wabsdev; 88*gsl_stats_wskew = *Math::GSL::Statisticsc::gsl_stats_wskew; 89*gsl_stats_wkurtosis = *Math::GSL::Statisticsc::gsl_stats_wkurtosis; 90*gsl_stats_wvariance_m = *Math::GSL::Statisticsc::gsl_stats_wvariance_m; 91*gsl_stats_wsd_m = *Math::GSL::Statisticsc::gsl_stats_wsd_m; 92*gsl_stats_wabsdev_m = *Math::GSL::Statisticsc::gsl_stats_wabsdev_m; 93*gsl_stats_wskew_m_sd = *Math::GSL::Statisticsc::gsl_stats_wskew_m_sd; 94*gsl_stats_wkurtosis_m_sd = *Math::GSL::Statisticsc::gsl_stats_wkurtosis_m_sd; 95*gsl_stats_pvariance = *Math::GSL::Statisticsc::gsl_stats_pvariance; 96*gsl_stats_ttest = *Math::GSL::Statisticsc::gsl_stats_ttest; 97*gsl_stats_max = *Math::GSL::Statisticsc::gsl_stats_max; 98*gsl_stats_min = *Math::GSL::Statisticsc::gsl_stats_min; 99*gsl_stats_minmax = *Math::GSL::Statisticsc::gsl_stats_minmax; 100*gsl_stats_max_index = *Math::GSL::Statisticsc::gsl_stats_max_index; 101*gsl_stats_min_index = *Math::GSL::Statisticsc::gsl_stats_min_index; 102*gsl_stats_minmax_index = *Math::GSL::Statisticsc::gsl_stats_minmax_index; 103*gsl_stats_median_from_sorted_data = *Math::GSL::Statisticsc::gsl_stats_median_from_sorted_data; 104*gsl_stats_quantile_from_sorted_data = *Math::GSL::Statisticsc::gsl_stats_quantile_from_sorted_data; 105*gsl_stats_int_mean = *Math::GSL::Statisticsc::gsl_stats_int_mean; 106*gsl_stats_int_variance = *Math::GSL::Statisticsc::gsl_stats_int_variance; 107*gsl_stats_int_sd = *Math::GSL::Statisticsc::gsl_stats_int_sd; 108*gsl_stats_int_variance_with_fixed_mean = *Math::GSL::Statisticsc::gsl_stats_int_variance_with_fixed_mean; 109*gsl_stats_int_sd_with_fixed_mean = *Math::GSL::Statisticsc::gsl_stats_int_sd_with_fixed_mean; 110*gsl_stats_int_tss = *Math::GSL::Statisticsc::gsl_stats_int_tss; 111*gsl_stats_int_tss_m = *Math::GSL::Statisticsc::gsl_stats_int_tss_m; 112*gsl_stats_int_absdev = *Math::GSL::Statisticsc::gsl_stats_int_absdev; 113*gsl_stats_int_skew = *Math::GSL::Statisticsc::gsl_stats_int_skew; 114*gsl_stats_int_kurtosis = *Math::GSL::Statisticsc::gsl_stats_int_kurtosis; 115*gsl_stats_int_lag1_autocorrelation = *Math::GSL::Statisticsc::gsl_stats_int_lag1_autocorrelation; 116*gsl_stats_int_covariance = *Math::GSL::Statisticsc::gsl_stats_int_covariance; 117*gsl_stats_int_correlation = *Math::GSL::Statisticsc::gsl_stats_int_correlation; 118*gsl_stats_int_spearman = *Math::GSL::Statisticsc::gsl_stats_int_spearman; 119*gsl_stats_int_variance_m = *Math::GSL::Statisticsc::gsl_stats_int_variance_m; 120*gsl_stats_int_sd_m = *Math::GSL::Statisticsc::gsl_stats_int_sd_m; 121*gsl_stats_int_absdev_m = *Math::GSL::Statisticsc::gsl_stats_int_absdev_m; 122*gsl_stats_int_skew_m_sd = *Math::GSL::Statisticsc::gsl_stats_int_skew_m_sd; 123*gsl_stats_int_kurtosis_m_sd = *Math::GSL::Statisticsc::gsl_stats_int_kurtosis_m_sd; 124*gsl_stats_int_lag1_autocorrelation_m = *Math::GSL::Statisticsc::gsl_stats_int_lag1_autocorrelation_m; 125*gsl_stats_int_covariance_m = *Math::GSL::Statisticsc::gsl_stats_int_covariance_m; 126*gsl_stats_int_pvariance = *Math::GSL::Statisticsc::gsl_stats_int_pvariance; 127*gsl_stats_int_ttest = *Math::GSL::Statisticsc::gsl_stats_int_ttest; 128*gsl_stats_int_max = *Math::GSL::Statisticsc::gsl_stats_int_max; 129*gsl_stats_int_min = *Math::GSL::Statisticsc::gsl_stats_int_min; 130*gsl_stats_int_minmax = *Math::GSL::Statisticsc::gsl_stats_int_minmax; 131*gsl_stats_int_max_index = *Math::GSL::Statisticsc::gsl_stats_int_max_index; 132*gsl_stats_int_min_index = *Math::GSL::Statisticsc::gsl_stats_int_min_index; 133*gsl_stats_int_minmax_index = *Math::GSL::Statisticsc::gsl_stats_int_minmax_index; 134*gsl_stats_int_median_from_sorted_data = *Math::GSL::Statisticsc::gsl_stats_int_median_from_sorted_data; 135*gsl_stats_int_quantile_from_sorted_data = *Math::GSL::Statisticsc::gsl_stats_int_quantile_from_sorted_data; 136*gsl_stats_char_mean = *Math::GSL::Statisticsc::gsl_stats_char_mean; 137*gsl_stats_char_variance = *Math::GSL::Statisticsc::gsl_stats_char_variance; 138*gsl_stats_char_sd = *Math::GSL::Statisticsc::gsl_stats_char_sd; 139*gsl_stats_char_variance_with_fixed_mean = *Math::GSL::Statisticsc::gsl_stats_char_variance_with_fixed_mean; 140*gsl_stats_char_sd_with_fixed_mean = *Math::GSL::Statisticsc::gsl_stats_char_sd_with_fixed_mean; 141*gsl_stats_char_tss = *Math::GSL::Statisticsc::gsl_stats_char_tss; 142*gsl_stats_char_tss_m = *Math::GSL::Statisticsc::gsl_stats_char_tss_m; 143*gsl_stats_char_absdev = *Math::GSL::Statisticsc::gsl_stats_char_absdev; 144*gsl_stats_char_skew = *Math::GSL::Statisticsc::gsl_stats_char_skew; 145*gsl_stats_char_kurtosis = *Math::GSL::Statisticsc::gsl_stats_char_kurtosis; 146*gsl_stats_char_lag1_autocorrelation = *Math::GSL::Statisticsc::gsl_stats_char_lag1_autocorrelation; 147*gsl_stats_char_covariance = *Math::GSL::Statisticsc::gsl_stats_char_covariance; 148*gsl_stats_char_correlation = *Math::GSL::Statisticsc::gsl_stats_char_correlation; 149*gsl_stats_char_spearman = *Math::GSL::Statisticsc::gsl_stats_char_spearman; 150*gsl_stats_char_variance_m = *Math::GSL::Statisticsc::gsl_stats_char_variance_m; 151*gsl_stats_char_sd_m = *Math::GSL::Statisticsc::gsl_stats_char_sd_m; 152*gsl_stats_char_absdev_m = *Math::GSL::Statisticsc::gsl_stats_char_absdev_m; 153*gsl_stats_char_skew_m_sd = *Math::GSL::Statisticsc::gsl_stats_char_skew_m_sd; 154*gsl_stats_char_kurtosis_m_sd = *Math::GSL::Statisticsc::gsl_stats_char_kurtosis_m_sd; 155*gsl_stats_char_lag1_autocorrelation_m = *Math::GSL::Statisticsc::gsl_stats_char_lag1_autocorrelation_m; 156*gsl_stats_char_covariance_m = *Math::GSL::Statisticsc::gsl_stats_char_covariance_m; 157*gsl_stats_char_pvariance = *Math::GSL::Statisticsc::gsl_stats_char_pvariance; 158*gsl_stats_char_ttest = *Math::GSL::Statisticsc::gsl_stats_char_ttest; 159*gsl_stats_char_max = *Math::GSL::Statisticsc::gsl_stats_char_max; 160*gsl_stats_char_min = *Math::GSL::Statisticsc::gsl_stats_char_min; 161*gsl_stats_char_minmax = *Math::GSL::Statisticsc::gsl_stats_char_minmax; 162*gsl_stats_char_max_index = *Math::GSL::Statisticsc::gsl_stats_char_max_index; 163*gsl_stats_char_min_index = *Math::GSL::Statisticsc::gsl_stats_char_min_index; 164*gsl_stats_char_minmax_index = *Math::GSL::Statisticsc::gsl_stats_char_minmax_index; 165*gsl_stats_char_median_from_sorted_data = *Math::GSL::Statisticsc::gsl_stats_char_median_from_sorted_data; 166*gsl_stats_char_quantile_from_sorted_data = *Math::GSL::Statisticsc::gsl_stats_char_quantile_from_sorted_data; 167 168# ------- VARIABLE STUBS -------- 169 170package Math::GSL::Statistics; 171 172*GSL_VERSION = *Math::GSL::Statisticsc::GSL_VERSION; 173*GSL_MAJOR_VERSION = *Math::GSL::Statisticsc::GSL_MAJOR_VERSION; 174*GSL_MINOR_VERSION = *Math::GSL::Statisticsc::GSL_MINOR_VERSION; 175*GSL_POSZERO = *Math::GSL::Statisticsc::GSL_POSZERO; 176*GSL_NEGZERO = *Math::GSL::Statisticsc::GSL_NEGZERO; 177*GSL_SUCCESS = *Math::GSL::Statisticsc::GSL_SUCCESS; 178*GSL_FAILURE = *Math::GSL::Statisticsc::GSL_FAILURE; 179*GSL_CONTINUE = *Math::GSL::Statisticsc::GSL_CONTINUE; 180*GSL_EDOM = *Math::GSL::Statisticsc::GSL_EDOM; 181*GSL_ERANGE = *Math::GSL::Statisticsc::GSL_ERANGE; 182*GSL_EFAULT = *Math::GSL::Statisticsc::GSL_EFAULT; 183*GSL_EINVAL = *Math::GSL::Statisticsc::GSL_EINVAL; 184*GSL_EFAILED = *Math::GSL::Statisticsc::GSL_EFAILED; 185*GSL_EFACTOR = *Math::GSL::Statisticsc::GSL_EFACTOR; 186*GSL_ESANITY = *Math::GSL::Statisticsc::GSL_ESANITY; 187*GSL_ENOMEM = *Math::GSL::Statisticsc::GSL_ENOMEM; 188*GSL_EBADFUNC = *Math::GSL::Statisticsc::GSL_EBADFUNC; 189*GSL_ERUNAWAY = *Math::GSL::Statisticsc::GSL_ERUNAWAY; 190*GSL_EMAXITER = *Math::GSL::Statisticsc::GSL_EMAXITER; 191*GSL_EZERODIV = *Math::GSL::Statisticsc::GSL_EZERODIV; 192*GSL_EBADTOL = *Math::GSL::Statisticsc::GSL_EBADTOL; 193*GSL_ETOL = *Math::GSL::Statisticsc::GSL_ETOL; 194*GSL_EUNDRFLW = *Math::GSL::Statisticsc::GSL_EUNDRFLW; 195*GSL_EOVRFLW = *Math::GSL::Statisticsc::GSL_EOVRFLW; 196*GSL_ELOSS = *Math::GSL::Statisticsc::GSL_ELOSS; 197*GSL_EROUND = *Math::GSL::Statisticsc::GSL_EROUND; 198*GSL_EBADLEN = *Math::GSL::Statisticsc::GSL_EBADLEN; 199*GSL_ENOTSQR = *Math::GSL::Statisticsc::GSL_ENOTSQR; 200*GSL_ESING = *Math::GSL::Statisticsc::GSL_ESING; 201*GSL_EDIVERGE = *Math::GSL::Statisticsc::GSL_EDIVERGE; 202*GSL_EUNSUP = *Math::GSL::Statisticsc::GSL_EUNSUP; 203*GSL_EUNIMPL = *Math::GSL::Statisticsc::GSL_EUNIMPL; 204*GSL_ECACHE = *Math::GSL::Statisticsc::GSL_ECACHE; 205*GSL_ETABLE = *Math::GSL::Statisticsc::GSL_ETABLE; 206*GSL_ENOPROG = *Math::GSL::Statisticsc::GSL_ENOPROG; 207*GSL_ENOPROGJ = *Math::GSL::Statisticsc::GSL_ENOPROGJ; 208*GSL_ETOLF = *Math::GSL::Statisticsc::GSL_ETOLF; 209*GSL_ETOLX = *Math::GSL::Statisticsc::GSL_ETOLX; 210*GSL_ETOLG = *Math::GSL::Statisticsc::GSL_ETOLG; 211*GSL_EOF = *Math::GSL::Statisticsc::GSL_EOF; 212 213@EXPORT_OK = qw/ 214 gsl_stats_mean 215 gsl_stats_variance 216 gsl_stats_sd 217 gsl_stats_variance_with_fixed_mean 218 gsl_stats_sd_with_fixed_mean 219 gsl_stats_tss 220 gsl_stats_tss_m 221 gsl_stats_absdev 222 gsl_stats_skew 223 gsl_stats_kurtosis 224 gsl_stats_lag1_autocorrelation 225 gsl_stats_covariance 226 gsl_stats_correlation 227 gsl_stats_variance_m 228 gsl_stats_sd_m 229 gsl_stats_absdev_m 230 gsl_stats_skew_m_sd 231 gsl_stats_kurtosis_m_sd 232 gsl_stats_lag1_autocorrelation_m 233 gsl_stats_covariance_m 234 gsl_stats_wmean 235 gsl_stats_wvariance 236 gsl_stats_wsd 237 gsl_stats_wvariance_with_fixed_mean 238 gsl_stats_wsd_with_fixed_mean 239 gsl_stats_wtss 240 gsl_stats_wtss_m 241 gsl_stats_wabsdev 242 gsl_stats_wskew 243 gsl_stats_wkurtosis 244 gsl_stats_wvariance_m 245 gsl_stats_wsd_m 246 gsl_stats_wabsdev_m 247 gsl_stats_wskew_m_sd 248 gsl_stats_wkurtosis_m_sd 249 gsl_stats_pvariance 250 gsl_stats_ttest 251 gsl_stats_max 252 gsl_stats_min 253 gsl_stats_minmax 254 gsl_stats_max_index 255 gsl_stats_min_index 256 gsl_stats_minmax_index 257 gsl_stats_median_from_sorted_data 258 gsl_stats_quantile_from_sorted_data 259 /; 260our @EXPORT_int = qw/ 261 gsl_stats_int_mean 262 gsl_stats_int_variance 263 gsl_stats_int_sd 264 gsl_stats_int_variance_with_fixed_mean 265 gsl_stats_int_sd_with_fixed_mean 266 gsl_stats_int_tss 267 gsl_stats_int_tss_m 268 gsl_stats_int_absdev 269 gsl_stats_int_skew 270 gsl_stats_int_kurtosis 271 gsl_stats_int_lag1_autocorrelation 272 gsl_stats_int_covariance 273 gsl_stats_int_correlation 274 gsl_stats_int_variance_m 275 gsl_stats_int_sd_m 276 gsl_stats_int_absdev_m 277 gsl_stats_int_skew_m_sd 278 gsl_stats_int_kurtosis_m_sd 279 gsl_stats_int_lag1_autocorrelation_m 280 gsl_stats_int_covariance_m 281 gsl_stats_int_pvariance 282 gsl_stats_int_ttest 283 gsl_stats_int_max 284 gsl_stats_int_min 285 gsl_stats_int_minmax 286 gsl_stats_int_max_index 287 gsl_stats_int_min_index 288 gsl_stats_int_minmax_index 289 gsl_stats_int_median_from_sorted_data 290 gsl_stats_int_quantile_from_sorted_data 291 /; 292our @EXPORT_char = qw/ 293 gsl_stats_char_mean 294 gsl_stats_char_variance 295 gsl_stats_char_sd 296 gsl_stats_char_variance_with_fixed_mean 297 gsl_stats_char_sd_with_fixed_mean 298 gsl_stats_char_tss 299 gsl_stats_char_tss_m 300 gsl_stats_char_absdev 301 gsl_stats_char_skew 302 gsl_stats_char_kurtosis 303 gsl_stats_char_lag1_autocorrelation 304 gsl_stats_char_covariance 305 gsl_stats_char_correlation 306 gsl_stats_char_variance_m 307 gsl_stats_char_sd_m 308 gsl_stats_char_absdev_m 309 gsl_stats_char_skew_m_sd 310 gsl_stats_char_kurtosis_m_sd 311 gsl_stats_char_lag1_autocorrelation_m 312 gsl_stats_char_covariance_m 313 gsl_stats_char_pvariance 314 gsl_stats_char_ttest 315 gsl_stats_char_max 316 gsl_stats_char_min 317 gsl_stats_char_minmax 318 gsl_stats_char_max_index 319 gsl_stats_char_min_index 320 gsl_stats_char_minmax_index 321 gsl_stats_char_median_from_sorted_data 322 gsl_stats_char_quantile_from_sorted_data 323 /; 324push @EXPORT_OK, @EXPORT_int, @EXPORT_char; 325%EXPORT_TAGS = ( 326 all => \@EXPORT_OK, 327 int => \@EXPORT_int, 328 char => \@EXPORT_char 329 ); 330__END__ 331 332=encoding utf8 333 334=head1 NAME 335 336Math::GSL::Statistics - Statistical functions 337 338=head1 SYNOPSIS 339 340 use Math::GSL::Statistics qw /:all/; 341 342 my $data = [17.2, 18.1, 16.5, 18.3, 12.6]; 343 my $mean = gsl_stats_mean($data, 1, 5); 344 my $variance = gsl_stats_variance($data, 1, 5); 345 my $largest = gsl_stats_max($data, 1, 5); 346 my $smallest = gsl_stats_min($data, 1, 5); 347 print qq{ 348 Dataset : @$data 349 Sample mean $mean 350 Estimated variance $variance 351 Largest value $largest 352 Smallest value $smallest 353 }; 354 355 356=head1 DESCRIPTION 357 358Here is a list of all the functions in this module : 359 360=over 2 361 362=item * C<gsl_stats_mean($data, $stride, $n)> - This function returns the arithmetic mean of the array reference $data, a dataset of length $n with stride $stride. The arithmetic mean, or sample mean, is denoted by \Hat\mu and defined as, \Hat\mu = (1/N) \sum x_i where x_i are the elements of the dataset $data. For samples drawn from a gaussian distribution the variance of \Hat\mu is \sigma^2 / N. 363 364=item * C<gsl_stats_variance($data, $stride, $n)> - This function returns the estimated, or sample, variance of data, an array reference of length $n with stride $stride. The estimated variance is denoted by \Hat\sigma^2 and is defined by, \Hat\sigma^2 = (1/(N-1)) \sum (x_i - \Hat\mu)^2 where x_i are the elements of the dataset data. Note that the normalization factor of 1/(N-1) results from the derivation of \Hat\sigma^2 as an unbiased estimator of the population variance \sigma^2. For samples drawn from a gaussian distribution the variance of \Hat\sigma^2 itself is 2 \sigma^4 / N. This function computes the mean via a call to gsl_stats_mean. If you have already computed the mean then you can pass it directly to gsl_stats_variance_m. 365 366=item * C<gsl_stats_sd($data, $stride, $n)> 367 368=item * C<gsl_stats_sd_m($data, $stride, $n, $mean)> 369 370The standard deviation is defined as the square root of the variance. These functions return the square root of the corresponding variance functions above. 371 372=item * C<gsl_stats_variance_with_fixed_mean($data, $stride, $n, $mean)> - This function calculates the standard deviation of the array reference $data for a fixed population mean $mean. The result is the square root of the corresponding variance function. 373 374=item * C<gsl_stats_sd_with_fixed_mean($data, $stride, $n, $mean)> - This function computes an unbiased estimate of the variance of data when the population mean $mean of the underlying distribution is known a priori. In this case the estimator for the variance uses the factor 1/N and the sample mean \Hat\mu is replaced by the known population mean \mu, \Hat\sigma^2 = (1/N) \sum (x_i - \mu)^2 375 376=item * C<gsl_stats_tss($data, $stride, $n)> 377 378=item * C<gsl_stats_tss_m($data, $stride, $n, $mean)> 379 380These functions return the total sum of squares (TSS) of data about the mean. For gsl_stats_tss_m the user-supplied value of mean is used, and for gsl_stats_tss it is computed using gsl_stats_mean. TSS = \sum (x_i - mean)^2 381 382=item * C<gsl_stats_absdev($data, $stride, $n)> - This function computes the absolute deviation from the mean of data, a dataset of length $n with stride $stride. The absolute deviation from the mean is defined as, absdev = (1/N) \sum |x_i - \Hat\mu| where x_i are the elements of the array reference $data. The absolute deviation from the mean provides a more robust measure of the width of a distribution than the variance. This function computes the mean of data via a call to gsl_stats_mean. 383 384=item * C<gsl_stats_skew($data, $stride, $n)> - This function computes the skewness of $data, a dataset in the form of an array reference of length $n with stride $stride. The skewness is defined as, skew = (1/N) \sum ((x_i - \Hat\mu)/\Hat\sigma)^3 where x_i are the elements of the dataset $data. The skewness measures the asymmetry of the tails of a distribution. The function computes the mean and estimated standard deviation of data via calls to gsl_stats_mean and gsl_stats_sd. 385 386=item * C<gsl_stats_skew_m_sd($data, $stride, $n, $mean, $sd)> - This function computes the skewness of the array reference $data using the given values of the mean $mean and standard deviation $sd, skew = (1/N) \sum ((x_i - mean)/sd)^3. These functions are useful if you have already computed the mean and standard deviation of $data and want to avoid recomputing them. 387 388=item * C<gsl_stats_kurtosis($data, $stride, $n)> - This function computes the kurtosis of data, an array reference of length $n with stride $stride. The kurtosis is defined as, kurtosis = ((1/N) \sum ((x_i - \Hat\mu)/\Hat\sigma)^4) - 3. The kurtosis measures how sharply peaked a distribution is, relative to its width. The kurtosis is normalized to zero for a gaussian distribution. 389 390=item * C<gsl_stats_kurtosis_m_sd($data, $stride, $n, $mean, $sd)> - This function computes the kurtosis of the array reference $data using the given values of the mean $mean and standard deviation $sd, kurtosis = ((1/N) \sum ((x_i - mean)/sd)^4) - 3. This function is useful if you have already computed the mean and standard deviation of data and want to avoid recomputing them. 391 392=item * C<gsl_stats_lag1_autocorrelation($data, $stride, $n)> - This function computes the lag-1 autocorrelation of the array reference data. 393 a_1 = {\sum_{i = 1}^{n} (x_{i} - \Hat\mu) (x_{i-1} - \Hat\mu) 394 \over 395 \sum_{i = 1}^{n} (x_{i} - \Hat\mu) (x_{i} - \Hat\mu)} 396 397=item * C<gsl_stats_lag1_autocorrelation_m($data, $stride, $n, $mean)> - This function computes the lag-1 autocorrelation of the array reference $data using the given value of the mean $mean. 398 399=item * C<gsl_stats_covariance($data1, $stride1, $data2, $stride2, $n)> - This function computes the covariance of the array reference $data1 and $data2 which must both be of the same length $n. covar = (1/(n - 1)) \sum_{i = 1}^{n} (x_i - \Hat x) (y_i - \Hat y) 400 401=item * C<gsl_stats_covariance_m($data1, $stride1, $data2, $stride2, $n, $mean1, $mean2)> - This function computes the covariance of the array reference $data1 and $data2 using the given values of the means, $mean1 and $mean2. This is useful if you have already computed the means of $data1 and $data2 and want to avoid recomputing them. 402 403=item * C<gsl_stats_correlation($data1, $stride1, $data2, $stride2, $n)> - This function efficiently computes the Pearson correlation coefficient between the array reference $data1 and $data2 which must both be of the same length $n. 404 r = cov(x, y) / (\Hat\sigma_x \Hat\sigma_y) 405 = {1/(n-1) \sum (x_i - \Hat x) (y_i - \Hat y) 406 \over 407 \sqrt{1/(n-1) \sum (x_i - \Hat x)^2} \sqrt{1/(n-1) \sum (y_i - \Hat y)^2} 408 } 409 410=item * C<gsl_stats_variance_m($data, $stride, $n, $mean)> - This function returns the sample variance of $data, an array reference, relative to the given value of $mean. The function is computed with \Hat\mu replaced by the value of mean that you supply, \Hat\sigma^2 = (1/(N-1)) \sum (x_i - mean)^2 411 412=item * C<gsl_stats_absdev_m($data, $stride, $n, $mean)> - This function computes the absolute deviation of the dataset $data, an array refrence, relative to the given value of $mean, absdev = (1/N) \sum |x_i - mean|. This function is useful if you have already computed the mean of data (and want to avoid recomputing it), or wish to calculate the absolute deviation relative to another value (such as zero, or the median). 413 414=item * C<gsl_stats_wmean($w, $wstride, $data, $stride, $n)> - This function returns the weighted mean of the dataset $data array reference with stride $stride and length $n, using the set of weights $w, which is an array reference, with stride $wstride and length $n. The weighted mean is defined as, \Hat\mu = (\sum w_i x_i) / (\sum w_i) 415 416=item * C<gsl_stats_wvariance($w, $wstride, $data, $stride, $n)> - This function returns the estimated variance of the dataset $data, which is the dataset, with stride $stride and length $n, using the set of weights $w (as an array reference) with stride $wstride and length $n. The estimated variance of a weighted dataset is defined as, \Hat\sigma^2 = ((\sum w_i)/((\sum w_i)^2 - \sum (w_i^2))) \sum w_i (x_i - \Hat\mu)^2. Note that this expression reduces to an unweighted variance with the familiar 1/(N-1) factor when there are N equal non-zero weights. 417 418=item * C<gsl_stats_wvariance_m($w, $wstride, $data, $stride, $n, $wmean, $wsd)> - This function returns the estimated variance of the weighted dataset $data (which is an array reference) using the given weighted mean $wmean. 419 420=item * C<gsl_stats_wsd($w, $wstride, $data, $stride, $n)> - The standard deviation is defined as the square root of the variance. This function returns the square root of the corresponding variance function gsl_stats_wvariance above. 421 422=item * C<gsl_stats_wsd_m($w, $wstride, $data, $stride, $n, $wmean)> - This function returns the square root of the corresponding variance function gsl_stats_wvariance_m above. 423 424=item * C<gsl_stats_wvariance_with_fixed_mean($w, $wstride, $data, $stride, $n, $mean)> - This function computes an unbiased estimate of the variance of weighted dataset $data (which is an array reference) when the population mean $mean of the underlying distribution is known a priori. In this case the estimator for the variance replaces the sample mean \Hat\mu by the known population mean \mu, \Hat\sigma^2 = (\sum w_i (x_i - \mu)^2) / (\sum w_i) 425 426=item * C<gsl_stats_wsd_with_fixed_mean($w, $wstride, $data, $stride, $n, $mean)> - The standard deviation is defined as the square root of the variance. This function returns the square root of the corresponding variance function above. 427 428=item * C<gsl_stats_wtss($w, $wstride, $data, $stride, $n)> 429 430=item * C<gsl_stats_wtss_m($w, $wstride, $data, $stride, $n, $wmean)> - These functions return the weighted total sum of squares (TSS) of data about the weighted mean. For gsl_stats_wtss_m the user-supplied value of $wmean is used, and for gsl_stats_wtss it is computed using gsl_stats_wmean. TSS = \sum w_i (x_i - wmean)^2 431 432=item * C<gsl_stats_wabsdev($w, $wstride, $data, $stride, $n)> - This function computes the weighted absolute deviation from the weighted mean of $data, which is an array reference. The absolute deviation from the mean is defined as, absdev = (\sum w_i |x_i - \Hat\mu|) / (\sum w_i) 433 434=item * C<gsl_stats_wabsdev_m($w, $wstride, $data, $stride, $n, $wmean)> - This function computes the absolute deviation of the weighted dataset $data (an array reference) about the given weighted mean $wmean. 435 436=item * C<gsl_stats_wskew($w, $wstride, $data, $stride, $n)> - This function computes the weighted skewness of the dataset $data, an array reference. skew = (\sum w_i ((x_i - xbar)/\sigma)^3) / (\sum w_i) 437 438=item * C<gsl_stats_wskew_m_sd($w, $wstride, $data, $stride, $n, $wmean, $wsd)> - This function computes the weighted skewness of the dataset $data using the given values of the weighted mean and weighted standard deviation, $wmean and $wsd. 439 440=item * C<gsl_stats_wkurtosis($w, $wstride, $data, $stride, $n)> - This function computes the weighted kurtosis of the dataset $data, an array reference. kurtosis = ((\sum w_i ((x_i - xbar)/sigma)^4) / (\sum w_i)) - 3 441 442=item * C<gsl_stats_wkurtosis_m_sd($w, $wstride, $data, $stride, $n, $wmean, $wsd)> - This function computes the weighted kurtosis of the dataset $data, an array reference, using the given values of the weighted mean and weighted standard deviation, $wmean and $wsd. 443 444=item * C<gsl_stats_pvariance($data, $stride, $n, $data2, $stride2, $n2)> 445 446=item * C<gsl_stats_ttest($data1, $stride1, $n1, $data2, $stride2, $n2)> 447 448=item * C<gsl_stats_max($data, $stride, $n)> - This function returns the maximum value in the $data array reference, a dataset of length $n with stride $stride. The maximum value is defined as the value of the element x_i which satisfies x_i >= x_j for all j. If you want instead to find the element with the largest absolute magnitude you will need to apply fabs or abs to your data before calling this function. 449 450=item * C<gsl_stats_min($data, $stride, $n)> - This function returns the minimum value in $data (which is an array reference) a dataset of length $n with stride $stride. The minimum value is defined as the value of the element x_i which satisfies x_i <= x_j for all j. If you want instead to find the element with the smallest absolute magnitude you will need to apply fabs or abs to your data before calling this function. 451 452=item * C<gsl_stats_minmax($data, $stride, $n)> - This function finds both the minimum and maximum values in $data, which is an array reference, in a single pass and returns them in this order. 453 454=item * C<gsl_stats_max_index($data, $stride, $n)> - This function returns the index of the maximum value in $data array reference, a dataset of length $n with stride $stride. 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. 455 456=item * C<gsl_stats_min_index($data, $stride, $n)> - This function returns the index of the minimum value in $data array reference, a dataset of length $n with stride $stride. 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. 457 458=item * C<gsl_stats_minmax_index($data, $stride, $n)> - This function returns the indexes of the minimum and maximum values in $data, an array reference in a single pass. The value are returned in this order. 459 460=item * C<gsl_stats_median_from_sorted_data($sorted_data, $stride, $n)> - This function returns the median value of $sorted_data (which is an array reference), a dataset of length $n with stride $stride. The elements of the array must be in ascending numerical order. There are no checks to see whether the data are sorted, so the function gsl_sort should always be used first. This function can be found in the Math::GSL::Sort module. When the dataset has an odd number of elements the median is the value of element (n-1)/2. When the dataset has an even number of elements the median is the mean of the two nearest middle values, elements (n-1)/2 and n/2. Since the algorithm for computing the median involves interpolation this function always returns a floating-point number, even for integer data types. 461 462=item * C<gsl_stats_quantile_from_sorted_data($sorted_data, $stride, $n, $f)> - This function returns a quantile value of $sorted_data, a double-precision array reference of length $n with stride $stride. The elements of the array must be in ascending numerical order. The quantile is determined by the f, a fraction between 0 and 1. For example, to compute the value of the 75th percentile f should have the value 0.75. There are no checks to see whether the data are sorted, so the function gsl_sort should always be used first. This function can be found in the Math::GSL::Sort module. The quantile is found by interpolation, using the formula quantile = (1 - \delta) x_i + \delta x_{i+1} where i is floor((n - 1)f) and \delta is (n-1)f - i. Thus the minimum value of the array (data[0*stride]) is given by f equal to zero, the maximum value (data[(n-1)*stride]) is given by f equal to one and the median value is given by f equal to 0.5. Since the algorithm for computing quantiles involves interpolation this function always returns a floating-point number, even for integer data types. 463 464=back 465 466The following function are simply variants for int and char of the last functions: 467 468=over 4 469 470=item * C<gsl_stats_int_mean > 471 472=item * C<gsl_stats_int_variance > 473 474=item * C<gsl_stats_int_sd > 475 476=item * C<gsl_stats_int_variance_with_fixed_mean > 477 478=item * C<gsl_stats_int_sd_with_fixed_mean > 479 480=item * C<gsl_stats_int_tss > 481 482=item * C<gsl_stats_int_tss_m > 483 484=item * C<gsl_stats_int_absdev > 485 486=item * C<gsl_stats_int_skew > 487 488=item * C<gsl_stats_int_kurtosis > 489 490=item * C<gsl_stats_int_lag1_autocorrelation > 491 492=item * C<gsl_stats_int_covariance > 493 494=item * C<gsl_stats_int_correlation > 495 496=item * C<gsl_stats_int_variance_m > 497 498=item * C<gsl_stats_int_sd_m > 499 500=item * C<gsl_stats_int_absdev_m > 501 502=item * C<gsl_stats_int_skew_m_sd > 503 504=item * C<gsl_stats_int_kurtosis_m_sd > 505 506=item * C<gsl_stats_int_lag1_autocorrelation_m > 507 508=item * C<gsl_stats_int_covariance_m > 509 510=item * C<gsl_stats_int_pvariance > 511 512=item * C<gsl_stats_int_ttest > 513 514=item * C<gsl_stats_int_max > 515 516=item * C<gsl_stats_int_min > 517 518=item * C<gsl_stats_int_minmax > 519 520=item * C<gsl_stats_int_max_index > 521 522=item * C<gsl_stats_int_min_index > 523 524=item * C<gsl_stats_int_minmax_index > 525 526=item * C<gsl_stats_int_median_from_sorted_data > 527 528=item * C<gsl_stats_int_quantile_from_sorted_data > 529 530=item * C<gsl_stats_char_mean > 531 532=item * C<gsl_stats_char_variance > 533 534=item * C<gsl_stats_char_sd > 535 536=item * C<gsl_stats_char_variance_with_fixed_mean > 537 538=item * C<gsl_stats_char_sd_with_fixed_mean > 539 540=item * C<gsl_stats_char_tss > 541 542=item * C<gsl_stats_char_tss_m > 543 544=item * C<gsl_stats_char_absdev > 545 546=item * C<gsl_stats_char_skew > 547 548=item * C<gsl_stats_char_kurtosis > 549 550=item * C<gsl_stats_char_lag1_autocorrelation > 551 552=item * C<gsl_stats_char_covariance > 553 554=item * C<gsl_stats_char_correlation > 555 556=item * C<gsl_stats_char_variance_m > 557 558=item * C<gsl_stats_char_sd_m > 559 560=item * C<gsl_stats_char_absdev_m > 561 562=item * C<gsl_stats_char_skew_m_sd > 563 564=item * C<gsl_stats_char_kurtosis_m_sd > 565 566=item * C<gsl_stats_char_lag1_autocorrelation_m > 567 568=item * C<gsl_stats_char_covariance_m > 569 570=item * C<gsl_stats_char_pvariance > 571 572=item * C<gsl_stats_char_ttest > 573 574=item * C<gsl_stats_char_max > 575 576=item * C<gsl_stats_char_min > 577 578=item * C<gsl_stats_char_minmax > 579 580=item * C<gsl_stats_char_max_index > 581 582=item * C<gsl_stats_char_min_index > 583 584=item * C<gsl_stats_char_minmax_index > 585 586=item * C<gsl_stats_char_median_from_sorted_data > 587 588=item * C<gsl_stats_char_quantile_from_sorted_data > 589 590=back 591 592You have to add the functions you want to use inside the qw /put_function_here /. 593You can also write use Math::GSL::Statistics qw/:all/; to use all available functions of the module. 594Other tags are also available, here is a complete list of all tags for this module : 595 596=over 597 598=item all 599 600=item int 601 602=item char 603 604=back 605 606For more informations on the functions, we refer you to the GSL official 607documentation: L<http://www.gnu.org/software/gsl/manual/html_node/> 608 609 610 611 612=head1 AUTHORS 613 614Jonathan "Duke" Leto <jonathan@leto.net> and Thierry Moisan <thierry.moisan@gmail.com> 615 616=head1 COPYRIGHT AND LICENSE 617 618Copyright (C) 2008-2021 Jonathan "Duke" Leto and Thierry Moisan 619 620This program is free software; you can redistribute it and/or modify it 621under the same terms as Perl itself. 622 623=cut 624 625 6261; 627