[gnumeric] R.DRAYLEIGH, R.PRAYLEIGH, R.QRAYLEIGH: New functions.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] R.DRAYLEIGH, R.PRAYLEIGH, R.QRAYLEIGH: New functions.
- Date: Sat, 5 Dec 2015 19:45:42 +0000 (UTC)
commit 5ca73f45397e747435859400f48d6ed69528556e
Author: Morten Welinder <terra gnome org>
Date: Sat Dec 5 14:45:22 2015 -0500
R.DRAYLEIGH, R.PRAYLEIGH, R.QRAYLEIGH: New functions.
These are just special cases of the Weibull funtions, so nothing really
new here.
NEWS | 1 +
doc/C/func.defs | 32 +++++++++++++
doc/C/functions.xml | 104 ++++++++++++++++++++++++++++++++++++++++++++
plugins/fn-r/functions.c | 91 ++++++++++++++++++++++++++++++++++++++
plugins/fn-r/generate | 5 ++
plugins/fn-r/plugin.xml.in | 3 +
6 files changed, 236 insertions(+), 0 deletions(-)
---
diff --git a/NEWS b/NEWS
index c738b86..fef5a92 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ Morten:
* Fix conditional format problem. [#750271]
* Test also RANDWEIBULL and RANDLOGNORM.
* Fix problem with R.QHYPER
+ * Add R.DRAYLEIGH, R.PRAYLEIGH, R.QRAYLEIGH.
--------------------------------------------------------------------------
Gnumeric 1.12.24
diff --git a/doc/C/func.defs b/doc/C/func.defs
index c8af86a..8e95888 100644
--- a/doc/C/func.defs
+++ b/doc/C/func.defs
@@ -5380,6 +5380,16 @@ If the data set does not contain any duplicates this function returns a #N/A err
@SEEALSO=R.PPOIS,R.QPOIS
@CATEGORY=Statistics
+ FUNCTION=R DRAYLEIGH
+ SHORTDESC=probability density function of the Rayleigh distribution
+ SYNTAX=R DRAYLEIGH(x,scale,give_log)
+ ARGUMENTDESCRIPTION=@{x}: observation
+ {scale}: the scale parameter 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 Rayleigh distribution.
+ SEEALSO=R PRAYLEIGH,R.QRAYLEIGH
+
+ CATEGORY=Statistics
@FUNCTION=R.DSNORM
@SHORTDESC=probability density function of the skew-normal distribution
@SYNTAX=R.DSNORM(x,shape,location,scale,give_log)
@@ -5590,6 +5600,17 @@ If the data set does not contain any duplicates this function returns a #N/A err
@SEEALSO=R.DPOIS,R.QPOIS
@CATEGORY=Statistics
+ FUNCTION=R PRAYLEIGH
+ SHORTDESC=cumulative distribution function of the Rayleigh distribution
+ SYNTAX=R PRAYLEIGH(x,scale,lower_tail,log_p)
+ ARGUMENTDESCRIPTION=@{x}: observation
+ {scale}: the scale parameter 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 Rayleigh distribution.
+ SEEALSO=R DRAYLEIGH,R.QRAYLEIGH
+
+ CATEGORY=Statistics
@FUNCTION=R.PSNORM
@SHORTDESC=cumulative distribution function of the skew-normal distribution
@SYNTAX=R.PSNORM(x,shape,location,scale,lower_tail,log_p)
@@ -5817,6 +5838,17 @@ If the data set does not contain any duplicates this function returns a #N/A err
@SEEALSO=R.DPOIS,R.PPOIS
@CATEGORY=Statistics
+ FUNCTION=R QRAYLEIGH
+ SHORTDESC=probability quantile function of the Rayleigh distribution
+ SYNTAX=R QRAYLEIGH(p,scale,lower_tail,log_p)
+ ARGUMENTDESCRIPTION=@{p}: probability or natural logarithm of the probability
+ {scale}: the scale parameter 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 Rayleigh distribution.
+ SEEALSO=R DRAYLEIGH,R.PRAYLEIGH
+
+ CATEGORY=Statistics
@FUNCTION=R.QSNORM
@SHORTDESC=probability quantile function of the skew-normal distribution
@SYNTAX=R.QSNORM(p,shape,location,scale,lower_tail,log_p)
diff --git a/doc/C/functions.xml b/doc/C/functions.xml
index 3f1161c..edcd747 100644
--- a/doc/C/functions.xml
+++ b/doc/C/functions.xml
@@ -18381,6 +18381,40 @@
</para>
</refsect1>
</refentry>
+ <refentry id="gnumeric-function-R.DRAYLEIGH">
+ <refmeta>
+ <refentrytitle>
+ <function>R.DRAYLEIGH</function>
+ </refentrytitle>
+ </refmeta>
+ <refnamediv>
+ <refname>
+ <function>R.DRAYLEIGH</function>
+ </refname>
+ <refpurpose>
+ probability density function of the Rayleigh distribution
+ </refpurpose>
+ </refnamediv>
+ <refsynopsisdiv>
+
<synopsis><function>R.DRAYLEIGH</function>(<parameter>x</parameter>,<parameter>scale</parameter>,<parameter>give_log</parameter>)</synopsis>
+ </refsynopsisdiv>
+ <refsect1>
+ <title>Arguments</title>
+ <para><parameter>x</parameter>: observation</para>
+ <para><parameter>scale</parameter>: the scale parameter 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 Rayleigh distribution.</para>
+ </refsect1>
+ <refsect1>
+ <title>See also</title>
+ <para><link linkend="gnumeric-function-R.PRAYLEIGH"><function>R.PRAYLEIGH</function></link>,
+ <link linkend="gnumeric-function-R.QRAYLEIGH"><function>R.QRAYLEIGH</function></link>.
+ </para>
+ </refsect1>
+ </refentry>
<refentry id="gnumeric-function-R.DSNORM">
<refmeta>
<refentrytitle>
@@ -19026,6 +19060,41 @@
</para>
</refsect1>
</refentry>
+ <refentry id="gnumeric-function-R.PRAYLEIGH">
+ <refmeta>
+ <refentrytitle>
+ <function>R.PRAYLEIGH</function>
+ </refentrytitle>
+ </refmeta>
+ <refnamediv>
+ <refname>
+ <function>R.PRAYLEIGH</function>
+ </refname>
+ <refpurpose>
+ cumulative distribution function of the Rayleigh distribution
+ </refpurpose>
+ </refnamediv>
+ <refsynopsisdiv>
+
<synopsis><function>R.PRAYLEIGH</function>(<parameter>x</parameter>,<parameter>scale</parameter>,<parameter>lower_tail</parameter>,<parameter>log_p</parameter>)</synopsis>
+ </refsynopsisdiv>
+ <refsect1>
+ <title>Arguments</title>
+ <para><parameter>x</parameter>: observation</para>
+ <para><parameter>scale</parameter>: the scale parameter 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 Rayleigh distribution.</para>
+ </refsect1>
+ <refsect1>
+ <title>See also</title>
+ <para><link linkend="gnumeric-function-R.DRAYLEIGH"><function>R.DRAYLEIGH</function></link>,
+ <link linkend="gnumeric-function-R.QRAYLEIGH"><function>R.QRAYLEIGH</function></link>.
+ </para>
+ </refsect1>
+ </refentry>
<refentry id="gnumeric-function-R.PSNORM">
<refmeta>
<refentrytitle>
@@ -19711,6 +19780,41 @@
</para>
</refsect1>
</refentry>
+ <refentry id="gnumeric-function-R.QRAYLEIGH">
+ <refmeta>
+ <refentrytitle>
+ <function>R.QRAYLEIGH</function>
+ </refentrytitle>
+ </refmeta>
+ <refnamediv>
+ <refname>
+ <function>R.QRAYLEIGH</function>
+ </refname>
+ <refpurpose>
+ probability quantile function of the Rayleigh distribution
+ </refpurpose>
+ </refnamediv>
+ <refsynopsisdiv>
+
<synopsis><function>R.QRAYLEIGH</function>(<parameter>p</parameter>,<parameter>scale</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>scale</parameter>: the scale parameter 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 Rayleigh distribution.</para>
+ </refsect1>
+ <refsect1>
+ <title>See also</title>
+ <para><link linkend="gnumeric-function-R.DRAYLEIGH"><function>R.DRAYLEIGH</function></link>,
+ <link linkend="gnumeric-function-R.PRAYLEIGH"><function>R.PRAYLEIGH</function></link>.
+ </para>
+ </refsect1>
+ </refentry>
<refentry id="gnumeric-function-R.QSNORM">
<refmeta>
<refentrytitle>
diff --git a/plugins/fn-r/functions.c b/plugins/fn-r/functions.c
index dcc6540..793c0fc 100644
--- a/plugins/fn-r/functions.c
+++ b/plugins/fn-r/functions.c
@@ -1064,6 +1064,76 @@ gnumeric_r_qpois (GnmFuncEvalInfo *ei, GnmValue const * const *args)
/* ------------------------------------------------------------------------- */
+static GnmFuncHelp const help_r_drayleigh[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.DRAYLEIGH:probability density function of the Rayleigh 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_("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
Rayleigh distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.PRAYLEIGH,R.QRAYLEIGH" },
+ { GNM_FUNC_HELP_END }
+};
+
+static GnmValue *
+gnumeric_r_drayleigh (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;
+
+ return value_new_float (drayleigh (x, scale, give_log));
+}
+
+/* ------------------------------------------------------------------------- */
+
+static GnmFuncHelp const help_r_prayleigh[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.PRAYLEIGH:cumulative distribution function of the Rayleigh 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_("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
Rayleigh distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DRAYLEIGH,R.QRAYLEIGH" },
+ { GNM_FUNC_HELP_END }
+};
+
+static GnmValue *
+gnumeric_r_prayleigh (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;
+
+ return value_new_float (prayleigh (x, scale, lower_tail, log_p));
+}
+
+/* ------------------------------------------------------------------------- */
+
+static GnmFuncHelp const help_r_qrayleigh[] = {
+ { GNM_FUNC_HELP_NAME, F_("R.QRAYLEIGH:probability quantile function of the Rayleigh 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_("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 Rayleigh distribution.") },
+ { GNM_FUNC_HELP_SEEALSO, "R.DRAYLEIGH,R.PRAYLEIGH" },
+ { GNM_FUNC_HELP_END }
+};
+
+static GnmValue *
+gnumeric_r_qrayleigh (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;
+
+ return value_new_float (qrayleigh (p, scale, 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") },
{ GNM_FUNC_HELP_ARG, F_("x:observation") },
@@ -1732,6 +1802,27 @@ GnmFuncDescriptor const rstat_functions[] = {
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
},
{
+ "r.drayleigh",
+ "ff|b",
+ help_r_drayleigh,
+ gnumeric_r_drayleigh, NULL, NULL, NULL,
+ GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
+ },
+ {
+ "r.prayleigh",
+ "ff|bb",
+ help_r_prayleigh,
+ gnumeric_r_prayleigh, NULL, NULL, NULL,
+ GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
+ },
+ {
+ "r.qrayleigh",
+ "ff|bb",
+ help_r_qrayleigh,
+ gnumeric_r_qrayleigh, NULL, NULL, NULL,
+ GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE,
+ },
+ {
"r.dsnorm",
"ffff|b",
help_r_dsnorm,
diff --git a/plugins/fn-r/generate b/plugins/fn-r/generate
index 9c16db4..68d35cc 100644
--- a/plugins/fn-r/generate
+++ b/plugins/fn-r/generate
@@ -150,6 +150,11 @@ my %defaults;
({ 'mu' => "the location parameter of freedom $of",
'beta' => "the scale parameter of freedom $of",
@common })];
+
+ $funcs{'drayleigh'} = $funcs{'prayleigh'} = $funcs{'qrayleigh'} =
+ [\&distribution,
+ 'Rayleigh',
+ ({ @common })];
}
diff --git a/plugins/fn-r/plugin.xml.in b/plugins/fn-r/plugin.xml.in
index 5d26a3d..a5d2434 100644
--- a/plugins/fn-r/plugin.xml.in
+++ b/plugins/fn-r/plugin.xml.in
@@ -25,6 +25,7 @@
<function name="r.dnbinom"/>
<function name="r.dnorm"/>
<function name="r.dpois"/>
+ <function name="r.drayleigh"/>
<function name="r.dsnorm"/>
<function name="r.dst"/>
<function name="r.dt"/>
@@ -43,6 +44,7 @@
<function name="r.pnbinom"/>
<function name="r.pnorm"/>
<function name="r.ppois"/>
+ <function name="r.prayleigh"/>
<function name="r.psnorm"/>
<function name="r.pst"/>
<function name="r.pt"/>
@@ -62,6 +64,7 @@
<function name="r.qnbinom"/>
<function name="r.qnorm"/>
<function name="r.qpois"/>
+ <function name="r.qrayleigh"/>
<function name="r.qsnorm"/>
<function name="r.qst"/>
<function name="r.qt"/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]