<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Custom external function for normal distribution in Other Usage</title>
    <link>https://community.splunk.com/t5/Other-Usage/How-to-customize-external-function-for-normal-distribution/m-p/639048#M116</link>
    <description>&lt;P&gt;As an aside, I don't know of any generally available statistical package for Splunk that contains generating commands for commonly used distributions. I write macros as needed. For example (with no guarantee of correctness!):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;# macros.conf

[expinv(2)]
args = p,b
definition = "exact(-(1/$b$)*ln(1-$p$))"
iseval = 1

[lognorminv(3)]
args = p,u,s
definition = "exact(exp($u$ + $s$ * if($p$ &amp;lt; 0.5, -1 * (sqrt(-2.0 * ln($p$)) - ((0.010328 * sqrt(-2.0 * ln($p$)) + 0.802853) * sqrt(-2.0 * ln($p$)) + 2.515517) / (((0.001308 * sqrt(-2.0 * ln($p$)) + 0.189269) * sqrt(-2.0 * ln($p$)) + 1.432788) * sqrt(-2.0 * ln($p$)) + 1.0)), (sqrt(-2.0 * ln(1 - $p$)) - ((0.010328 * sqrt(-2.0 * ln(1 - $p$)) + 0.802853) * sqrt(-2.0 * ln(1 - $p$)) + 2.515517) / (((0.001308 * sqrt(-2.0 * ln(1 - $p$)) + 0.189269) * sqrt(-2.0 * ln(1 - $p$)) + 1.432788) * sqrt(-2.0 * ln(1 - $p$)) + 1.0)))))"
iseval = 1

[weibullinv(3)]
args = p,a,b
definition = "exact($a$*pow(-ln(1-$p$),1/$b$))"
iseval = 1&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Apr 2023 16:31:29 GMT</pubDate>
    <dc:creator>tscroggins</dc:creator>
    <dc:date>2023-04-06T16:31:29Z</dc:date>
    <item>
      <title>How to customize external function for normal distribution?</title>
      <link>https://community.splunk.com/t5/Other-Usage/How-to-customize-external-function-for-normal-distribution/m-p/638992#M114</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am doing statistical analysis on a number of indexes for time series forecasting.&lt;/P&gt;
&lt;P&gt;On reading the following article, its gives a sample SPL query as follows:&lt;BR /&gt;&lt;SPAN&gt;| gentimes start=”01/01/2018" increment=1h&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| eval _time=starttime, loc=0, scale=20&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| normal loc=loc scale=scale &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| streamstats count as cnt&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| eval gen_normal = gen_normal + cnt&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| table _time, gen_normal&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| rename gen_normal as “Non-stationary time series (trend)”&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;[Article is this: ]&lt;A href="https://towardsdatascience.com/time-series-forecasting-with-splunk-part-i-intro-kalman-filter-46e4bff1abff" target="_blank" rel="noopener"&gt;https://towardsdatascience.com/time-series-forecasting-with-splunk-part-i-intro-kalman-filter-46e4bff1abff&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;The "normal" command is a cutom external command and I wanted to ask how and where I can get such statistical functions into Splunk?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Many thanks as always,&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 19:12:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Other-Usage/How-to-customize-external-function-for-normal-distribution/m-p/638992#M114</guid>
      <dc:creator>POR160893</dc:creator>
      <dc:date>2023-04-06T19:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: Custom external function for normal distribution</title>
      <link>https://community.splunk.com/t5/Other-Usage/How-to-customize-external-function-for-normal-distribution/m-p/639047#M115</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I read the same article several years ago and created a macros similar to Excel's NORMINV and RAND just for this purpose:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;# macros.conf

[norminv(3)]
args = p,u,s
definition = "exact($u$ + $s$ * if($p$ &amp;lt; 0.5, -1 * (sqrt(-2.0 * ln($p$)) - ((0.010328 * sqrt(-2.0 * ln($p$)) + 0.802853) * sqrt(-2.0 * ln($p$)) + 2.515517) / (((0.001308 * sqrt(-2.0 * ln($p$)) + 0.189269) * sqrt(-2.0 * ln($p$)) + 1.432788) * sqrt(-2.0 * ln($p$)) + 1.0)), (sqrt(-2.0 * ln(1 - $p$)) - ((0.010328 * sqrt(-2.0 * ln(1 - $p$)) + 0.802853) * sqrt(-2.0 * ln(1 - $p$)) + 2.515517) / (((0.001308 * sqrt(-2.0 * ln(1 - $p$)) + 0.189269) * sqrt(-2.0 * ln(1 - $p$)) + 1.432788) * sqrt(-2.0 * ln(1 - $p$)) + 1.0))))"
iseval = 1

[rand]
definition = "random()/2147483647"
iseval = 1&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There's further discussion of the macro implementation in a previous post:&amp;nbsp;&lt;A href="https://community.splunk.com/t5/Splunk-Search/Outlier-Dip-Trough-Detection/m-p/550122/highlight/true#M156111" target="_self"&gt;https://community.splunk.com/t5/Splunk-Search/Outlier-Dip-Trough-Detection/m-p/550122/highlight/true#M156111&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To recreate the toy example from the original article:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;| gentimes start="01/01/2018" end="01/22/2018" increment=1h 
| eval _time=starttime, loc=0, scale=20 
| eval gen_normal=`norminv("`rand()`", loc, scale)` 
| streamstats count as cnt 
| eval gen_normal=gen_normal+cnt
| table _time gen_normal
| rename gen_normal as "Non-stationary time series (trend)"
| predict algorithm=LLT future_timespan=200 "Non-stationary time series (trend)"&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 06 Apr 2023 16:55:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Other-Usage/How-to-customize-external-function-for-normal-distribution/m-p/639047#M115</guid>
      <dc:creator>tscroggins</dc:creator>
      <dc:date>2023-04-06T16:55:49Z</dc:date>
    </item>
    <item>
      <title>Re: Custom external function for normal distribution</title>
      <link>https://community.splunk.com/t5/Other-Usage/How-to-customize-external-function-for-normal-distribution/m-p/639048#M116</link>
      <description>&lt;P&gt;As an aside, I don't know of any generally available statistical package for Splunk that contains generating commands for commonly used distributions. I write macros as needed. For example (with no guarantee of correctness!):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;# macros.conf

[expinv(2)]
args = p,b
definition = "exact(-(1/$b$)*ln(1-$p$))"
iseval = 1

[lognorminv(3)]
args = p,u,s
definition = "exact(exp($u$ + $s$ * if($p$ &amp;lt; 0.5, -1 * (sqrt(-2.0 * ln($p$)) - ((0.010328 * sqrt(-2.0 * ln($p$)) + 0.802853) * sqrt(-2.0 * ln($p$)) + 2.515517) / (((0.001308 * sqrt(-2.0 * ln($p$)) + 0.189269) * sqrt(-2.0 * ln($p$)) + 1.432788) * sqrt(-2.0 * ln($p$)) + 1.0)), (sqrt(-2.0 * ln(1 - $p$)) - ((0.010328 * sqrt(-2.0 * ln(1 - $p$)) + 0.802853) * sqrt(-2.0 * ln(1 - $p$)) + 2.515517) / (((0.001308 * sqrt(-2.0 * ln(1 - $p$)) + 0.189269) * sqrt(-2.0 * ln(1 - $p$)) + 1.432788) * sqrt(-2.0 * ln(1 - $p$)) + 1.0)))))"
iseval = 1

[weibullinv(3)]
args = p,a,b
definition = "exact($a$*pow(-ln(1-$p$),1/$b$))"
iseval = 1&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 16:31:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Other-Usage/How-to-customize-external-function-for-normal-distribution/m-p/639048#M116</guid>
      <dc:creator>tscroggins</dc:creator>
      <dc:date>2023-04-06T16:31:29Z</dc:date>
    </item>
    <item>
      <title>Re: Custom external function for normal distribution</title>
      <link>https://community.splunk.com/t5/Other-Usage/How-to-customize-external-function-for-normal-distribution/m-p/639051#M117</link>
      <description>&lt;P&gt;Perfect! Thank you so much for this information.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 17:10:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Other-Usage/How-to-customize-external-function-for-normal-distribution/m-p/639051#M117</guid>
      <dc:creator>POR160893</dc:creator>
      <dc:date>2023-04-06T17:10:07Z</dc:date>
    </item>
  </channel>
</rss>

