Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Significance score for pearson correlation

dramnane
5 - Atom

Hey all, 

 

I'm trying to get a significance score along with the pearson correlation I'm running. I couldn't find a way to do it. 

 

Any help is appreciated!

 

 

11 REPLIES 11
SeanL
Alteryx Alumni (Retired)

The p-values are given in the report output of the associtation analysis tool - for example:

aa_p_values.png

Thanks,

Sean Lopp
Client Services Representative
dramnane
5 - Atom

Hey Sean, Thanks for that. I did see the association analysis but it produces a report rather than something I can use within my workflow. (Unless there's a workaround) 

 

If I were to take your example, I want to create a table correlating one variable to multiple variables 

 

                  Trans      

Trans Correlation (pvalue)

MPG  Correlation (pvalue)

Cyl     Correlation (pvalue)

Disp   Correlation (pvalue)

 

 

And then use that table to summarize etc further. 

 

Think I could do that with the association analysis? or maybe somehow at least pull the results from the table

SeanL
Alteryx Alumni (Retired)

@NeilR has created a macro that parses the report output and brings the data back into lt Alteryx; the original post can be found at this link: http://community.alteryx.com/t5/Advanced-Analytics/Pulling-data-from-Linear-Regression-report-output...

 

I have attached the macro here for ease of use - hope it helps!

Thanks,

Sean Lopp
Client Services Representative
dramnane
5 - Atom

This is awesome! Thank you!

Ehatie
8 - Asteroid

Hello SeanL,

 

I tried using both the R Tool and the suggested macro to extract objects from the Association Analysis tool. Tried several R syntaxes in the R Tool but all fail to identify the input object as a table, same for the macro on the link you posted. I think this is due to the fact that when this macro or the R tool are used they are based on inputs from tools designed to operate based on the previous R object inside the macro, not sure, if you can clarify I would be gratefull.

 

Thanks!

SeanL
Alteryx Alumni (Retired)

If I am understanding your question correctly there are two things going on:

 

1) Serialized R Objects

 

The R Tool reads in Alteryx data  as either a data frame or a list. Usually the data is numeric, text, factors, etc; but we can also pass serialized R objects. For example, this is how we pass model objects from the linear regression tool to the score tool or the stepwise tool. 

 

For example:

We could create a model in the first R Tool and write it out to the Alteryx data stream (Typically, we write out model obects as a record with two columns: Name and Object):

 

# Create a list with the model object and its name and write it out via
# the third output
model.name <- validName('%Question.model.name%')
the.obj <- vector(mode="list", length=2)
the.obj[[1]] <- c(model.name)
the.obj[[2]] <- list(the.model)
names(the.obj) <- c("Name", "Object")
write.Alteryx(the.obj, nOutput = 3)

 mod_obj.png

 

 

And then in another R Tool we could read in the model object:

 

# Read in the model object from the first input stream
mod.obj <- read.Alteryx("#1")
orig.model <- unserializeObject(as.character(mod.obj$Object))

 

2) Report Objects

 

 The reports generated by the predictive tools are the same as any of the reports generated using the reporting tools. The macro created by @NeilR expects a report as an input, which will be a record that looks like this:

 

report_obj.png

 

Let me know if this helps answer your question!

 

Thanks,

Sean Lopp
Client Services Representative
Ehatie
8 - Asteroid

SeanL,

 

You got it right, there are two things going on, cause I tried doing this 2 ways. So to clarify:

 

1) Serialized R Objects

The reason I'm trying to do this, is because the output from the tool is in fact a layout, however since the resulting tables are too big, the tables are broken into several tables, making it hell to understand the output of the macro you posted, or even use it (I guess worst case scenario, we will go that way). So hence the reason why R Objects are been tried.

 

However since the output is a layout, I was wondering how to parse the layout into a report, that can be later translated into a data.frame that can be used to extract specific rows or columns from said data.frame.

 

2) Report Objects

This method works, however the whole problem is specified before, since the table is too big when parsed out, it is broken into several tables... and it's not ideal, specially if we are trying to build a macro based on this whole process.

 

Thanks for any ideas!

 

RodL
Alteryx Alumni (Retired)

The thing is that the macro from @NeilR is expecting a field called "Report", while the Association Analysis Tool has a field called "Layout" coming through. 

In looking at the macro, it assumes that the 'report' is actually a series of tables (which comes out of the Linear Regression tool, for example), whereas the output from the AA tool appears to have the output as an already-grouped layout.

I did get it to work for the AA tool by merely putting a Select tool after the AA tool and renaming "Layout" to "Report", but the data is a bit jumbled since it is really a combination of 3 tables...but with some parsing of that output, it might get you what you need.

Ehatie
8 - Asteroid

RodL,

 

Exactly, that is the issue, however this solution is less than ideal, since the whole point is to automatize the final product.

 

Cheers!

Labels