📄 goose-ref.texi
字号:
range is defined to be the difference of the third and firstquartiles.@end deftypemethod@deftypemethod RealSet double decile (int @var{i})Returns the @var{i}th decile of the RealSet.@end deftypemethod@deftypemethod RealSet double mean_trimmed (int @var{l}, int @var{r})Returns the mean of the elements of the RealSet, excluding the @var{l}smallest and @var{r} largest values. (Here the letters @var{l} and@var{r} refer to the ``left'' and ``right'' sides of the data. If weimagine the data to be sorted from high to low and lined up in a singlerow across a page, we would be removing @var{l} from the left side and@var{r} from the right.)@end deftypemethod@deftypemethod RealSet double mean_trimmed (int @var{t})Returns the mean of the elements of the RealSet, excludingthe @var{t} smallest and @var{t} largest values.@end deftypemethod@deftypemethod RealSet double mean_winsorized (int @var{l}, int @var{r})Return the (@var{l},@var{r})-Winsorized mean of the RealSet.In statistics, to winsorize a data set means to replacing the@var{l} smallest and @var{r} largest values of the data set by the@var{(l+1)}st smallest and @var{(r+1)}st largest elements, respectively.This operation throws out the most extreme values in the data andreplaces them by certain values that are presumed to be ``morerepresentative''.@texIn mathematical notation, this function returns the quantity$${l x_{(l+1)} + \sum_{i=l+1}^{N-r} x_{(i)} + r x_{(N-r)} \over N}.$$@end tex@end deftypemethod@deftypemethod RealSet double mean_winsorized (int @var{t})@end deftypemethod@deftypemethod RealSet double moment (int @var{k}, int @var{x})@end deftypemethod@deftypemethod RealSet double moment (int @var{k})@end deftypemethod@deftypemethod RealSet double gmean ()@end deftypemethod@deftypemethod RealSet double hmean ()@end deftypemethod@deftypemethod RealSet double rms ()@end deftypemethod@deftypemethod RealSet double meandev ()@end deftypemethod@deftypemethod RealSet double meddev ()@end deftypemethod@deftypemethod RealSet double kurtosis ()@end deftypemethod@deftypemethod RealSet double skewness ()@end deftypemethod@deftypemethod RealSet double excess_kurtosis ()@end deftypemethod@deftypemethod RealSet double momental_skewness ()@end deftypemethod@deftypemethod RealSet double durbin_watson ()Returns the Durbin-Watson statistic for the RealSet. Unlike most ofstatistics discussed so far, this depends on the order of the elements.@texThe Durbin-Watson statistic is defined to be the expression$$ {\sum_{i=2}^N (x_i - x_{i-1})^2 \over \sum_{i=1}^N x_i^2}. $$@end tex@end deftypemethod@deftypemethod RealSet double AR1_independence_z ()@end deftypemethod@deftypemethod RealSet double autocorr (int @var{lag})@end deftypemethod@deftypemethod RealSet double autocorr_z (int @var{lag})@end deftypemethod@deftypemethod RealSet double covar (const RealSet& @var{rs})@end deftypemethod@deftypemethod RealSet double corr (const RealSet& @var{rs})@end deftypemethod@deftypemethod RealSet double pooled_mean (const RealSet& @var{rs})@end deftypemethod@deftypemethod RealSet double pooled_var (const RealSet& @var{rs})@end deftypemethod@deftypemethod RealSet double weighted_mean (const RealSet& @var{rs})@end deftypemethod@deftypemethod RealSet size_t greater_than (double @var{x})Returns the number of elements of the RealSet that are strictly greater than@var{x}.@end deftypemethod@deftypemethod RealSet size_t less_than (double @var{x})Returns the number of elements of the RealSet that are strictly less than@var{x}.@end deftypemethod@deftypemethod RealSet size_t between (double @var{a}, double @var{b})Returns the number of elements of the RealSet that are between @var{a} and@var{b}, inclusive.@end deftypemethod@deftypemethod RealSet size_t equal_to (double @var{x})Returns the number of elements of the RealSet that are equal to @var{x}.@end deftypemethod@section Global Transformations on a RealSet@deftypemethod RealSet void apply(FunctionObject @var{f})This is a template function that takes any function object @var{f} andapplies it to each element of the RealSet, replacing the elements withthe calculated values.@end deftypemethod@deftypemethod RealSet void linear_transform(double @var{a}, double @var{b})Iterates across the elements of the RealSet, replacing each element @var{x} by@var{a}@var{x}+@var{b}.@end deftypemethod@deftypemethod RealSet void log_transform ()Iterates across the elements of the RealSet, replacing each elements byits natural logarithm. An exception is thrown if any element is lessthan or equal to zero.@end deftypemethod@deftypemethod RealSet void exp_transform ()Iterates across the elements of the RealSet, applying the exponentialfunction to each element.@end deftypemethod@deftypemethod RealSet void logit_transform ()Iterates across the elements, applying the logit transform to each element.@texThe logit transform maps $x$ to $\log(x/(1-x))$.@end tex@end deftypemethod@deftypemethod RealSet void reverse ()Reverses the order of the elements in the RealSet.@end deftypemethod@deftypemethod RealSet void sort (int @var{dir} = 1)If @var{dir} is greater than zero, sorts the elements of the RealSet inascending order. If @var{dir} is less than zero, the sort is performedin descending order.@end deftypemethod@deftypemethod RealSet void scramble ()Randomly permutes the elements of the RealSet.@end deftypemethod@deftypemethod RealSet void rank ()Replaces each element of the RealSet by its rank within that RealSet.In the case of ties, ranks are averages, following the usual statisticalconvention.@end deftypemethod@c ***************************************************************************@node Linear Regression, Bootstrapping Functions, The RealSet Class, Top@chapter Linear Regression@section Simple Linear Regression@section Multiple RegressionMultiple Regression currently not implemented in Goose.@c ***************************************************************************@node Bootstrapping Functions, Special Functions, Linear Regression, Top@chapter Bootstrapping Functions@section Optimized Resampling Functions@deftypefun RealSet bootstrap_mean (size_t @var{N}, const RealSet& @var{data}, int @var{threads}=1)@deftypefunx RealSet bootstrap_median (size_t @var{N}, const RealSet& @var{data}, int @var{threads}=1)@deftypefunx RealSet bootstrap_sdev (size_t @var{N}, const RealSet& @var{data}, int @var{threads}=1)@deftypefunx RealSet bootstrap_skewness (size_t @var{N}, const RealSet& @var{data}, int @var{threads}=1)@deftypefunx RealSet bootstrap_kurtosis (size_t @var{N}, const RealSet& @var{data}, int @var{threads}=1)Each of these functions returns a RealSet containing a set of @var{N} values,each of which represents the value of the appropriate statisticcalculated against a resampling of the elements in @var{data}.Since these resampling calculations are highly parallelizable,significant performance enhancements are possible in multiprocessorenvironments. If @var{threads} is set greater than one, that manydifferent threads are created and the computation is split amongst them.(If your system does not support threads, the @var{threads} argument isignored.)@end deftypefun@c ***************************************************************************@node Special Functions, Using Goose from Guile, Bootstrapping Functions, Top@chapter Special FunctionsOne important part of Goose is a library called @code{libspecfns}, whichprovides mathematical functions that are frequently needed whenperforming statistical calculations. These functions are usedinternally by Goose, but you may find them to be useful for your ownprograms.The majority of the code that makes up @code{libspecfns} is derived fromparts of Stephen L. Moshier's Cephes library. Moshier holds thecopyright on Cephes, but it is distributed with no licensingrestrictions of any kind. Since @code{libspecfns} is derived fromCephes, Moshier is still the primary copyright holder. However, thislibrary, like Goose, is licensed under the LGPL.@section General Functions@deftypefun double factorial (int @var{n})Returns @var{n} factorial. For sufficiently small values of @var{n}(say, @var{n} less than 24), it should be possible to obtain an exactanswer by casting the results to an int. An exception will be thrown if@var{n} is negative.@tex Mathematically,$$\hbox{\tt factorial(n)} = n! = \prod_{i=1}^n i.$$@end tex@end deftypefun@deftypefun double log_factorial (int @var{n})Returns the natural logarithm of @code{factorial(n)}. This function isequivalent to @code{log(factorial(n))}, but is much more numericallystable for large values of @var{n}.@end deftypefun@deftypefun double choose (int @var{n}, int @var{k})Returns the binomial coefficient of @var{n} and @var{k}, which alsohappens to be the number of different possible unordered sets of size@var{k} that can be chosen (without replacement) from a set of @var{n}distinct objects. For sufficiently small values of @var{n} and @var{k}, it should be possible to obtain an exact answer by casting the results to an int.@texMathematically,$$\hbox{\tt choose(n,k)} = {n\choose k} = {n!\over k!(n-k)!}.$$@end tex@end deftypefun@deftypefun double log_choose (int @var{n}, int @var{k})Returns the natural logarithm of @code{choose(n,k)}.@end deftypefun@deftypefun double log_gamma (double @var{x})Returns the logarithms of the value of the gamma function at @var{x}.@texIn mathematical notation,$$ \hbox{\tt log\_gamma(x)} = \log\Gamma(x) =\log\int_0^\infty t^{x-1}e^{-t}\,dt.$$@end tex@end deftypefun@deftypefun double incomplete_gamma (double @var{a}, double @var{b})Returns the value of the incomplete gamma integral of @var{a},integrated from 0 to @var{b}.@texIn mathematical notation,$$ \hbox{\tt incomplete\_gamma(a,b)} = {1\over\Gamma(a)}\int_0^b t^{a-1}e^{-t}\,dt.$$@end tex@end deftypefun@section Statistical DistributionsFor the functions that are associated with various statisticaldistributions, we have adopted the following convention: For the Foodistribution, the cumulative distribution function (or CDF) is alwaysnamed @code{foo_cdf}. The inverse cumulative distribution function isalways named @code{inv_foo_cdf}.@deftypefun double normal_cdf (double @var{x})Returns the value at @var{x} of the CDF of a standard normal distribution.@texIn mathematical notation,$$ \hbox{\tt normal\_cdf(x)} = {1\over 2\pi}\int_{-\infty}^x e^{-t^2/2}\,dt.$$@end tex@end deftypefun@deftypefun double normal_cdf (double @var{m}, double @var{s}, double @var{x})Returns the value at @var{x} of the CDF of a normal distribution withmean @var{m} and standard deviation @var{s}.@end deftypefun@deftypefun double inv_normal_cdf (double @var{p})Returns the value at @var{p} of the inverse CDF of a standard normaldistribution.@end deftypefun@deftypefun double poisson_cdf (int @var{k}, double @var{x})Returns the value at @var{x} of the CDF of a Poisson distribution withmean @var{k}.@end deftypefun@deftypefun double inv_poisson_cdf (int @var{k}, double @var{p})Returns the value at @var{p} of the inverse CDF of a Poisson distribution withmean @var{k}.@end deftypefun@deftypefun double chisq_cdf (int @var{df}, double @var{x})Returns the value at @var{x} of the CDF of a Chi-square distributionwith @var{df} degrees of freedom.@end deftypefun@deftypefun double inv_chisq_cdf (int @var{df}, double @var{p})Returns the value at @var{p} of the inverse CDF of a Chi-squaredistribution with @var{df} degrees of freedom.@end deftypefun@deftypefun double t_cdf (int @var{df}, double @var{x})Returns the value at @var{x} of the CDF of a T-distributionwith @var{df} degrees of freedom.@end deftypefun@deftypefun double inv_t_cdf (int @var{df}, double @var{p})Returns the value at @var{p} of the inverse CDF of a T-distribution with@var{df} degrees of freedom.@end deftypefun@deftypefun double F_cdf (int @var{df1}, int @var{df2}, double @var{x})Returns the value at @var{x} of the CDF of an F-distributionwith @var{df1} and @var{df2} degrees of freedom.@end deftypefun@deftypefun double inv_F_cdf (int @var{df}, int @var{df2}, double @var{p})Returns the value at @var{p} of the inverse CDF of an F-distribution with@var{df1} and @var{df2} degrees of freedom.@end deftypefun@deftypefun double gamma_cdf (double @var{a}, double @var{b}, double @var{x})@end deftypefun@deftypefun double binomial_cdf (int @var{k}, int @var{k}, double @var{x})@end deftypefun@deftypefun double neg_binomial_cdf (int @var{n}, int @var{k}, double @var{x})@end deftypefun@c ***************************************************************************@node Using Goose from Guile, Using Goose from Perl, Special Functions, Top@chapter Using Goose from GuileAn incomplete set of guile bindings exist.@c ***************************************************************************@node Using Goose from Perl, Concept Index, Using Goose from Guile, Top@chapter Using Goose from PerlPerl bindings don't exist yet. They will someday.@c ***************************************************************************@node Concept Index, Function Index, Using Goose from Perl, Top@unnumbered Concept Index@printindex cp@node Function Index, , Concept Index, Top@unnumbered Function Index@printindex fn@c @shortcontents@contents@bye
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -