Re: [R] CHAID in R
[[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] CHAID in R
On Sat, 16 Nov 2013, Preetam Pal wrote: Hi, I have a data set on credit rating for customers in a bank (Rating is 1 for defaulter, 0 = non-defaulter). I have 10 predictor variables (C1,C2,.,C10) . I want to build a CHAID Tree using R for classification. How do I do this? For your perusal, the data set is attached. Thanks in advance. The classical CHAID algorithm is implemented in a package on R-Forge: https://R-Forge.R-project.org/R/?group_id=343 However, this only supports categorical covariates and hence is not useful for your data. Alternatively, you might want to try out other packages for learning classification trees, e.g., partykit or rpart. See also http://CRAN.R-project.org/view=MachineLearning For your data you could do: ## read data with factor response d - read.table(text.txt, header = TRUE) d$Rating - factor(d$Rating) ## ctree library(partykit) ct - ctree(Rating ~ ., data = d) plot(ct) ## rpart library(rpart) rp - rpart(Rating ~ ., data = d, control = list(cp = 0.02)) plot(as.party(rp)) ## evtree library(evtree) set.seed(1) ev - evtree(Rating ~ ., data = d, maxdepth = 5) plot(ev) All methods agree that the decisive split is in C2 at about -110. And possibly you might be able to infer some more splits for the -110 subsample but there the methods disagree somewhat. Best, Z -Preetam -- Preetam Pal (+91)-9432212774 M-Stat 2nd Year, Room No. N-114 Statistics Division, C.V.Raman Hall Indian Statistical Institute, B.H.O.S. Kolkata. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] CHAID in R
On Fri, 28 Aug 2009, Arup wrote: Hi..I am trying to run CHAID in R..I have installed the sofyware Party and trying to use the function ctree() to carry out the analysis. but I am getting the following message Error in terms.default(formula, data = data) : no terms component Without a simple reproducible example (as the posting guide tells you) it's hard to say what went wrong for you. . I am having some Likert scale variable where I have variables like Overall satisfaction(Dependent Variable),Product quality, Brand image,Warranty(Independent variable) etc.. ctree() can handle this situation appropriately, see vignette(party, package = party) for more details and worked examples. Now can anyone tell me how to run CHAID in this case..what would be the formula? Thanks in Advance.. CTree is similar in spirit to CHAID but not the same. However, there is the CHAID package on R-Forge (as pointed out previously, thanks to Max). CTree is more flexible and can deal with more types of variables, e.g., it would be possible to use linear-by-linear type tests instead of plain Chi-squared tests for ordinal variables. hth, Z -- View this message in context: http://www.nabble.com/CHAID-in-R-tp25188573p25188573.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] CHAID in R
well, are you sure if party() can implement chaid? i doubt if chaid is being implemented in any R package. On Fri, Aug 28, 2009 at 7:50 AM, Arup arup.pramani...@gmail.com wrote: Hi..I am trying to run CHAID in R..I have installed the sofyware Party and trying to use the function ctree() to carry out the analysis. but I am getting the following message Error in terms.default(formula, data = data) : no terms component . I am having some Likert scale variable where I have variables like Overall satisfaction(Dependent Variable),Product quality, Brand image,Warranty(Independent variable) etc.. Now can anyone tell me how to run CHAID in this case..what would be the formula? Thanks in Advance.. -- View this message in context: http://www.nabble.com/CHAID-in-R-tp25188573p25188573.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- == WenSui Liu Blog : statcompute.spaces.live.com Tough Times Never Last. But Tough People Do. - Robert Schuller == [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] CHAID in R
well, are you sure if party() can implement chaid? i doubt if chaid is being implemented in any R package. https://r-forge.r-project.org/projects/chaid/ -- Max __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] CHAID in R
i couldn't find it on CRAN. On Fri, Aug 28, 2009 at 5:16 PM, Max Kuhn mxk...@gmail.com wrote: well, are you sure if party() can implement chaid? i doubt if chaid is being implemented in any R package. https://r-forge.r-project.org/projects/chaid/ -- Max -- == WenSui Liu Blog : statcompute.spaces.live.com Tough Times Never Last. But Tough People Do. - Robert Schuller == [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.