[gnumeric] fn-r: Add Gumbel distributions.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] fn-r: Add Gumbel distributions.
- Date: Sat, 21 Nov 2015 03:08:32 +0000 (UTC)
commit 1a944c1d0028525cd2e4ed29566fd6fafe81a1ab
Author: Morten Welinder <terra gnome org>
Date: Fri Nov 20 22:07:50 2015 -0500
fn-r: Add Gumbel distributions.
Somewhat annoyingly this should not be confused with the Gumbel
types I and II distrbutions as used in RANDGUMBEL.
NEWS | 1 +
doc/C/func.defs | 35 ++
doc/C/functions.xml | 107 ++++
plugins/fn-r/ChangeLog | 6 +
plugins/fn-r/extra.c | 50 ++
plugins/fn-r/extra.h | 4 +
plugins/fn-r/functions.c | 1395 +++++++++++++++++++++++--------------------
plugins/fn-r/generate | 44 ++-
plugins/fn-r/plugin.xml.in | 3 +
9 files changed, 986 insertions(+), 659 deletions(-)
---
diff --git a/NEWS b/NEWS
index 1ec1e2a..4d30a9d 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ Gnumeric 1.12.25
Morten:
* Fix TABLE problems. [#752181] [#752178] [#752182]
* Fuzzed file fixes. [#752179] [#752180]
+ * Add R.DGUMBEL, R.PGUMBEL, R.QGUMBEL.
--------------------------------------------------------------------------
Gnumeric 1.12.24
diff --git a/doc/C/func.defs b/doc/C/func.defs
index 7da982e..2ab7725 100644
--- a/doc/C/func.defs
+++ b/doc/C/func.defs
@@ -5314,6 +5314,17 @@ If the data set does not contain any duplicates this function returns a #N/A err
@SEEALSO=R.PGEOM,R.QGEOM
@CATEGORY=Statistics
+ FUNCTION=R DGUMBEL
+ SHORTDESC=probability density function of the Gumbel distribution
+ SYNTAX=R DGUMBEL(x,mu,beta,give_log)
+ ARGUMENTDESCRIPTION=@{x}: observation
+ {mu}: the location parameter of freedom of the distribution
+ {beta}: the scale parameter of freedom of the distribution
+ {give_log}: if true, log of the result will be returned instead
+ DESCRIPTION=This function returns the probability density function of the Gumbel distribution.
+ SEEALSO=R PGUMBEL,R.QGUMBEL
+
+ CATEGORY=Statistics
@FUNCTION=R.DHYPER
@SHORTDESC=probability density function of the hypergeometric distribution
@SYNTAX=R.DHYPER(x,r,b,n,give_log)
@@ -5507,6 +5518,18 @@ If the data set does not contain any duplicates this function returns a #N/A err
@SEEALSO=R.DGEOM,R.QGEOM
@CATEGORY=Statistics
+ FUNCTION=R PGUMBEL
+ SHORTDESC=cumulative distribution function of the Gumbel distribution
+ SYNTAX=R PGUMBEL(x,mu,beta,lower_tail,log_p)
+ ARGUMENTDESCRIPTION=@{x}: observation
+ {mu}: the location parameter of freedom of the distribution
+ {beta}: the scale parameter of freedom of the distribution
+ {lower_tail}: if true (the default), the lower tail of the distribution is considered
+ {log_p}: if true, the natural logarithm of the probability is given or returned; defaults to false
+ DESCRIPTION=This function returns the cumulative distribution function of the Gumbel distribution.
+ SEEALSO=R DGUMBEL,R.QGUMBEL
+
+ CATEGORY=Statistics
@FUNCTION=R.PHYPER
@SHORTDESC=cumulative distribution function of the hypergeometric distribution
@SYNTAX=R.PHYPER(x,r,b,n,lower_tail,log_p)
@@ -5722,6 +5745,18 @@ If the data set does not contain any duplicates this function returns a #N/A err
@SEEALSO=R.DGEOM,R.PGEOM
@CATEGORY=Statistics
+ FUNCTION=R QGUMBEL
+ SHORTDESC=probability quantile function of the Gumbel distribution
+ SYNTAX=R QGUMBEL(p,mu,beta,lower_tail,log_p)
+ ARGUMENTDESCRIPTION=@{p}: probability or natural logarithm of the probability
+ {mu}: the location parameter of freedom of the distribution
+ {beta}: the scale parameter of freedom of the distribution
+ {lower_tail}: if true (the default), the lower tail of the distribution is considered
+ {log_p}: if true, the natural logarithm of the probability is given or returned; defaults to false
+ DESCRIPTION=This function returns the probability quantile function, i.e., the inverse of the cumulative
distribution function, of the Gumbel distribution.
+ SEEALSO=R DGUMBEL,R.PGUMBEL
+
+ CATEGORY=Statistics
@FUNCTION=R.QHYPER
@SHORTDESC=probability quantile function of the hypergeometric distribution
@SYNTAX=R.QHYPER(p,r,b,n,lower_tail,log_p)
diff --git a/doc/C/functions.xml b/doc/C/functions.xml
index 5a68aa2..54fced3 100644
--- a/doc/C/functions.xml
+++ b/doc/C/functions.xml
@@ -18171,6 +18171,41 @@
</para>
</refsect1>
</refentry>
+ <refentry id="gnumeric-function-R.DGUMBEL">
+ <refmeta>
+ <refentrytitle>
+ <function>R.DGUMBEL</function>
+ </refentrytitle>
+ </refmeta>
+ <refnamediv>
+ <refname>
+ <function>R.DGUMBEL</function>
+ </refname>
+ <refpurpose>
+ probability density function of the Gumbel distribution
+ </refpurpose>
+ </refnamediv>
+ <refsynopsisdiv>
+
<synopsis><function>R.DGUMBEL</function>(<parameter>x</parameter>,<parameter>mu</parameter>,<parameter>beta</parameter>,<parameter>give_log</parameter>)</synopsis>
+ </refsynopsisdiv>
+ <refsect1>
+ <title>Arguments</title>
+ <para><parameter>x</parameter>: observation</para>
+ <para><parameter>mu</parameter>: the location parameter of freedom of the distribution</para>
+ <para><parameter>beta</parameter>: the scale parameter of freedom of the distribution</para>
+ <para><parameter>give_log</parameter>: if true, log of the result will be returned instead</para>
+ </refsect1>
+ <refsect1>
+ <title>Description</title>
+ <para>This function returns the probability density function of the Gumbel distribution.</para>
+ </refsect1>
+ <refsect1>
+ <title>See also</title>
+ <para><link linkend="gnumeric-function-R.PGUMBEL"><function>R.PGUMBEL</function></link>,
+ <link linkend="gnumeric-function-R.QGUMBEL"><function>R.QGUMBEL</function></link>.
+ </para>
+ </refsect1>
+ </refentry>
<refentry id="gnumeric-function-R.DHYPER">
<refmeta>
<refentrytitle>
@@ -18775,6 +18810,42 @@
</para>
</refsect1>
</refentry>
+ <refentry id="gnumeric-function-R.PGUMBEL">
+ <refmeta>
+ <refentrytitle>
+ <function>R.PGUMBEL</function>
+ </refentrytitle>
+ </refmeta>
+ <refnamediv>
+ <refname>
+ <function>R.PGUMBEL</function>
+ </refname>
+ <refpurpose>
+ cumulative distribution function of the Gumbel distribution
+ </refpurpose>
+ </refnamediv>
+ <refsynopsisdiv>
+
<synopsis><function>R.PGUMBEL</function>(<parameter>x</parameter>,<parameter>mu</parameter>,<parameter>beta</parameter>,<parameter>lower_tail</parameter>,<parameter>log_p</parameter>)</synopsis>
+ </refsynopsisdiv>
+ <refsect1>
+ <title>Arguments</title>
+ <para><parameter>x</parameter>: observation</para>
+ <para><parameter>mu</parameter>: the location parameter of freedom of the distribution</para>
+ <para><parameter>beta</parameter>: the scale parameter of freedom of the distribution</para>
+ <para><parameter>lower_tail</parameter>: if true (the default), the lower tail of the distribution
is considered</para>
+ <para><parameter>log_p</parameter>: if true, the natural logarithm of the probability is given or
returned; defaults to false</para>
+ </refsect1>
+ <refsect1>
+ <title>Description</title>
+ <para>This function returns the cumulative distribution function of the Gumbel distribution.</para>
+ </refsect1>
+ <refsect1>
+ <title>See also</title>
+ <para><link linkend="gnumeric-function-R.DGUMBEL"><function>R.DGUMBEL</function></link>,
+ <link linkend="gnumeric-function-R.QGUMBEL"><function>R.QGUMBEL</function></link>.
+ </para>
+ </refsect1>
+ </refentry>
<refentry id="gnumeric-function-R.PHYPER">
<refmeta>
<refentrytitle>
@@ -19424,6 +19495,42 @@
</para>
</refsect1>
</refentry>
+ <refentry id="gnumeric-function-R.QGUMBEL">
+ <refmeta>
+ <refentrytitle>
+ <function>R.QGUMBEL</function>
+ </refentrytitle>
+ </refmeta>
+ <refnamediv>
+ <refname>
+ <function>R.QGUMBEL</function>
+ </refname>
+ <refpurpose>
+ probability quantile function of the Gumbel distribution
+ </refpurpose>
+ </refnamediv>
+ <refsynopsisdiv>
+
<synopsis><function>R.QGUMBEL</function>(<parameter>p</parameter>,<parameter>mu</parameter>,<parameter>beta</parameter>,<parameter>lower_tail</parameter>,<parameter>log_p</parameter>)</synopsis>
+ </refsynopsisdiv>
+ <refsect1>
+ <title>Arguments</title>
+ <para><parameter>p</parameter>: probability or natural logarithm of the probability</para>
+ <para><parameter>mu</parameter>: the location parameter of freedom of the distribution</para>
+ <para><parameter>beta</parameter>: the scale parameter of freedom of the distribution</para>
+ <para><parameter>lower_tail</parameter>: if true (the default), the lower tail of the distribution
is considered</para>
+ <para><parameter>log_p</parameter>: if true, the natural logarithm of the probability is given or
returned; defaults to false</para>
+ </refsect1>
+ <refsect1>
+ <title>Description</title>
+ <para>This function returns the probability quantile function, i.e., the inverse of the cumulative
distribution function, of the Gumbel distribution.</para>
+ </refsect1>
+ <refsect1>
+ <title>See also</title>
+ <para><link linkend="gnumeric-function-R.DGUMBEL"><function>R.DGUMBEL</function></link>,
+ <link linkend="gnumeric-function-R.PGUMBEL"><function>R.PGUMBEL</function></link>.
+ </para>
+ </refsect1>
+ </refentry>
<refentry id="gnumeric-function-R.QHYPER">
<refmeta>
<refentrytitle>
diff --git a/plugins/fn-r/ChangeLog b/plugins/fn-r/ChangeLog
index ef98e92..fad0ce3 100644
--- a/plugins/fn-r/ChangeLog
+++ b/plugins/fn-r/ChangeLog
@@ -1,3 +1,9 @@
+2015-11-20 Morten Welinder <terra gnome org>
+
+ * generate: Bring this up to date. Sort functions in C file.
+
+ * extra.c: Add Gumbel distribution.
+
2015-09-20 Morten Welinder <terra gnome org>
* Release 1.12.24
diff --git a/plugins/fn-r/extra.c b/plugins/fn-r/extra.c
index cd45058..f1dacb6 100644
--- a/plugins/fn-r/extra.c
+++ b/plugins/fn-r/extra.c
@@ -279,3 +279,53 @@ qst (gnm_float p, gnm_float n, gnm_float shape,
/* ------------------------------------------------------------------------- */
+gnm_float
+dgumbel (gnm_float x, gnm_float mu, gnm_float beta, gboolean give_log)
+{
+ gnm_float z, lp;
+
+ if (!(beta > 0) || gnm_isnan (mu) || gnm_isnan (beta) || gnm_isnan (x))
+ return gnm_nan;
+
+ z = (x - mu) / beta;
+ lp = -(z + gnm_exp (-z));
+ return give_log ? lp - gnm_log (beta) : gnm_exp (lp) / beta;
+}
+
+gnm_float
+pgumbel (gnm_float x, gnm_float mu, gnm_float beta, gboolean lower_tail, gboolean log_p)
+{
+ gnm_float z, lp;
+
+ if (!(beta > 0) || gnm_isnan (mu) || gnm_isnan (beta) || gnm_isnan (x))
+ return gnm_nan;
+
+ z = (x - mu) / beta;
+ lp = -gnm_exp (-z);
+ if (lower_tail)
+ return log_p ? lp : gnm_exp (lp);
+ else
+ return log_p ? swap_log_tail (lp) : 0 - gnm_expm1 (lp);
+}
+
+gnm_float
+qgumbel (gnm_float p, gnm_float mu, gnm_float beta, gboolean lower_tail, gboolean log_p)
+{
+ if (!(beta > 0) ||
+ gnm_isnan (mu) || gnm_isnan (beta) || gnm_isnan (p) ||
+ (log_p ? p > 0 : (p < 0 || p > 1)))
+ return gnm_nan;
+
+ if (log_p) {
+ if (!lower_tail)
+ p = swap_log_tail (p);
+ } else {
+ if (lower_tail)
+ p = gnm_log (p);
+ else
+ p = gnm_log1p (-p);
+ }
+
+ /* We're now in the log_p, lower_tail case. */
+ return mu - beta * gnm_log (-p);
+}
diff --git a/plugins/fn-r/extra.h b/plugins/fn-r/extra.h
index 4a5ded3..ffe5f5e 100644
--- a/plugins/fn-r/extra.h
+++ b/plugins/fn-r/extra.h
@@ -16,5 +16,9 @@ gnm_float dst (gnm_float x, gnm_float n, gnm_float shape, gboolean give_log);
gnm_float pst (gnm_float x, gnm_float n, gnm_float shape, gboolean lower_tail, gboolean log_p);
gnm_float qst (gnm_float p, gnm_float n, gnm_float shape, gboolean lower_tail, gboolean log_p);
+/* The Gumbel distribution */
+gnm_float dgumbel (gnm_float x, gnm_float mu, gnm_float beta, gboolean give_log);
+gnm_float pgumbel (gnm_float x, gnm_float mu, gnm_float beta, gboolean lower_tail, gboolean log_p);
+gnm_float qgumbel (gnm_float p, gnm_float mu, gnm_float beta, gboolean lower_tail, gboolean log_p);
#endif
diff --git a/plugins/fn-r/functions.c b/plugins/fn-r/functions.c
index d631fa0..dcc6540 100644
--- a/plugins/fn-r/functions.c
+++ b/plugins/fn-r/functions.c
@@ -15,376 +15,373 @@ GNM_PLUGIN_MODULE_HEADER;
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_dnorm[] = {
- { GNM_FUNC_HELP_NAME, F_("R.DNORM:probability density function of the normal distribution") },
+static GnmFuncHelp const help_r_dbeta[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.DBETA:probability density function of the beta distribution") },
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("mu:mean of the distribution") },
- { GNM_FUNC_HELP_ARG, F_("sigma:standard deviation of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("a:the first shape parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("b:the second scale parameter of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("give_log:if true, log of the result will be returned instead") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the normal
distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.PNORM,R.QNORM" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the beta
distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.PBETA,R.QBETA" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_dnorm (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_dbeta (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float mu = value_get_as_float (args[1]);
- gnm_float sigma = value_get_as_float (args[2]);
+ gnm_float a = value_get_as_float (args[1]);
+ gnm_float b = value_get_as_float (args[2]);
gboolean give_log = args[3] ? value_get_as_checked_bool (args[3]) : FALSE;
- return value_new_float (dnorm (x, mu, sigma, give_log));
+ return value_new_float (dbeta (x, a, b, give_log));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_pnorm[] = {
- { GNM_FUNC_HELP_NAME, F_("R.PNORM:cumulative distribution function of the normal distribution") },
+static GnmFuncHelp const help_r_pbeta[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.PBETA:cumulative distribution function of the beta distribution") },
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("mu:mean of the distribution") },
- { GNM_FUNC_HELP_ARG, F_("sigma:standard deviation of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("a:the first shape parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("b:the second scale parameter of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
normal distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.DNORM,R.QNORM" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
beta distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DBETA,R.QBETA" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_pnorm (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_pbeta (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float mu = value_get_as_float (args[1]);
- gnm_float sigma = value_get_as_float (args[2]);
+ gnm_float a = value_get_as_float (args[1]);
+ gnm_float b = value_get_as_float (args[2]);
gboolean lower_tail = args[3] ? value_get_as_checked_bool (args[3]) : TRUE;
gboolean log_p = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
- return value_new_float (pnorm (x, mu, sigma, lower_tail, log_p));
+ return value_new_float (pbeta (x, a, b, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_qnorm[] = {
- { GNM_FUNC_HELP_NAME, F_("R.QNORM:probability quantile function of the normal distribution") },
+static GnmFuncHelp const help_r_qbeta[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.QBETA:probability quantile function of the beta distribution") },
{ GNM_FUNC_HELP_ARG, F_("p:probability or natural logarithm of the probability") },
- { GNM_FUNC_HELP_ARG, F_("mu:mean of the distribution") },
- { GNM_FUNC_HELP_ARG, F_("sigma:standard deviation of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("a:the first shape parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("b:the second scale parameter of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the normal distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.DNORM,R.PNORM" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the beta distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DBETA,R.PBETA" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_qnorm (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_qbeta (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float p = value_get_as_float (args[0]);
- gnm_float mu = value_get_as_float (args[1]);
- gnm_float sigma = value_get_as_float (args[2]);
+ gnm_float a = value_get_as_float (args[1]);
+ gnm_float b = value_get_as_float (args[2]);
gboolean lower_tail = args[3] ? value_get_as_checked_bool (args[3]) : TRUE;
gboolean log_p = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
- return value_new_float (qnorm (p, mu, sigma, lower_tail, log_p));
+ return value_new_float (qbeta (p, a, b, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_dlnorm[] = {
- { GNM_FUNC_HELP_NAME, F_("R.DLNORM:probability density function of the log-normal distribution") },
+static GnmFuncHelp const help_r_dbinom[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.DBINOM:probability density function of the binomial distribution") },
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("logmean:mean of the underlying normal distribution") },
- { GNM_FUNC_HELP_ARG, F_("logsd:standard deviation of the underlying normal distribution") },
+ { GNM_FUNC_HELP_ARG, F_("n:the number of trials") },
+ { GNM_FUNC_HELP_ARG, F_("psuc:the probability of success in each trial") },
{ GNM_FUNC_HELP_ARG, F_("give_log:if true, log of the result will be returned instead") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the
log-normal distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.PLNORM,R.QLNORM" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the
binomial distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.PBINOM,R.QBINOM" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_dlnorm (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_dbinom (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float logmean = value_get_as_float (args[1]);
- gnm_float logsd = value_get_as_float (args[2]);
+ gnm_float n = value_get_as_float (args[1]);
+ gnm_float psuc = value_get_as_float (args[2]);
gboolean give_log = args[3] ? value_get_as_checked_bool (args[3]) : FALSE;
- return value_new_float (dlnorm (x, logmean, logsd, give_log));
+ return value_new_float (dbinom (x, n, psuc, give_log));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_plnorm[] = {
- { GNM_FUNC_HELP_NAME, F_("R.PLNORM:cumulative distribution function of the log-normal distribution")
},
+static GnmFuncHelp const help_r_pbinom[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.PBINOM:cumulative distribution function of the binomial distribution") },
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("logmean:mean of the underlying normal distribution") },
- { GNM_FUNC_HELP_ARG, F_("logsd:standard deviation of the underlying normal distribution") },
+ { GNM_FUNC_HELP_ARG, F_("n:the number of trials") },
+ { GNM_FUNC_HELP_ARG, F_("psuc:the probability of success in each trial") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
log-normal distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.DLNORM,R.QLNORM" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
binomial distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DBINOM,R.QBINOM" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_plnorm (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_pbinom (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float logmean = value_get_as_float (args[1]);
- gnm_float logsd = value_get_as_float (args[2]);
+ gnm_float n = value_get_as_float (args[1]);
+ gnm_float psuc = value_get_as_float (args[2]);
gboolean lower_tail = args[3] ? value_get_as_checked_bool (args[3]) : TRUE;
gboolean log_p = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
- return value_new_float (plnorm (x, logmean, logsd, lower_tail, log_p));
+ return value_new_float (pbinom (x, n, psuc, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_qlnorm[] = {
- { GNM_FUNC_HELP_NAME, F_("R.QLNORM:probability quantile function of the log-normal distribution") },
+static GnmFuncHelp const help_r_qbinom[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.QBINOM:probability quantile function of the binomial distribution") },
{ GNM_FUNC_HELP_ARG, F_("p:probability or natural logarithm of the probability") },
- { GNM_FUNC_HELP_ARG, F_("logmean:mean of the underlying normal distribution") },
- { GNM_FUNC_HELP_ARG, F_("logsd:standard deviation of the underlying normal distribution") },
+ { GNM_FUNC_HELP_ARG, F_("n:the number of trials") },
+ { GNM_FUNC_HELP_ARG, F_("psuc:the probability of success in each trial") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the log-normal distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.DLNORM,R.PLNORM" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the binomial distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DBINOM,R.PBINOM" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_qlnorm (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_qbinom (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float p = value_get_as_float (args[0]);
- gnm_float logmean = value_get_as_float (args[1]);
- gnm_float logsd = value_get_as_float (args[2]);
+ gnm_float n = value_get_as_float (args[1]);
+ gnm_float psuc = value_get_as_float (args[2]);
gboolean lower_tail = args[3] ? value_get_as_checked_bool (args[3]) : TRUE;
gboolean log_p = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
- return value_new_float (qlnorm (p, logmean, logsd, lower_tail, log_p));
+ return value_new_float (qbinom (p, n, psuc, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_dgamma[] = {
- { GNM_FUNC_HELP_NAME, F_("R.DGAMMA:probability density function of the gamma distribution") },
+static GnmFuncHelp const help_r_dcauchy[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.DCAUCHY:probability density function of the Cauchy distribution") },
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("shape:the shape parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("location:the center of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("scale:the scale parameter of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("give_log:if true, log of the result will be returned instead") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the gamma
distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.PGAMMA,R.QGAMMA" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the Cauchy
distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.PCAUCHY,R.QCAUCHY" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_dgamma (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_dcauchy (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float shape = value_get_as_float (args[1]);
+ gnm_float location = value_get_as_float (args[1]);
gnm_float scale = value_get_as_float (args[2]);
gboolean give_log = args[3] ? value_get_as_checked_bool (args[3]) : FALSE;
- return value_new_float (dgamma (x, shape, scale, give_log));
+ return value_new_float (dcauchy (x, location, scale, give_log));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_pgamma[] = {
- { GNM_FUNC_HELP_NAME, F_("R.PGAMMA:cumulative distribution function of the gamma distribution") },
+static GnmFuncHelp const help_r_pcauchy[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.PCAUCHY:cumulative distribution function of the Cauchy distribution") },
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("shape:the shape parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("location:the center of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("scale:the scale parameter of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
gamma distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.DGAMMA,R.QGAMMA" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
Cauchy distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DCAUCHY,R.QCAUCHY" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_pgamma (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_pcauchy (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float shape = value_get_as_float (args[1]);
+ gnm_float location = value_get_as_float (args[1]);
gnm_float scale = value_get_as_float (args[2]);
gboolean lower_tail = args[3] ? value_get_as_checked_bool (args[3]) : TRUE;
gboolean log_p = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
- return value_new_float (pgamma (x, shape, scale, lower_tail, log_p));
+ return value_new_float (pcauchy (x, location, scale, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_qgamma[] = {
- { GNM_FUNC_HELP_NAME, F_("R.QGAMMA:probability quantile function of the gamma distribution") },
+static GnmFuncHelp const help_r_qcauchy[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.QCAUCHY:probability quantile function of the Cauchy distribution") },
{ GNM_FUNC_HELP_ARG, F_("p:probability or natural logarithm of the probability") },
- { GNM_FUNC_HELP_ARG, F_("shape:the shape parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("location:the center of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("scale:the scale parameter of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the gamma distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.DGAMMA,R.PGAMMA" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the Cauchy distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DCAUCHY,R.PCAUCHY" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_qgamma (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_qcauchy (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float p = value_get_as_float (args[0]);
- gnm_float shape = value_get_as_float (args[1]);
+ gnm_float location = value_get_as_float (args[1]);
gnm_float scale = value_get_as_float (args[2]);
gboolean lower_tail = args[3] ? value_get_as_checked_bool (args[3]) : TRUE;
gboolean log_p = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
- return value_new_float (qgamma (p, shape, scale, lower_tail, log_p));
+ return value_new_float (qcauchy (p, location, scale, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_dbeta[] = {
- { GNM_FUNC_HELP_NAME, F_("R.DBETA:probability density function of the beta distribution") },
+static GnmFuncHelp const help_r_dchisq[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.DCHISQ:probability density function of the chi-square distribution") },
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("a:the first shape parameter of the distribution") },
- { GNM_FUNC_HELP_ARG, F_("b:the second scale parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("df:the number of degrees of freedom of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("give_log:if true, log of the result will be returned instead") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the beta
distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.PBETA,R.QBETA" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the
chi-square distribution.") },
+ { GNM_FUNC_HELP_ODF, F_("A two argument invocation R.DCHISQ(@{x},@{df}) is exported to OpenFormula as
CHISQDIST(@{x},@{df},FALSE()).") },
+ { GNM_FUNC_HELP_SEEALSO, "R.PCHISQ,R.QCHISQ" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_dbeta (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_dchisq (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float a = value_get_as_float (args[1]);
- gnm_float b = value_get_as_float (args[2]);
- gboolean give_log = args[3] ? value_get_as_checked_bool (args[3]) : FALSE;
+ gnm_float df = value_get_as_float (args[1]);
+ gboolean give_log = args[2] ? value_get_as_checked_bool (args[2]) : FALSE;
- return value_new_float (dbeta (x, a, b, give_log));
+ return value_new_float (dchisq (x, df, give_log));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_pbeta[] = {
- { GNM_FUNC_HELP_NAME, F_("R.PBETA:cumulative distribution function of the beta distribution") },
+static GnmFuncHelp const help_r_pchisq[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.PCHISQ:cumulative distribution function of the chi-square distribution")
},
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("a:the first shape parameter of the distribution") },
- { GNM_FUNC_HELP_ARG, F_("b:the second scale parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("df:the number of degrees of freedom of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
beta distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.DBETA,R.QBETA" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
chi-square distribution.") },
+ { GNM_FUNC_HELP_ODF, F_("A two argument invocation R.PCHISQ(@{x},@{df}) is exported to OpenFormula as
CHISQDIST(@{x},@{df}).") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DCHISQ,R.QCHISQ" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_pbeta (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_pchisq (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float a = value_get_as_float (args[1]);
- gnm_float b = value_get_as_float (args[2]);
- gboolean lower_tail = args[3] ? value_get_as_checked_bool (args[3]) : TRUE;
- gboolean log_p = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
+ gnm_float df = value_get_as_float (args[1]);
+ gboolean lower_tail = args[2] ? value_get_as_checked_bool (args[2]) : TRUE;
+ gboolean log_p = args[3] ? value_get_as_checked_bool (args[3]) : FALSE;
- return value_new_float (pbeta (x, a, b, lower_tail, log_p));
+ return value_new_float (pchisq (x, df, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_qbeta[] = {
- { GNM_FUNC_HELP_NAME, F_("R.QBETA:probability quantile function of the beta distribution") },
+static GnmFuncHelp const help_r_qchisq[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.QCHISQ:probability quantile function of the chi-square distribution") },
{ GNM_FUNC_HELP_ARG, F_("p:probability or natural logarithm of the probability") },
- { GNM_FUNC_HELP_ARG, F_("a:the first shape parameter of the distribution") },
- { GNM_FUNC_HELP_ARG, F_("b:the second scale parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("df:the number of degrees of freedom of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the beta distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.DBETA,R.PBETA" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the chi-square distribution.") },
+ { GNM_FUNC_HELP_ODF, F_("A two argument invocation R.QCHISQ(@{p},@{df}) is exported to OpenFormula as
CHISQINV(@{p},@{df}).") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DCHISQ,R.PCHISQ" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_qbeta (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_qchisq (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float p = value_get_as_float (args[0]);
- gnm_float a = value_get_as_float (args[1]);
- gnm_float b = value_get_as_float (args[2]);
- gboolean lower_tail = args[3] ? value_get_as_checked_bool (args[3]) : TRUE;
- gboolean log_p = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
+ gnm_float df = value_get_as_float (args[1]);
+ gboolean lower_tail = args[2] ? value_get_as_checked_bool (args[2]) : TRUE;
+ gboolean log_p = args[3] ? value_get_as_checked_bool (args[3]) : FALSE;
- return value_new_float (qbeta (p, a, b, lower_tail, log_p));
+ return value_new_float (qchisq (p, df, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_dt[] = {
- { GNM_FUNC_HELP_NAME, F_("R.DT:probability density function of the Student t distribution") },
+static GnmFuncHelp const help_r_dexp[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.DEXP:probability density function of the exponential distribution") },
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("n:the number of degrees of freedom of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("scale:the scale parameter of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("give_log:if true, log of the result will be returned instead") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the
Student t distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.PT,R.QT" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the
exponential distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.PEXP,R.QEXP" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_dt (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_dexp (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float n = value_get_as_float (args[1]);
+ gnm_float scale = value_get_as_float (args[1]);
gboolean give_log = args[2] ? value_get_as_checked_bool (args[2]) : FALSE;
- return value_new_float (dt (x, n, give_log));
+ return value_new_float (dexp (x, scale, give_log));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_pt[] = {
- { GNM_FUNC_HELP_NAME, F_("R.PT:cumulative distribution function of the Student t distribution") },
+static GnmFuncHelp const help_r_pexp[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.PEXP:cumulative distribution function of the exponential distribution") },
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("n:the number of degrees of freedom of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("scale:the scale parameter of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
Student t distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.DT,R.QT" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
exponential distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DEXP,R.QEXP" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_pt (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_pexp (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float n = value_get_as_float (args[1]);
+ gnm_float scale = value_get_as_float (args[1]);
gboolean lower_tail = args[2] ? value_get_as_checked_bool (args[2]) : TRUE;
gboolean log_p = args[3] ? value_get_as_checked_bool (args[3]) : FALSE;
- return value_new_float (pt (x, n, lower_tail, log_p));
+ return value_new_float (pexp (x, scale, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_qt[] = {
- { GNM_FUNC_HELP_NAME, F_("R.QT:probability quantile function of the Student t distribution") },
+static GnmFuncHelp const help_r_qexp[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.QEXP:probability quantile function of the exponential distribution") },
{ GNM_FUNC_HELP_ARG, F_("p:probability or natural logarithm of the probability") },
- { GNM_FUNC_HELP_ARG, F_("n:the number of degrees of freedom of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("scale:the scale parameter of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the Student t distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.DT,R.PT" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the exponential distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DEXP,R.PEXP" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_qt (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_qexp (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float p = value_get_as_float (args[0]);
- gnm_float n = value_get_as_float (args[1]);
+ gnm_float scale = value_get_as_float (args[1]);
gboolean lower_tail = args[2] ? value_get_as_checked_bool (args[2]) : TRUE;
gboolean log_p = args[3] ? value_get_as_checked_bool (args[3]) : FALSE;
- return value_new_float (qt (p, n, lower_tail, log_p));
+ return value_new_float (qexp (p, scale, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
@@ -465,367 +462,382 @@ gnumeric_r_qf (GnmFuncEvalInfo *ei, GnmValue const * const *args)
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_dchisq[] = {
- { GNM_FUNC_HELP_NAME, F_("R.DCHISQ:probability density function of the chi-square distribution") },
+static GnmFuncHelp const help_r_dgamma[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.DGAMMA:probability density function of the gamma distribution") },
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("df:the number of degrees of freedom of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("shape:the shape parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("scale:the scale parameter of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("give_log:if true, log of the result will be returned instead") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the
chi-square distribution.") },
- { GNM_FUNC_HELP_ODF, F_("A two argument invocation R.DCHISQ(@{x},@{df}) is exported to OpenFormula as
CHISQDIST(@{x},@{df},FALSE()).") },
- { GNM_FUNC_HELP_SEEALSO, "R.PCHISQ,R.QCHISQ" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the gamma
distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.PGAMMA,R.QGAMMA" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_dchisq (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_dgamma (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float df = value_get_as_float (args[1]);
- gboolean give_log = args[2] ? value_get_as_checked_bool (args[2]) : FALSE;
+ gnm_float shape = value_get_as_float (args[1]);
+ gnm_float scale = value_get_as_float (args[2]);
+ gboolean give_log = args[3] ? value_get_as_checked_bool (args[3]) : FALSE;
- return value_new_float (dchisq (x, df, give_log));
+ return value_new_float (dgamma (x, shape, scale, give_log));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_pchisq[] = {
- { GNM_FUNC_HELP_NAME, F_("R.PCHISQ:cumulative distribution function of the chi-square distribution")
},
+static GnmFuncHelp const help_r_pgamma[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.PGAMMA:cumulative distribution function of the gamma distribution") },
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("df:the number of degrees of freedom of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("shape:the shape parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("scale:the scale parameter of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
chi-square distribution.") },
- { GNM_FUNC_HELP_ODF, F_("A two argument invocation R.PCHISQ(@{x},@{df}) is exported to OpenFormula as
CHISQDIST(@{x},@{df}).") },
- { GNM_FUNC_HELP_SEEALSO, "R.DCHISQ,R.QCHISQ" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
gamma distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DGAMMA,R.QGAMMA" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_pchisq (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_pgamma (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float df = value_get_as_float (args[1]);
- gboolean lower_tail = args[2] ? value_get_as_checked_bool (args[2]) : TRUE;
- gboolean log_p = args[3] ? value_get_as_checked_bool (args[3]) : FALSE;
+ gnm_float shape = value_get_as_float (args[1]);
+ gnm_float scale = value_get_as_float (args[2]);
+ gboolean lower_tail = args[3] ? value_get_as_checked_bool (args[3]) : TRUE;
+ gboolean log_p = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
- return value_new_float (pchisq (x, df, lower_tail, log_p));
+ return value_new_float (pgamma (x, shape, scale, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_qchisq[] = {
- { GNM_FUNC_HELP_NAME, F_("R.QCHISQ:probability quantile function of the chi-square distribution") },
+static GnmFuncHelp const help_r_qgamma[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.QGAMMA:probability quantile function of the gamma distribution") },
{ GNM_FUNC_HELP_ARG, F_("p:probability or natural logarithm of the probability") },
- { GNM_FUNC_HELP_ARG, F_("df:the number of degrees of freedom of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("shape:the shape parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("scale:the scale parameter of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the chi-square distribution.") },
- { GNM_FUNC_HELP_ODF, F_("A two argument invocation R.QCHISQ(@{p},@{df}) is exported to OpenFormula as
CHISQINV(@{p},@{df}).") },
- { GNM_FUNC_HELP_SEEALSO, "R.DCHISQ,R.PCHISQ" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the gamma distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DGAMMA,R.PGAMMA" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_qchisq (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_qgamma (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float p = value_get_as_float (args[0]);
- gnm_float df = value_get_as_float (args[1]);
- gboolean lower_tail = args[2] ? value_get_as_checked_bool (args[2]) : TRUE;
- gboolean log_p = args[3] ? value_get_as_checked_bool (args[3]) : FALSE;
+ gnm_float shape = value_get_as_float (args[1]);
+ gnm_float scale = value_get_as_float (args[2]);
+ gboolean lower_tail = args[3] ? value_get_as_checked_bool (args[3]) : TRUE;
+ gboolean log_p = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
- return value_new_float (qchisq (p, df, lower_tail, log_p));
+ return value_new_float (qgamma (p, shape, scale, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_dweibull[] = {
- { GNM_FUNC_HELP_NAME, F_("R.DWEIBULL:probability density function of the Weibull distribution") },
+static GnmFuncHelp const help_r_dgeom[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.DGEOM:probability density function of the geometric distribution") },
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("shape:the shape parameter of the distribution") },
- { GNM_FUNC_HELP_ARG, F_("scale:the scale parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("psuc:the probability of success in each trial") },
{ GNM_FUNC_HELP_ARG, F_("give_log:if true, log of the result will be returned instead") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the
Weibull distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.PWEIBULL,R.QWEIBULL" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the
geometric distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.PGEOM,R.QGEOM" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_dweibull (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_dgeom (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float shape = value_get_as_float (args[1]);
- gnm_float scale = value_get_as_float (args[2]);
- gboolean give_log = args[3] ? value_get_as_checked_bool (args[3]) : FALSE;
+ gnm_float psuc = value_get_as_float (args[1]);
+ gboolean give_log = args[2] ? value_get_as_checked_bool (args[2]) : FALSE;
- return value_new_float (dweibull (x, shape, scale, give_log));
+ return value_new_float (dgeom (x, psuc, give_log));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_pweibull[] = {
- { GNM_FUNC_HELP_NAME, F_("R.PWEIBULL:cumulative distribution function of the Weibull distribution") },
+static GnmFuncHelp const help_r_pgeom[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.PGEOM:cumulative distribution function of the geometric distribution") },
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("shape:the shape parameter of the distribution") },
- { GNM_FUNC_HELP_ARG, F_("scale:the scale parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("psuc:the probability of success in each trial") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
Weibull distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.DWEIBULL,R.QWEIBULL" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
geometric distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DGEOM,R.QGEOM" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_pweibull (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_pgeom (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float shape = value_get_as_float (args[1]);
- gnm_float scale = value_get_as_float (args[2]);
- gboolean lower_tail = args[3] ? value_get_as_checked_bool (args[3]) : TRUE;
- gboolean log_p = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
+ gnm_float psuc = value_get_as_float (args[1]);
+ gboolean lower_tail = args[2] ? value_get_as_checked_bool (args[2]) : TRUE;
+ gboolean log_p = args[3] ? value_get_as_checked_bool (args[3]) : FALSE;
- return value_new_float (pweibull (x, shape, scale, lower_tail, log_p));
+ return value_new_float (pgeom (x, psuc, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_qweibull[] = {
- { GNM_FUNC_HELP_NAME, F_("R.QWEIBULL:probability quantile function of the Weibull distribution") },
+static GnmFuncHelp const help_r_qgeom[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.QGEOM:probability quantile function of the geometric distribution") },
{ GNM_FUNC_HELP_ARG, F_("p:probability or natural logarithm of the probability") },
- { GNM_FUNC_HELP_ARG, F_("shape:the shape parameter of the distribution") },
- { GNM_FUNC_HELP_ARG, F_("scale:the scale parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("psuc:the probability of success in each trial") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the Weibull distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.DWEIBULL,R.PWEIBULL" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the geometric distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DGEOM,R.PGEOM" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_qweibull (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_qgeom (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float p = value_get_as_float (args[0]);
- gnm_float shape = value_get_as_float (args[1]);
- gnm_float scale = value_get_as_float (args[2]);
- gboolean lower_tail = args[3] ? value_get_as_checked_bool (args[3]) : TRUE;
- gboolean log_p = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
+ gnm_float psuc = value_get_as_float (args[1]);
+ gboolean lower_tail = args[2] ? value_get_as_checked_bool (args[2]) : TRUE;
+ gboolean log_p = args[3] ? value_get_as_checked_bool (args[3]) : FALSE;
- return value_new_float (qweibull (p, shape, scale, lower_tail, log_p));
+ return value_new_float (qgeom (p, psuc, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_dpois[] = {
- { GNM_FUNC_HELP_NAME, F_("R.DPOIS:probability density function of the Poisson distribution") },
+static GnmFuncHelp const help_r_dgumbel[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.DGUMBEL:probability density function of the Gumbel distribution") },
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("lambda:the mean of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("mu:the location parameter of freedom of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("beta:the scale parameter of freedom of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("give_log:if true, log of the result will be returned instead") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the
Poisson distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.PPOIS,R.QPOIS" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the Gumbel
distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.PGUMBEL,R.QGUMBEL" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_dpois (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_dgumbel (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float lambda = value_get_as_float (args[1]);
- gboolean give_log = args[2] ? value_get_as_checked_bool (args[2]) : FALSE;
+ gnm_float mu = value_get_as_float (args[1]);
+ gnm_float beta = value_get_as_float (args[2]);
+ gboolean give_log = args[3] ? value_get_as_checked_bool (args[3]) : FALSE;
- return value_new_float (dpois (x, lambda, give_log));
+ return value_new_float (dgumbel (x, mu, beta, give_log));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_ppois[] = {
- { GNM_FUNC_HELP_NAME, F_("R.PPOIS:cumulative distribution function of the Poisson distribution") },
+static GnmFuncHelp const help_r_pgumbel[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.PGUMBEL:cumulative distribution function of the Gumbel distribution") },
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("lambda:the mean of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("mu:the location parameter of freedom of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("beta:the scale parameter of freedom of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
Poisson distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.DPOIS,R.QPOIS" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
Gumbel distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DGUMBEL,R.QGUMBEL" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_ppois (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_pgumbel (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float lambda = value_get_as_float (args[1]);
- gboolean lower_tail = args[2] ? value_get_as_checked_bool (args[2]) : TRUE;
- gboolean log_p = args[3] ? value_get_as_checked_bool (args[3]) : FALSE;
+ gnm_float mu = value_get_as_float (args[1]);
+ gnm_float beta = value_get_as_float (args[2]);
+ gboolean lower_tail = args[3] ? value_get_as_checked_bool (args[3]) : TRUE;
+ gboolean log_p = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
- return value_new_float (ppois (x, lambda, lower_tail, log_p));
+ return value_new_float (pgumbel (x, mu, beta, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_qpois[] = {
- { GNM_FUNC_HELP_NAME, F_("R.QPOIS:probability quantile function of the Poisson distribution") },
+static GnmFuncHelp const help_r_qgumbel[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.QGUMBEL:probability quantile function of the Gumbel distribution") },
{ GNM_FUNC_HELP_ARG, F_("p:probability or natural logarithm of the probability") },
- { GNM_FUNC_HELP_ARG, F_("lambda:the mean of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("mu:the location parameter of freedom of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("beta:the scale parameter of freedom of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the Poisson distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.DPOIS,R.PPOIS" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the Gumbel distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DGUMBEL,R.PGUMBEL" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_qpois (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_qgumbel (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float p = value_get_as_float (args[0]);
- gnm_float lambda = value_get_as_float (args[1]);
- gboolean lower_tail = args[2] ? value_get_as_checked_bool (args[2]) : TRUE;
- gboolean log_p = args[3] ? value_get_as_checked_bool (args[3]) : FALSE;
+ gnm_float mu = value_get_as_float (args[1]);
+ gnm_float beta = value_get_as_float (args[2]);
+ gboolean lower_tail = args[3] ? value_get_as_checked_bool (args[3]) : TRUE;
+ gboolean log_p = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
- return value_new_float (qpois (p, lambda, lower_tail, log_p));
+ return value_new_float (qgumbel (p, mu, beta, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_dexp[] = {
- { GNM_FUNC_HELP_NAME, F_("R.DEXP:probability density function of the exponential distribution") },
+static GnmFuncHelp const help_r_dhyper[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.DHYPER:probability density function of the hypergeometric distribution")
},
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("scale:the scale parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("r:the number of red balls") },
+ { GNM_FUNC_HELP_ARG, F_("b:the number of black balls") },
+ { GNM_FUNC_HELP_ARG, F_("n:the number of balls drawn") },
{ GNM_FUNC_HELP_ARG, F_("give_log:if true, log of the result will be returned instead") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the
exponential distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.PEXP,R.QEXP" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the
hypergeometric distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.PHYPER,R.QHYPER" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_dexp (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_dhyper (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float scale = value_get_as_float (args[1]);
- gboolean give_log = args[2] ? value_get_as_checked_bool (args[2]) : FALSE;
+ gnm_float r = value_get_as_float (args[1]);
+ gnm_float b = value_get_as_float (args[2]);
+ gnm_float n = value_get_as_float (args[3]);
+ gboolean give_log = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
- return value_new_float (dexp (x, scale, give_log));
+ return value_new_float (dhyper (x, r, b, n, give_log));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_pexp[] = {
- { GNM_FUNC_HELP_NAME, F_("R.PEXP:cumulative distribution function of the exponential distribution") },
+static GnmFuncHelp const help_r_phyper[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.PHYPER:cumulative distribution function of the hypergeometric
distribution") },
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("scale:the scale parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("r:the number of red balls") },
+ { GNM_FUNC_HELP_ARG, F_("b:the number of black balls") },
+ { GNM_FUNC_HELP_ARG, F_("n:the number of balls drawn") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
exponential distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.DEXP,R.QEXP" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
hypergeometric distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DHYPER,R.QHYPER" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_pexp (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_phyper (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float scale = value_get_as_float (args[1]);
- gboolean lower_tail = args[2] ? value_get_as_checked_bool (args[2]) : TRUE;
- gboolean log_p = args[3] ? value_get_as_checked_bool (args[3]) : FALSE;
+ gnm_float r = value_get_as_float (args[1]);
+ gnm_float b = value_get_as_float (args[2]);
+ gnm_float n = value_get_as_float (args[3]);
+ gboolean lower_tail = args[4] ? value_get_as_checked_bool (args[4]) : TRUE;
+ gboolean log_p = args[5] ? value_get_as_checked_bool (args[5]) : FALSE;
- return value_new_float (pexp (x, scale, lower_tail, log_p));
+ return value_new_float (phyper (x, r, b, n, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_qexp[] = {
- { GNM_FUNC_HELP_NAME, F_("R.QEXP:probability quantile function of the exponential distribution") },
+static GnmFuncHelp const help_r_qhyper[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.QHYPER:probability quantile function of the hypergeometric distribution")
},
{ GNM_FUNC_HELP_ARG, F_("p:probability or natural logarithm of the probability") },
- { GNM_FUNC_HELP_ARG, F_("scale:the scale parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("r:the number of red balls") },
+ { GNM_FUNC_HELP_ARG, F_("b:the number of black balls") },
+ { GNM_FUNC_HELP_ARG, F_("n:the number of balls drawn") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the exponential distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.DEXP,R.PEXP" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the hypergeometric distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DHYPER,R.PHYPER" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_qexp (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_qhyper (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float p = value_get_as_float (args[0]);
- gnm_float scale = value_get_as_float (args[1]);
- gboolean lower_tail = args[2] ? value_get_as_checked_bool (args[2]) : TRUE;
- gboolean log_p = args[3] ? value_get_as_checked_bool (args[3]) : FALSE;
+ gnm_float r = value_get_as_float (args[1]);
+ gnm_float b = value_get_as_float (args[2]);
+ gnm_float n = value_get_as_float (args[3]);
+ gboolean lower_tail = args[4] ? value_get_as_checked_bool (args[4]) : TRUE;
+ gboolean log_p = args[5] ? value_get_as_checked_bool (args[5]) : FALSE;
- return value_new_float (qexp (p, scale, lower_tail, log_p));
+ return value_new_float (qhyper (p, r, b, n, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_dbinom[] = {
- { GNM_FUNC_HELP_NAME, F_("R.DBINOM:probability density function of the binomial distribution") },
+static GnmFuncHelp const help_r_dlnorm[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.DLNORM:probability density function of the log-normal distribution") },
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("n:the number of trials") },
- { GNM_FUNC_HELP_ARG, F_("psuc:the probability of success in each trial") },
+ { GNM_FUNC_HELP_ARG, F_("logmean:mean of the underlying normal distribution") },
+ { GNM_FUNC_HELP_ARG, F_("logsd:standard deviation of the underlying normal distribution") },
{ GNM_FUNC_HELP_ARG, F_("give_log:if true, log of the result will be returned instead") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the
binomial distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.PBINOM,R.QBINOM" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the
log-normal distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.PLNORM,R.QLNORM" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_dbinom (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_dlnorm (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float n = value_get_as_float (args[1]);
- gnm_float psuc = value_get_as_float (args[2]);
+ gnm_float logmean = value_get_as_float (args[1]);
+ gnm_float logsd = value_get_as_float (args[2]);
gboolean give_log = args[3] ? value_get_as_checked_bool (args[3]) : FALSE;
- return value_new_float (dbinom (x, n, psuc, give_log));
+ return value_new_float (dlnorm (x, logmean, logsd, give_log));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_pbinom[] = {
- { GNM_FUNC_HELP_NAME, F_("R.PBINOM:cumulative distribution function of the binomial distribution") },
+static GnmFuncHelp const help_r_plnorm[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.PLNORM:cumulative distribution function of the log-normal distribution")
},
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("n:the number of trials") },
- { GNM_FUNC_HELP_ARG, F_("psuc:the probability of success in each trial") },
+ { GNM_FUNC_HELP_ARG, F_("logmean:mean of the underlying normal distribution") },
+ { GNM_FUNC_HELP_ARG, F_("logsd:standard deviation of the underlying normal distribution") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
binomial distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.DBINOM,R.QBINOM" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
log-normal distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DLNORM,R.QLNORM" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_pbinom (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_plnorm (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float n = value_get_as_float (args[1]);
- gnm_float psuc = value_get_as_float (args[2]);
+ gnm_float logmean = value_get_as_float (args[1]);
+ gnm_float logsd = value_get_as_float (args[2]);
gboolean lower_tail = args[3] ? value_get_as_checked_bool (args[3]) : TRUE;
gboolean log_p = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
- return value_new_float (pbinom (x, n, psuc, lower_tail, log_p));
+ return value_new_float (plnorm (x, logmean, logsd, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_qbinom[] = {
- { GNM_FUNC_HELP_NAME, F_("R.QBINOM:probability quantile function of the binomial distribution") },
+static GnmFuncHelp const help_r_qlnorm[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.QLNORM:probability quantile function of the log-normal distribution") },
{ GNM_FUNC_HELP_ARG, F_("p:probability or natural logarithm of the probability") },
- { GNM_FUNC_HELP_ARG, F_("n:the number of trials") },
- { GNM_FUNC_HELP_ARG, F_("psuc:the probability of success in each trial") },
+ { GNM_FUNC_HELP_ARG, F_("logmean:mean of the underlying normal distribution") },
+ { GNM_FUNC_HELP_ARG, F_("logsd:standard deviation of the underlying normal distribution") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the binomial distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.DBINOM,R.PBINOM" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the log-normal distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DLNORM,R.PLNORM" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_qbinom (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_qlnorm (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float p = value_get_as_float (args[0]);
- gnm_float n = value_get_as_float (args[1]);
- gnm_float psuc = value_get_as_float (args[2]);
+ gnm_float logmean = value_get_as_float (args[1]);
+ gnm_float logsd = value_get_as_float (args[2]);
gboolean lower_tail = args[3] ? value_get_as_checked_bool (args[3]) : TRUE;
gboolean log_p = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
- return value_new_float (qbinom (p, n, psuc, lower_tail, log_p));
+ return value_new_float (qlnorm (p, logmean, logsd, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
@@ -906,444 +918,508 @@ gnumeric_r_qnbinom (GnmFuncEvalInfo *ei, GnmValue const * const *args)
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_dhyper[] = {
- { GNM_FUNC_HELP_NAME, F_("R.DHYPER:probability density function of the hypergeometric distribution")
},
+static GnmFuncHelp const help_r_dnorm[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.DNORM:probability density function of the normal distribution") },
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("r:the number of red balls") },
- { GNM_FUNC_HELP_ARG, F_("b:the number of black balls") },
- { GNM_FUNC_HELP_ARG, F_("n:the number of balls drawn") },
+ { GNM_FUNC_HELP_ARG, F_("mu:mean of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("sigma:standard deviation of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("give_log:if true, log of the result will be returned instead") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the
hypergeometric distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.PHYPER,R.QHYPER" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the normal
distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.PNORM,R.QNORM" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_dhyper (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_dnorm (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float r = value_get_as_float (args[1]);
- gnm_float b = value_get_as_float (args[2]);
- gnm_float n = value_get_as_float (args[3]);
- gboolean give_log = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
+ gnm_float mu = value_get_as_float (args[1]);
+ gnm_float sigma = value_get_as_float (args[2]);
+ gboolean give_log = args[3] ? value_get_as_checked_bool (args[3]) : FALSE;
- return value_new_float (dhyper (x, r, b, n, give_log));
+ return value_new_float (dnorm (x, mu, sigma, give_log));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_phyper[] = {
- { GNM_FUNC_HELP_NAME, F_("R.PHYPER:cumulative distribution function of the hypergeometric
distribution") },
+static GnmFuncHelp const help_r_pnorm[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.PNORM:cumulative distribution function of the normal distribution") },
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("r:the number of red balls") },
- { GNM_FUNC_HELP_ARG, F_("b:the number of black balls") },
- { GNM_FUNC_HELP_ARG, F_("n:the number of balls drawn") },
+ { GNM_FUNC_HELP_ARG, F_("mu:mean of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("sigma:standard deviation of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
hypergeometric distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.DHYPER,R.QHYPER" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
normal distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DNORM,R.QNORM" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_phyper (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_pnorm (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float r = value_get_as_float (args[1]);
- gnm_float b = value_get_as_float (args[2]);
- gnm_float n = value_get_as_float (args[3]);
- gboolean lower_tail = args[4] ? value_get_as_checked_bool (args[4]) : TRUE;
- gboolean log_p = args[5] ? value_get_as_checked_bool (args[5]) : FALSE;
+ gnm_float mu = value_get_as_float (args[1]);
+ gnm_float sigma = value_get_as_float (args[2]);
+ gboolean lower_tail = args[3] ? value_get_as_checked_bool (args[3]) : TRUE;
+ gboolean log_p = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
- return value_new_float (phyper (x, r, b, n, lower_tail, log_p));
+ return value_new_float (pnorm (x, mu, sigma, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_qhyper[] = {
- { GNM_FUNC_HELP_NAME, F_("R.QHYPER:probability quantile function of the hypergeometric distribution")
},
+static GnmFuncHelp const help_r_qnorm[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.QNORM:probability quantile function of the normal distribution") },
{ GNM_FUNC_HELP_ARG, F_("p:probability or natural logarithm of the probability") },
- { GNM_FUNC_HELP_ARG, F_("r:the number of red balls") },
- { GNM_FUNC_HELP_ARG, F_("b:the number of black balls") },
- { GNM_FUNC_HELP_ARG, F_("n:the number of balls drawn") },
+ { GNM_FUNC_HELP_ARG, F_("mu:mean of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("sigma:standard deviation of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the hypergeometric distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.DHYPER,R.PHYPER" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the normal distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DNORM,R.PNORM" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_qhyper (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_qnorm (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float p = value_get_as_float (args[0]);
- gnm_float r = value_get_as_float (args[1]);
- gnm_float b = value_get_as_float (args[2]);
- gnm_float n = value_get_as_float (args[3]);
- gboolean lower_tail = args[4] ? value_get_as_checked_bool (args[4]) : TRUE;
- gboolean log_p = args[5] ? value_get_as_checked_bool (args[5]) : FALSE;
+ gnm_float mu = value_get_as_float (args[1]);
+ gnm_float sigma = value_get_as_float (args[2]);
+ gboolean lower_tail = args[3] ? value_get_as_checked_bool (args[3]) : TRUE;
+ gboolean log_p = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
- return value_new_float (qhyper (p, r, b, n, lower_tail, log_p));
+ return value_new_float (qnorm (p, mu, sigma, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_dgeom[] = {
- { GNM_FUNC_HELP_NAME, F_("R.DGEOM:probability density function of the geometric distribution") },
+static GnmFuncHelp const help_r_dpois[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.DPOIS:probability density function of the Poisson distribution") },
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("psuc:the probability of success in each trial") },
+ { GNM_FUNC_HELP_ARG, F_("lambda:the mean of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("give_log:if true, log of the result will be returned instead") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the
geometric distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.PGEOM,R.QGEOM" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the
Poisson distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.PPOIS,R.QPOIS" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_dgeom (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_dpois (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float psuc = value_get_as_float (args[1]);
+ gnm_float lambda = value_get_as_float (args[1]);
gboolean give_log = args[2] ? value_get_as_checked_bool (args[2]) : FALSE;
- return value_new_float (dgeom (x, psuc, give_log));
+ return value_new_float (dpois (x, lambda, give_log));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_pgeom[] = {
- { GNM_FUNC_HELP_NAME, F_("R.PGEOM:cumulative distribution function of the geometric distribution") },
+static GnmFuncHelp const help_r_ppois[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.PPOIS:cumulative distribution function of the Poisson distribution") },
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("psuc:the probability of success in each trial") },
+ { GNM_FUNC_HELP_ARG, F_("lambda:the mean of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
geometric distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.DGEOM,R.QGEOM" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
Poisson distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DPOIS,R.QPOIS" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_pgeom (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_ppois (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float psuc = value_get_as_float (args[1]);
+ gnm_float lambda = value_get_as_float (args[1]);
gboolean lower_tail = args[2] ? value_get_as_checked_bool (args[2]) : TRUE;
gboolean log_p = args[3] ? value_get_as_checked_bool (args[3]) : FALSE;
- return value_new_float (pgeom (x, psuc, lower_tail, log_p));
+ return value_new_float (ppois (x, lambda, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_qgeom[] = {
- { GNM_FUNC_HELP_NAME, F_("R.QGEOM:probability quantile function of the geometric distribution") },
+static GnmFuncHelp const help_r_qpois[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.QPOIS:probability quantile function of the Poisson distribution") },
{ GNM_FUNC_HELP_ARG, F_("p:probability or natural logarithm of the probability") },
- { GNM_FUNC_HELP_ARG, F_("psuc:the probability of success in each trial") },
+ { GNM_FUNC_HELP_ARG, F_("lambda:the mean of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the geometric distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.DGEOM,R.PGEOM" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the Poisson distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DPOIS,R.PPOIS" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_qgeom (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_qpois (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float p = value_get_as_float (args[0]);
- gnm_float psuc = value_get_as_float (args[1]);
+ gnm_float lambda = value_get_as_float (args[1]);
gboolean lower_tail = args[2] ? value_get_as_checked_bool (args[2]) : TRUE;
gboolean log_p = args[3] ? value_get_as_checked_bool (args[3]) : FALSE;
- return value_new_float (qgeom (p, psuc, lower_tail, log_p));
+ return value_new_float (qpois (p, lambda, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_dcauchy[] = {
- { GNM_FUNC_HELP_NAME, F_("R.DCAUCHY:probability density function of the Cauchy distribution") },
+static GnmFuncHelp const help_r_dsnorm[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.DSNORM:probability density function of the skew-normal distribution") },
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("location:the center of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("shape:the shape parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("location:the location parameter of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("scale:the scale parameter of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("give_log:if true, log of the result will be returned instead") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the Cauchy
distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.PCAUCHY,R.QCAUCHY" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the
skew-normal distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.PSNORM,R.QSNORM" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_dcauchy (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_dsnorm (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float location = value_get_as_float (args[1]);
- gnm_float scale = value_get_as_float (args[2]);
- gboolean give_log = args[3] ? value_get_as_checked_bool (args[3]) : FALSE;
+ gnm_float shape = value_get_as_float (args[1]);
+ gnm_float location = value_get_as_float (args[2]);
+ gnm_float scale = value_get_as_float (args[3]);
+ gboolean give_log = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
- return value_new_float (dcauchy (x, location, scale, give_log));
+ return value_new_float (dsnorm (x, shape, location, scale, give_log));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_pcauchy[] = {
- { GNM_FUNC_HELP_NAME, F_("R.PCAUCHY:cumulative distribution function of the Cauchy distribution") },
+static GnmFuncHelp const help_r_psnorm[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.PSNORM:cumulative distribution function of the skew-normal distribution")
},
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("location:the center of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("shape:the shape parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("location:the location parameter of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("scale:the scale parameter of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
Cauchy distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.DCAUCHY,R.QCAUCHY" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
skew-normal distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DSNORM,R.QSNORM" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_pcauchy (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_psnorm (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float location = value_get_as_float (args[1]);
- gnm_float scale = value_get_as_float (args[2]);
- gboolean lower_tail = args[3] ? value_get_as_checked_bool (args[3]) : TRUE;
- gboolean log_p = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
+ gnm_float shape = value_get_as_float (args[1]);
+ gnm_float location = value_get_as_float (args[2]);
+ gnm_float scale = value_get_as_float (args[3]);
+ gboolean lower_tail = args[4] ? value_get_as_checked_bool (args[4]) : TRUE;
+ gboolean log_p = args[5] ? value_get_as_checked_bool (args[5]) : FALSE;
- return value_new_float (pcauchy (x, location, scale, lower_tail, log_p));
+ return value_new_float (psnorm (x, shape, location, scale, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_ptukey[] = {
- { GNM_FUNC_HELP_NAME, F_("R.PTUKEY:cumulative distribution function of the Studentized range
distribution") },
- { GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("nmeans:the number of means") },
- { GNM_FUNC_HELP_ARG, F_("df:the number of degrees of freedom of the distribution") },
- { GNM_FUNC_HELP_ARG, F_("nranges:the number of ranges; default is 1") },
+static GnmFuncHelp const help_r_qsnorm[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.QSNORM:probability quantile function of the skew-normal distribution") },
+ { GNM_FUNC_HELP_ARG, F_("p:probability or natural logarithm of the probability") },
+ { GNM_FUNC_HELP_ARG, F_("shape:the shape parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("location:the location parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("scale:the scale parameter of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
Studentized range distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.QTUKEY" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the skew-normal distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DSNORM,R.PSNORM" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_ptukey (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_qsnorm (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
- gnm_float x = value_get_as_float (args[0]);
- gnm_float nmeans = value_get_as_float (args[1]);
- gnm_float df = value_get_as_float (args[2]);
- gnm_float nranges = args[3] ? value_get_as_float (args[3]) : 1;
+ gnm_float p = value_get_as_float (args[0]);
+ gnm_float shape = value_get_as_float (args[1]);
+ gnm_float location = value_get_as_float (args[2]);
+ gnm_float scale = value_get_as_float (args[3]);
gboolean lower_tail = args[4] ? value_get_as_checked_bool (args[4]) : TRUE;
gboolean log_p = args[5] ? value_get_as_checked_bool (args[5]) : FALSE;
- return value_new_float (ptukey (x, nmeans, df, nranges, lower_tail, log_p));
+ return value_new_float (qsnorm (p, shape, location, scale, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_qtukey[] = {
- { GNM_FUNC_HELP_NAME, F_("R.QTUKEY:probability quantile function of the Studentized range
distribution") },
- { GNM_FUNC_HELP_ARG, F_("p:probability or natural logarithm of the probability") },
- { GNM_FUNC_HELP_ARG, F_("nmeans:the number of means") },
- { GNM_FUNC_HELP_ARG, F_("df:the number of degrees of freedom of the distribution") },
- { GNM_FUNC_HELP_ARG, F_("nranges:the number of ranges; default is 1") },
+static GnmFuncHelp const help_r_dst[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.DST:probability density function of the skew-t distribution") },
+ { GNM_FUNC_HELP_ARG, F_("x:observation") },
+ { GNM_FUNC_HELP_ARG, F_("n:the number of degrees of freedom of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("shape:the shape parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("give_log:if true, log of the result will be returned instead") },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the skew-t
distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.PST,R.QST" },
+ { GNM_FUNC_HELP_END }
+};
+
+static GnmValue *
+gnumeric_r_dst (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+{
+ gnm_float x = value_get_as_float (args[0]);
+ gnm_float n = value_get_as_float (args[1]);
+ gnm_float shape = value_get_as_float (args[2]);
+ gboolean give_log = args[3] ? value_get_as_checked_bool (args[3]) : FALSE;
+
+ return value_new_float (dst (x, n, shape, give_log));
+}
+
+/* ------------------------------------------------------------------------- */
+
+static GnmFuncHelp const help_r_pst[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.PST:cumulative distribution function of the skew-t distribution") },
+ { GNM_FUNC_HELP_ARG, F_("x:observation") },
+ { GNM_FUNC_HELP_ARG, F_("n:the number of degrees of freedom of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("shape:the shape parameter of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the Studentized range distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.PTUKEY" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
skew-t distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DST,R.QST" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_qtukey (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_pst (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
- gnm_float p = value_get_as_float (args[0]);
- gnm_float nmeans = value_get_as_float (args[1]);
- gnm_float df = value_get_as_float (args[2]);
- gnm_float nranges = args[3] ? value_get_as_float (args[3]) : 1;
- gboolean lower_tail = args[4] ? value_get_as_checked_bool (args[4]) : TRUE;
- gboolean log_p = args[5] ? value_get_as_checked_bool (args[5]) : FALSE;
+ gnm_float x = value_get_as_float (args[0]);
+ gnm_float n = value_get_as_float (args[1]);
+ gnm_float shape = value_get_as_float (args[2]);
+ gboolean lower_tail = args[3] ? value_get_as_checked_bool (args[3]) : TRUE;
+ gboolean log_p = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
- return value_new_float (qtukey (p, nmeans, df, nranges, lower_tail, log_p));
+ return value_new_float (pst (x, n, shape, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_qcauchy[] = {
- { GNM_FUNC_HELP_NAME, F_("R.QCAUCHY:probability quantile function of the Cauchy distribution") },
+static GnmFuncHelp const help_r_qst[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.QST:probability quantile function of the skew-t distribution") },
{ GNM_FUNC_HELP_ARG, F_("p:probability or natural logarithm of the probability") },
- { GNM_FUNC_HELP_ARG, F_("location:the center of the distribution") },
- { GNM_FUNC_HELP_ARG, F_("scale:the scale parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("n:the number of degrees of freedom of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("shape:the shape parameter of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the Cauchy distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.DCAUCHY,R.PCAUCHY" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the skew-t distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DST,R.PST" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_qcauchy (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_qst (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float p = value_get_as_float (args[0]);
- gnm_float location = value_get_as_float (args[1]);
- gnm_float scale = value_get_as_float (args[2]);
+ gnm_float n = value_get_as_float (args[1]);
+ gnm_float shape = value_get_as_float (args[2]);
gboolean lower_tail = args[3] ? value_get_as_checked_bool (args[3]) : TRUE;
gboolean log_p = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
- return value_new_float (qcauchy (p, location, scale, lower_tail, log_p));
+ return value_new_float (qst (p, n, shape, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_dsnorm[] = {
- { GNM_FUNC_HELP_NAME, F_("R.DSNORM:probability density function of the skew-normal distribution") },
+static GnmFuncHelp const help_r_dt[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.DT:probability density function of the Student t distribution") },
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("shape:the shape parameter of the distribution") },
- { GNM_FUNC_HELP_ARG, F_("location:the location parameter of the distribution") },
- { GNM_FUNC_HELP_ARG, F_("scale:the scale parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("n:the number of degrees of freedom of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("give_log:if true, log of the result will be returned instead") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the
skew-normal distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.PSNORM,R.QSNORM" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the
Student t distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.PT,R.QT" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_dsnorm (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_dt (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float shape = value_get_as_float (args[1]);
- gnm_float location = value_get_as_float (args[2]);
- gnm_float scale = value_get_as_float (args[3]);
- gboolean give_log = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
+ gnm_float n = value_get_as_float (args[1]);
+ gboolean give_log = args[2] ? value_get_as_checked_bool (args[2]) : FALSE;
- return value_new_float (dsnorm (x, shape, location, scale, give_log));
+ return value_new_float (dt (x, n, give_log));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_psnorm[] = {
- { GNM_FUNC_HELP_NAME, F_("R.PSNORM:cumulative distribution function of the skew-normal distribution")
},
+static GnmFuncHelp const help_r_pt[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.PT:cumulative distribution function of the Student t distribution") },
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("shape:the shape parameter of the distribution") },
- { GNM_FUNC_HELP_ARG, F_("location:the location parameter of the distribution") },
- { GNM_FUNC_HELP_ARG, F_("scale:the scale parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("n:the number of degrees of freedom of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
skew-normal distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.DSNORM,R.QSNORM" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
Student t distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DT,R.QT" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_psnorm (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_pt (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float shape = value_get_as_float (args[1]);
- gnm_float location = value_get_as_float (args[2]);
- gnm_float scale = value_get_as_float (args[3]);
+ gnm_float n = value_get_as_float (args[1]);
+ gboolean lower_tail = args[2] ? value_get_as_checked_bool (args[2]) : TRUE;
+ gboolean log_p = args[3] ? value_get_as_checked_bool (args[3]) : FALSE;
+
+ return value_new_float (pt (x, n, lower_tail, log_p));
+}
+
+/* ------------------------------------------------------------------------- */
+
+static GnmFuncHelp const help_r_qt[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.QT:probability quantile function of the Student t distribution") },
+ { GNM_FUNC_HELP_ARG, F_("p:probability or natural logarithm of the probability") },
+ { GNM_FUNC_HELP_ARG, F_("n:the number of degrees of freedom of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
+ { GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the Student t distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DT,R.PT" },
+ { GNM_FUNC_HELP_END }
+};
+
+static GnmValue *
+gnumeric_r_qt (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+{
+ gnm_float p = value_get_as_float (args[0]);
+ gnm_float n = value_get_as_float (args[1]);
+ gboolean lower_tail = args[2] ? value_get_as_checked_bool (args[2]) : TRUE;
+ gboolean log_p = args[3] ? value_get_as_checked_bool (args[3]) : FALSE;
+
+ return value_new_float (qt (p, n, lower_tail, log_p));
+}
+
+/* ------------------------------------------------------------------------- */
+
+static GnmFuncHelp const help_r_ptukey[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.PTUKEY:cumulative distribution function of the Studentized range
distribution") },
+ { GNM_FUNC_HELP_ARG, F_("x:observation") },
+ { GNM_FUNC_HELP_ARG, F_("nmeans:the number of means") },
+ { GNM_FUNC_HELP_ARG, F_("df:the number of degrees of freedom of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("nranges:the number of ranges; default is 1") },
+ { GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
+ { GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
Studentized range distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.QTUKEY" },
+ { GNM_FUNC_HELP_END }
+};
+
+static GnmValue *
+gnumeric_r_ptukey (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+{
+ gnm_float x = value_get_as_float (args[0]);
+ gnm_float nmeans = value_get_as_float (args[1]);
+ gnm_float df = value_get_as_float (args[2]);
+ gnm_float nranges = args[3] ? value_get_as_float (args[3]) : 1;
gboolean lower_tail = args[4] ? value_get_as_checked_bool (args[4]) : TRUE;
gboolean log_p = args[5] ? value_get_as_checked_bool (args[5]) : FALSE;
- return value_new_float (psnorm (x, shape, location, scale, lower_tail, log_p));
+ return value_new_float (ptukey (x, nmeans, df, nranges, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_qsnorm[] = {
- { GNM_FUNC_HELP_NAME, F_("R.QSNORM:probability quantile function of the skew-normal distribution") },
+static GnmFuncHelp const help_r_qtukey[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.QTUKEY:probability quantile function of the Studentized range
distribution") },
{ GNM_FUNC_HELP_ARG, F_("p:probability or natural logarithm of the probability") },
- { GNM_FUNC_HELP_ARG, F_("shape:the shape parameter of the distribution") },
- { GNM_FUNC_HELP_ARG, F_("location:the location parameter of the distribution") },
- { GNM_FUNC_HELP_ARG, F_("scale:the scale parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("nmeans:the number of means") },
+ { GNM_FUNC_HELP_ARG, F_("df:the number of degrees of freedom of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("nranges:the number of ranges; default is 1") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the skew-normal distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.DSNORM,R.PSNORM" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the Studentized range distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.PTUKEY" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_qsnorm (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_qtukey (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float p = value_get_as_float (args[0]);
- gnm_float shape = value_get_as_float (args[1]);
- gnm_float location = value_get_as_float (args[2]);
- gnm_float scale = value_get_as_float (args[3]);
+ gnm_float nmeans = value_get_as_float (args[1]);
+ gnm_float df = value_get_as_float (args[2]);
+ gnm_float nranges = args[3] ? value_get_as_float (args[3]) : 1;
gboolean lower_tail = args[4] ? value_get_as_checked_bool (args[4]) : TRUE;
gboolean log_p = args[5] ? value_get_as_checked_bool (args[5]) : FALSE;
- return value_new_float (qsnorm (p, shape, location, scale, lower_tail, log_p));
+ return value_new_float (qtukey (p, nmeans, df, nranges, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_dst[] = {
- { GNM_FUNC_HELP_NAME, F_("R.DST:probability density function of the skew-t distribution") },
+static GnmFuncHelp const help_r_dweibull[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.DWEIBULL:probability density function of the Weibull distribution") },
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("n:the number of degrees of freedom of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("shape:the shape parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("scale:the scale parameter of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("give_log:if true, log of the result will be returned instead") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the skew-t
distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.PST,R.QST" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability density function of the
Weibull distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.PWEIBULL,R.QWEIBULL" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_dst (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_dweibull (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float n = value_get_as_float (args[1]);
- gnm_float shape = value_get_as_float (args[2]);
+ gnm_float shape = value_get_as_float (args[1]);
+ gnm_float scale = value_get_as_float (args[2]);
gboolean give_log = args[3] ? value_get_as_checked_bool (args[3]) : FALSE;
- return value_new_float (dst (x, n, shape, give_log));
+ return value_new_float (dweibull (x, shape, scale, give_log));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_pst[] = {
- { GNM_FUNC_HELP_NAME, F_("R.PST:cumulative distribution function of the skew-t distribution") },
+static GnmFuncHelp const help_r_pweibull[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.PWEIBULL:cumulative distribution function of the Weibull distribution") },
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
- { GNM_FUNC_HELP_ARG, F_("n:the number of degrees of freedom of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("shape:the shape parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("scale:the scale parameter of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
skew-t distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.DST,R.QST" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the cumulative distribution function of the
Weibull distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DWEIBULL,R.QWEIBULL" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_pst (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_pweibull (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float x = value_get_as_float (args[0]);
- gnm_float n = value_get_as_float (args[1]);
- gnm_float shape = value_get_as_float (args[2]);
+ gnm_float shape = value_get_as_float (args[1]);
+ gnm_float scale = value_get_as_float (args[2]);
gboolean lower_tail = args[3] ? value_get_as_checked_bool (args[3]) : TRUE;
gboolean log_p = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
- return value_new_float (pst (x, n, shape, lower_tail, log_p));
+ return value_new_float (pweibull (x, shape, scale, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
-static GnmFuncHelp const help_r_qst[] = {
- { GNM_FUNC_HELP_NAME, F_("R.QST:probability quantile function of the skew-t distribution") },
+static GnmFuncHelp const help_r_qweibull[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.QWEIBULL:probability quantile function of the Weibull distribution") },
{ GNM_FUNC_HELP_ARG, F_("p:probability or natural logarithm of the probability") },
- { GNM_FUNC_HELP_ARG, F_("n:the number of degrees of freedom of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("shape:the shape parameter of the distribution") },
+ { GNM_FUNC_HELP_ARG, F_("scale:the scale parameter of the distribution") },
{ GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is
considered") },
{ GNM_FUNC_HELP_ARG, F_("log_p:if true, the natural logarithm of the probability is given or
returned; defaults to false") },
- { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the skew-t distribution.") },
- { GNM_FUNC_HELP_SEEALSO, "R.DST,R.PST" },
+ { GNM_FUNC_HELP_DESCRIPTION, F_("This function returns the probability quantile function, i.e., the
inverse of the cumulative distribution function, of the Weibull distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DWEIBULL,R.PWEIBULL" },
{ GNM_FUNC_HELP_END }
};
static GnmValue *
-gnumeric_r_qst (GnmFuncEvalInfo *ei, GnmValue const * const *args)
+gnumeric_r_qweibull (GnmFuncEvalInfo *ei, GnmValue const * const *args)
{
gnm_float p = value_get_as_float (args[0]);
- gnm_float n = value_get_as_float (args[1]);
- gnm_float shape = value_get_as_float (args[2]);
+ gnm_float shape = value_get_as_float (args[1]);
+ gnm_float scale = value_get_as_float (args[2]);
gboolean lower_tail = args[3] ? value_get_as_checked_bool (args[3]) : TRUE;
gboolean log_p = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
- return value_new_float (qst (p, n, shape, lower_tail, log_p));
+ return value_new_float (qweibull (p, shape, scale, lower_tail, log_p));
}
/* ------------------------------------------------------------------------- */
@@ -1362,108 +1438,108 @@ go_plugin_shutdown (GOPlugin *plugin, GOCmdContext *cc)
GnmFuncDescriptor const rstat_functions[] = {
{
- "r.dnorm",
+ "r.dbeta",
"fff|b",
- help_r_dnorm,
- gnumeric_r_dnorm, NULL, NULL, NULL,
+ help_r_dbeta,
+ gnumeric_r_dbeta, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.pnorm",
+ "r.pbeta",
"fff|bb",
- help_r_pnorm,
- gnumeric_r_pnorm, NULL, NULL, NULL,
+ help_r_pbeta,
+ gnumeric_r_pbeta, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.qnorm",
+ "r.qbeta",
"fff|bb",
- help_r_qnorm,
- gnumeric_r_qnorm, NULL, NULL, NULL,
+ help_r_qbeta,
+ gnumeric_r_qbeta, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.dlnorm",
+ "r.dbinom",
"fff|b",
- help_r_dlnorm,
- gnumeric_r_dlnorm, NULL, NULL, NULL,
+ help_r_dbinom,
+ gnumeric_r_dbinom, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.plnorm",
+ "r.pbinom",
"fff|bb",
- help_r_plnorm,
- gnumeric_r_plnorm, NULL, NULL, NULL,
+ help_r_pbinom,
+ gnumeric_r_pbinom, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.qlnorm",
+ "r.qbinom",
"fff|bb",
- help_r_qlnorm,
- gnumeric_r_qlnorm, NULL, NULL, NULL,
+ help_r_qbinom,
+ gnumeric_r_qbinom, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.dgamma",
+ "r.dcauchy",
"fff|b",
- help_r_dgamma,
- gnumeric_r_dgamma, NULL, NULL, NULL,
+ help_r_dcauchy,
+ gnumeric_r_dcauchy, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.pgamma",
+ "r.pcauchy",
"fff|bb",
- help_r_pgamma,
- gnumeric_r_pgamma, NULL, NULL, NULL,
+ help_r_pcauchy,
+ gnumeric_r_pcauchy, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.qgamma",
+ "r.qcauchy",
"fff|bb",
- help_r_qgamma,
- gnumeric_r_qgamma, NULL, NULL, NULL,
+ help_r_qcauchy,
+ gnumeric_r_qcauchy, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.dbeta",
- "fff|b",
- help_r_dbeta,
- gnumeric_r_dbeta, NULL, NULL, NULL,
+ "r.dchisq",
+ "ff|b",
+ help_r_dchisq,
+ gnumeric_r_dchisq, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.pbeta",
- "fff|bb",
- help_r_pbeta,
- gnumeric_r_pbeta, NULL, NULL, NULL,
+ "r.pchisq",
+ "ff|bb",
+ help_r_pchisq,
+ gnumeric_r_pchisq, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.qbeta",
- "fff|bb",
- help_r_qbeta,
- gnumeric_r_qbeta, NULL, NULL, NULL,
+ "r.qchisq",
+ "ff|bb",
+ help_r_qchisq,
+ gnumeric_r_qchisq, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.dt",
+ "r.dexp",
"ff|b",
- help_r_dt,
- gnumeric_r_dt, NULL, NULL, NULL,
+ help_r_dexp,
+ gnumeric_r_dexp, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.pt",
+ "r.pexp",
"ff|bb",
- help_r_pt,
- gnumeric_r_pt, NULL, NULL, NULL,
+ help_r_pexp,
+ gnumeric_r_pexp, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.qt",
+ "r.qexp",
"ff|bb",
- help_r_qt,
- gnumeric_r_qt, NULL, NULL, NULL,
+ help_r_qexp,
+ gnumeric_r_qexp, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
@@ -1488,108 +1564,108 @@ GnmFuncDescriptor const rstat_functions[] = {
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.dchisq",
- "ff|b",
- help_r_dchisq,
- gnumeric_r_dchisq, NULL, NULL, NULL,
+ "r.dgamma",
+ "fff|b",
+ help_r_dgamma,
+ gnumeric_r_dgamma, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.pchisq",
- "ff|bb",
- help_r_pchisq,
- gnumeric_r_pchisq, NULL, NULL, NULL,
+ "r.pgamma",
+ "fff|bb",
+ help_r_pgamma,
+ gnumeric_r_pgamma, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.qchisq",
- "ff|bb",
- help_r_qchisq,
- gnumeric_r_qchisq, NULL, NULL, NULL,
+ "r.qgamma",
+ "fff|bb",
+ help_r_qgamma,
+ gnumeric_r_qgamma, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.dweibull",
- "fff|b",
- help_r_dweibull,
- gnumeric_r_dweibull, NULL, NULL, NULL,
+ "r.dgeom",
+ "ff|b",
+ help_r_dgeom,
+ gnumeric_r_dgeom, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.pweibull",
- "fff|bb",
- help_r_pweibull,
- gnumeric_r_pweibull, NULL, NULL, NULL,
+ "r.pgeom",
+ "ff|bb",
+ help_r_pgeom,
+ gnumeric_r_pgeom, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.qweibull",
- "fff|bb",
- help_r_qweibull,
- gnumeric_r_qweibull, NULL, NULL, NULL,
+ "r.qgeom",
+ "ff|bb",
+ help_r_qgeom,
+ gnumeric_r_qgeom, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.dpois",
- "ff|b",
- help_r_dpois,
- gnumeric_r_dpois, NULL, NULL, NULL,
+ "r.dgumbel",
+ "fff|b",
+ help_r_dgumbel,
+ gnumeric_r_dgumbel, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.ppois",
- "ff|bb",
- help_r_ppois,
- gnumeric_r_ppois, NULL, NULL, NULL,
+ "r.pgumbel",
+ "fff|bb",
+ help_r_pgumbel,
+ gnumeric_r_pgumbel, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.qpois",
- "ff|bb",
- help_r_qpois,
- gnumeric_r_qpois, NULL, NULL, NULL,
+ "r.qgumbel",
+ "fff|bb",
+ help_r_qgumbel,
+ gnumeric_r_qgumbel, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.dexp",
- "ff|b",
- help_r_dexp,
- gnumeric_r_dexp, NULL, NULL, NULL,
+ "r.dhyper",
+ "ffff|b",
+ help_r_dhyper,
+ gnumeric_r_dhyper, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.pexp",
- "ff|bb",
- help_r_pexp,
- gnumeric_r_pexp, NULL, NULL, NULL,
+ "r.phyper",
+ "ffff|bb",
+ help_r_phyper,
+ gnumeric_r_phyper, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.qexp",
- "ff|bb",
- help_r_qexp,
- gnumeric_r_qexp, NULL, NULL, NULL,
+ "r.qhyper",
+ "ffff|bb",
+ help_r_qhyper,
+ gnumeric_r_qhyper, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.dbinom",
+ "r.dlnorm",
"fff|b",
- help_r_dbinom,
- gnumeric_r_dbinom, NULL, NULL, NULL,
+ help_r_dlnorm,
+ gnumeric_r_dlnorm, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.pbinom",
+ "r.plnorm",
"fff|bb",
- help_r_pbinom,
- gnumeric_r_pbinom, NULL, NULL, NULL,
+ help_r_plnorm,
+ gnumeric_r_plnorm, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.qbinom",
+ "r.qlnorm",
"fff|bb",
- help_r_qbinom,
- gnumeric_r_qbinom, NULL, NULL, NULL,
+ help_r_qlnorm,
+ gnumeric_r_qlnorm, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
@@ -1614,80 +1690,45 @@ GnmFuncDescriptor const rstat_functions[] = {
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.dhyper",
- "ffff|b",
- help_r_dhyper,
- gnumeric_r_dhyper, NULL, NULL, NULL,
+ "r.dnorm",
+ "fff|b",
+ help_r_dnorm,
+ gnumeric_r_dnorm, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.phyper",
- "ffff|bb",
- help_r_phyper,
- gnumeric_r_phyper, NULL, NULL, NULL,
+ "r.pnorm",
+ "fff|bb",
+ help_r_pnorm,
+ gnumeric_r_pnorm, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.qhyper",
- "ffff|bb",
- help_r_qhyper,
- gnumeric_r_qhyper, NULL, NULL, NULL,
+ "r.qnorm",
+ "fff|bb",
+ help_r_qnorm,
+ gnumeric_r_qnorm, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.dgeom",
+ "r.dpois",
"ff|b",
- help_r_dgeom,
- gnumeric_r_dgeom, NULL, NULL, NULL,
+ help_r_dpois,
+ gnumeric_r_dpois, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.pgeom",
+ "r.ppois",
"ff|bb",
- help_r_pgeom,
- gnumeric_r_pgeom, NULL, NULL, NULL,
+ help_r_ppois,
+ gnumeric_r_ppois, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
- "r.qgeom",
+ "r.qpois",
"ff|bb",
- help_r_qgeom,
- gnumeric_r_qgeom, NULL, NULL, NULL,
- GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
- },
- {
- "r.dcauchy",
- "fff|b",
- help_r_dcauchy,
- gnumeric_r_dcauchy, NULL, NULL, NULL,
- GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
- },
- {
- "r.pcauchy",
- "fff|bb",
- help_r_pcauchy,
- gnumeric_r_pcauchy, NULL, NULL, NULL,
- GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
- },
- {
- "r.ptukey",
- "fff|fbb",
- help_r_ptukey,
- gnumeric_r_ptukey, NULL, NULL, NULL,
- GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
- },
- {
- "r.qtukey",
- "fff|fbb",
- help_r_qtukey,
- gnumeric_r_qtukey, NULL, NULL, NULL,
- GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
- },
- {
- "r.qcauchy",
- "fff|bb",
- help_r_qcauchy,
- gnumeric_r_qcauchy, NULL, NULL, NULL,
+ help_r_qpois,
+ gnumeric_r_qpois, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
@@ -1732,5 +1773,61 @@ GnmFuncDescriptor const rstat_functions[] = {
gnumeric_r_qst, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
+ {
+ "r.dt",
+ "ff|b",
+ help_r_dt,
+ gnumeric_r_dt, NULL, NULL, NULL,
+ GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
+ },
+ {
+ "r.pt",
+ "ff|bb",
+ help_r_pt,
+ gnumeric_r_pt, NULL, NULL, NULL,
+ GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
+ },
+ {
+ "r.qt",
+ "ff|bb",
+ help_r_qt,
+ gnumeric_r_qt, NULL, NULL, NULL,
+ GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
+ },
+ {
+ "r.ptukey",
+ "fff|fbb",
+ help_r_ptukey,
+ gnumeric_r_ptukey, NULL, NULL, NULL,
+ GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
+ },
+ {
+ "r.qtukey",
+ "fff|fbb",
+ help_r_qtukey,
+ gnumeric_r_qtukey, NULL, NULL, NULL,
+ GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
+ },
+ {
+ "r.dweibull",
+ "fff|b",
+ help_r_dweibull,
+ gnumeric_r_dweibull, NULL, NULL, NULL,
+ GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
+ },
+ {
+ "r.pweibull",
+ "fff|bb",
+ help_r_pweibull,
+ gnumeric_r_pweibull, NULL, NULL, NULL,
+ GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
+ },
+ {
+ "r.qweibull",
+ "fff|bb",
+ help_r_qweibull,
+ gnumeric_r_qweibull, NULL, NULL, NULL,
+ GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
+ },
{ NULL }
};
diff --git a/plugins/fn-r/generate b/plugins/fn-r/generate
index dc10e90..9c16db4 100644
--- a/plugins/fn-r/generate
+++ b/plugins/fn-r/generate
@@ -143,6 +143,13 @@ my %defaults;
'df' => "the number of degrees of freedom $of",
@common })];
$defaults{'ptukey:nranges'} = $defaults{'qtukey:nranges'} = 1;
+
+ $funcs{'dgumbel'} = $funcs{'pgumbel'} = $funcs{'qgumbel'} =
+ [\&distribution,
+ 'Gumbel',
+ ({ 'mu' => "the location parameter of freedom $of",
+ 'beta' => "the scale parameter of freedom $of",
+ @common })];
}
@@ -173,8 +180,12 @@ my %type_setter =
my $mathfunch = $0;
$mathfunch =~ s|[^/]+$|../../src/mathfunc.h|;
+my $dpqh = $0;
+$dpqh =~ s|[^/]+$|../../src/sf-dpq.h|;
+
+
my $funcdefs = "";
-my @funcnames = ();
+my %functions;
my $emitted = "";
@@ -191,7 +202,7 @@ my $emitted = "";
"#include \"extra.h\"\n\n" .
"GNM_PLUGIN_MODULE_HEADER;\n\n");
-foreach my $header ($mathfunch, "extra.h") {
+foreach my $header ($mathfunch, $dpqh, "extra.h") {
local (*HEADER);
open (HEADER, "<$header") or die "$0: Cannot read $header: $!\n";
while (<HEADER>) {
@@ -201,15 +212,19 @@ foreach my $header ($mathfunch, "extra.h") {
my $restype = $1;
my $func = $2;
next unless exists $funcs{$func};
- my ($handler,@args) = @{ $funcs{$func} };
-
- &$handler ($func, $restype, $_, @args);
- push @funcnames, "r.$func";
+ $functions{$func} = [$restype,$_];
}
}
close (HEADER);
}
+foreach my $func (sort { &cfileorder($a,$b) } keys %functions) {
+ my ($restype,$proto) = @{$functions{$func}};
+ my ($handler,@args) = @{ $funcs{$func} };
+ &$handler ($func, $restype, $proto, @args);
+}
+
+
&emit_line ();
&emit ("G_MODULE_EXPORT void\n" .
@@ -230,7 +245,15 @@ foreach my $header ($mathfunch, "extra.h") {
"};\n");
&emit_dump ("functions.c");
-&create_plugin_xml_in (@funcnames);
+&create_plugin_xml_in (keys %functions);
+
+# -----------------------------------------------------------------------------
+
+sub cfileorder {
+ my ($a,$b) = @_;
+ return ((substr($a,1) cmp substr($b,1)) ||
+ (substr($a,0,1) cmp substr($b,0,1)));
+}
# -----------------------------------------------------------------------------
@@ -411,11 +434,12 @@ sub create_plugin_xml_in {
"\t\t<attribute name=\"module_file\" value=\"rstat\"/>\n" .
"\t</loader>\n" .
"\t<services>\n" .
- "\t\t<service type=\"function_group\" id=\"stat\">\n" .
+ "\t\t<service type=\"function_group\" id=\"rstat\">\n" .
"\t\t\t<_category>Statistics</_category>\n" .
- "\t\t\t<functions textdomain=\"gnumeric-functions\">\n");
+ "\t\t\t<functions textdomain=\"gnumeric-VERSION-functions\">\n");
- foreach my $rfunc (sort @funcnames) {
+ foreach my $func (sort @funcnames) {
+ my $rfunc = "r.$func";
&emit ("\t\t\t\t<function name=\"$rfunc\"/>\n");
}
diff --git a/plugins/fn-r/plugin.xml.in b/plugins/fn-r/plugin.xml.in
index 7e347de..5d26a3d 100644
--- a/plugins/fn-r/plugin.xml.in
+++ b/plugins/fn-r/plugin.xml.in
@@ -19,6 +19,7 @@
<function name="r.df"/>
<function name="r.dgamma"/>
<function name="r.dgeom"/>
+ <function name="r.dgumbel"/>
<function name="r.dhyper"/>
<function name="r.dlnorm"/>
<function name="r.dnbinom"/>
@@ -36,6 +37,7 @@
<function name="r.pf"/>
<function name="r.pgamma"/>
<function name="r.pgeom"/>
+ <function name="r.pgumbel"/>
<function name="r.phyper"/>
<function name="r.plnorm"/>
<function name="r.pnbinom"/>
@@ -54,6 +56,7 @@
<function name="r.qf"/>
<function name="r.qgamma"/>
<function name="r.qgeom"/>
+ <function name="r.qgumbel"/>
<function name="r.qhyper"/>
<function name="r.qlnorm"/>
<function name="r.qnbinom"/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]