Splunk Search

Fisher test using R for data in Splunk

melonman
Motivator

Hi

I want to perform fisher test on data in Splunk. The table passed to R looks like this:

index=summary stats=conversion_rate 
| table _time purchase view
| fields - _time

purchase view
-------- ----
     747 2463
     537 2545

I want to to the fisher.t(input), to compare 1st line and 2nd line, and get p-value as a result.

but I got stuck at a very basic step, creating matrix from data passed from Splunk.
Could anyone give me a sample for this?

Tags (1)
0 Karma
1 Solution

clongo01
Engager

Hello. You will have to format your data in a table at then end of your search. The R app will automatically assign that table as the input to your R command. It would look something like this.

index=summary stats=conversion_rate | table purchase view | r "
result = fisher.test(input)
output = data.frame(Result=c(result))
"

Your output will be two columns because it is capturing the confidence bounds as well and the p-value. If you want to return just the p-value from the fisher test change the last line to be output = data.frame(Result=c(result$p.value)).

Hope this helps!

View solution in original post

clongo01
Engager

Hello. You will have to format your data in a table at then end of your search. The R app will automatically assign that table as the input to your R command. It would look something like this.

index=summary stats=conversion_rate | table purchase view | r "
result = fisher.test(input)
output = data.frame(Result=c(result))
"

Your output will be two columns because it is capturing the confidence bounds as well and the p-value. If you want to return just the p-value from the fisher test change the last line to be output = data.frame(Result=c(result$p.value)).

Hope this helps!

Get Updates on the Splunk Community!

New Year, New Changes for Splunk Certifications

As we embrace a new year, we’re making a small but important update to the Splunk Certification ...

[Puzzles] Solve, Learn, Repeat: Unmerging HTML Tables

[Puzzles] Solve, Learn, Repeat: Unmerging HTML TablesFor a previous puzzle, I needed some sample data, and ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...