Test of Chi squared



I am Bnime beginner user.

I would like to do Test of dependancy called Chi2 between two variables but I don't find the corresponding Node in the Repository Nodes List.

What can I do?


Thanks for Help


I'd suggest you give the R snippet node a shot. It needs a little bit of tinkering to send the results back to KNIME in a nicely formatted way, but since it's re-usable in any future project it's usually worth the effort.

If you want I can send you a code sample for Kendall correlation which should be easily adjusted to Chi^2.



thanks for your reply.

I am looking to R node.

I am also interested in Kendall correlation sample code.


Best regards



OK, here you go (sorry, it's somewhat poorly formatted, but the WYSIWYS result was even worse):

library(Kendall) # import Kendall library
#P-value, returned by call Kendall()$sl, is assigned to variable p
p <- Kendall(R$"Filings", R$"Max..Obj..Rate")$sl
names(p) <- "p" #P-value is named "p"
#One-sided tau estimate calculated via cor.test Kendall implementation; sometimes this fails
tau<-cor.test(R$"Filings",R$"Max..Obj..Rate", method = "kendall", alternative = "less", continuity=TRUE)$estimate
#If it fails, it's either null() or na() - no idea which-, so run the Kendall()$tau instead
#which usually doesn't fail (but appears to have less significant digits, and does not name its output)
if(is.null(tau)) {
 names(tau) <- "tau"
if(is.na(tau)) {
 names(tau) <- "tau"
#return results to KNIME in nice format
R<-c(tau, p)