Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

How do you extract the distribution parameters from the ditribution analysis tool?

User514
7 - Meteor

Hi, 

 

I'm running a distribution analysis on a variable and I would need to extract the mean, and std dev of it's relevan normal, lognormal, gamma and weibull distribution. As well as, the goodness of fit statistics.

 

Thank you!

5 REPLIES 5
apathetichell
18 - Pollux

 

Do you want the good news or the bad news? The good news is that it "should" be doable.... I'd save my distribution analysis with a new name first and then start experimenting - some of it as you can see is fairly straightforward adding browses and then turning them into macro ouputs... For the real good stuff - I think you'll need to go into the R code shown below and make some edits to what and how things are being output. I'll try to take a quick look at it tonight.

2021-06-03 (1).png

2021-06-03 (2).png

2021-06-03 (3).png

2021-06-03 (4).png

2021-06-03 (5).png

2021-06-03.png

      

 

 

apathetichell
18 - Pollux

2021-06-03 (8).png

2021-06-03 (9).png

2021-06-03 (10).png

So there are only 5 output anchors from the R tool. You can go in an bump something else but here's my current solution...

 

Go into the R in your distribution analysis macro - find the section pictured above. Write the variable stats to a .csv file of your choosing. Bring it into your workflow later. See as pictured. Note - you can bump something else and have it write directly to an Alteryx/R out port. I'd recommmend detaching the report section that follows, adding a macro output instead and not doing this to any anchors which actually continue in the macro.

User514
7 - Meteor

I've just added macro outputs after each of the R outputs (Except the quant one) and the code runs fine with the normal distribution analysis but with the one with the macro outputs I get this error: 

Error: Distribution Analysis (20): Tool #9: Error in stats::optim(x = c(40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, :

 

The original distribution analysis runs fine with the same data and outputs a report

apathetichell
18 - Pollux

Did you follow my write.csv instructions in my second post? In the above post did you change anything inside of R or just hook up new browses and change to macro outputs? If it's the later -  I do not see how that can be generating different results or an error. So first run the macro as a general workflow. Close it. save it. then run in your workflow and see if it's still generating the error.

 

If it's the former - and you changed underlying R or workflow - I'd recommend implementing the browse in a different section. This is a bit of a trial and error process as again - there are only 5 outputs and Alteryx doesn't provide this data as a standalone. I do think the .csv export is probably the way to go since it makes the most minimal changes to the original tool/macro.

User514
7 - Meteor

I added outputs at the end of the R tool again and for some reason it worked this time!

 

Thank you for your help!

Labels