R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-pc-linux-gnu (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list(293403 + ,111 + ,74 + ,91256 + ,123 + ,119 + ,277108 + ,70 + ,69 + ,86997 + ,64 + ,64 + ,264020 + ,76 + ,76 + ,55709 + ,101 + ,100 + ,260646 + ,109 + ,60 + ,75741 + ,104 + ,104 + ,246100 + ,81 + ,89 + ,92046 + ,135 + ,135 + ,244051 + ,67 + ,111 + ,84607 + ,130 + ,124 + ,241329 + ,54 + ,57 + ,73586 + ,93 + ,93 + ,234730 + ,106 + ,116 + ,162365 + ,159 + ,155 + ,234509 + ,125 + ,122 + ,70817 + ,125 + ,120 + ,233482 + ,68 + ,90 + ,59635 + ,81 + ,78 + ,233406 + ,96 + ,85 + ,109104 + ,117 + ,117 + ,228548 + ,106 + ,65 + ,120087 + ,205 + ,198 + ,223914 + ,104 + ,89 + ,72631 + ,115 + ,110 + ,223696 + ,88 + ,82 + ,104911 + ,115 + ,114 + ,223004 + ,87 + ,84 + ,85224 + ,147 + ,137 + ,213765 + ,84 + ,56 + ,58233 + ,150 + ,150 + ,210554 + ,81 + ,73 + ,117986 + ,126 + ,124 + ,202204 + ,44 + ,79 + ,67271 + ,61 + ,56 + ,199512 + ,75 + ,59 + ,55071 + ,82 + ,82 + ,195304 + ,93 + ,47 + ,114425 + ,152 + ,145 + ,191467 + ,76 + ,75 + ,79194 + ,109 + ,104 + ,191381 + ,87 + ,71 + ,101653 + ,210 + ,212 + ,191276 + ,112 + ,90 + ,81493 + ,151 + ,141 + ,190410 + ,84 + ,107 + ,64664 + ,96 + ,94 + ,188967 + ,86 + ,75 + ,63717 + ,98 + ,94 + ,188780 + ,98 + ,85 + ,72369 + ,98 + ,98 + ,185139 + ,121 + ,83 + ,86281 + ,128 + ,126 + ,185039 + ,94 + ,73 + ,63958 + ,100 + ,98 + ,184217 + ,69 + ,45 + ,73795 + ,74 + ,74 + ,181853 + ,87 + ,93 + ,96750 + ,92 + ,91 + ,181379 + ,92 + ,123 + ,83038 + ,101 + ,96 + ,181344 + ,75 + ,114 + ,65196 + ,109 + ,108 + ,179562 + ,76 + ,89 + ,62932 + ,116 + ,116 + ,178863 + ,86 + ,78 + ,57637 + ,88 + ,87 + ,178140 + ,56 + ,91 + ,70111 + ,83 + ,78 + ,176789 + ,115 + ,66 + ,123328 + ,149 + ,149 + ,176460 + ,97 + ,55 + ,38885 + ,122 + ,122 + ,175877 + ,95 + ,81 + ,54628 + ,96 + ,95 + ,175568 + ,106 + ,80 + ,74482 + ,105 + ,102 + ,174107 + ,49 + ,71 + ,76168 + ,95 + ,91 + ,173587 + ,70 + ,70 + ,71170 + ,97 + ,95 + ,173260 + ,41 + ,78 + ,37238 + ,16 + ,15 + ,172684 + ,87 + ,112 + ,101773 + ,103 + ,102 + ,167845 + ,105 + ,77 + ,103646 + ,145 + ,145 + ,167131 + ,71 + ,69 + ,37048 + ,56 + ,56 + ,167105 + ,56 + ,32 + ,85903 + ,75 + ,71 + ,166790 + ,49 + ,59 + ,43460 + ,46 + ,46 + ,164767 + ,51 + ,87 + ,90257 + ,81 + ,80 + ,162810 + ,49 + ,76 + ,70027 + ,83 + ,80 + ,162336 + ,111 + ,84 + ,111436 + ,153 + ,151 + ,161678 + ,75 + ,59 + ,65911 + ,87 + ,83 + ,158980 + ,84 + ,75 + ,105965 + ,123 + ,122 + ,157250 + ,84 + ,106 + ,61704 + ,104 + ,104 + ,156833 + ,79 + ,73 + ,48204 + ,85 + ,85 + ,155383 + ,83 + ,75 + ,60029 + ,99 + ,99 + ,154991 + ,63 + ,87 + ,52295 + ,99 + ,98 + ,154730 + ,78 + ,82 + ,82204 + ,98 + ,98 + ,151503 + ,93 + ,83 + ,56316 + ,99 + ,98 + ,146455 + ,65 + ,68 + ,95556 + ,127 + ,128 + ,143937 + ,98 + ,66 + ,78792 + ,140 + ,139 + ,142339 + ,75 + ,67 + ,125410 + ,144 + ,142 + ,142146 + ,108 + ,88 + ,76013 + ,152 + ,139 + ,142141 + ,73 + ,87 + ,91939 + ,61 + ,61 + ,142069 + ,66 + ,88 + ,57231 + ,83 + ,82 + ,141933 + ,90 + ,75 + ,51370 + ,100 + ,99 + ,139350 + ,70 + ,79 + ,99518 + ,89 + ,88 + ,139144 + ,57 + ,76 + ,56530 + ,75 + ,75 + ,137793 + ,70 + ,78 + ,56699 + ,77 + ,77 + ,136911 + ,95 + ,86 + ,74349 + ,117 + ,103 + ,136548 + ,89 + ,62 + ,83042 + ,158 + ,157 + ,135171 + ,80 + ,61 + ,71181 + ,82 + ,82 + ,134043 + ,54 + ,69 + ,55901 + ,57 + ,54 + ,131876 + ,27 + ,83 + ,38417 + ,36 + ,36 + ,131122 + ,56 + ,50 + ,65724 + ,89 + ,89 + ,130539 + ,60 + ,47 + ,48821 + ,66 + ,66 + ,130533 + ,64 + ,76 + ,85168 + ,78 + ,79 + ,130232 + ,102 + ,83 + ,55027 + ,107 + ,105 + ,129100 + ,38 + ,60 + ,73713 + ,87 + ,87 + ,128655 + ,75 + ,70 + ,79774 + ,111 + ,108 + ,128066 + ,42 + ,48 + ,42564 + ,80 + ,80 + ,127619 + ,49 + ,50 + ,36311 + ,52 + ,50 + ,127324 + ,79 + ,87 + ,56733 + ,104 + ,101 + ,126683 + ,71 + ,123 + ,63262 + ,72 + ,71 + ,126681 + ,39 + ,90 + ,94137 + ,67 + ,66 + ,125971 + ,61 + ,45 + ,38439 + ,71 + ,71 + ,125366 + ,69 + ,22 + ,34497 + ,68 + ,68 + ,122433 + ,51 + ,91 + ,58425 + ,66 + ,66 + ,121135 + ,50 + ,51 + ,42051 + ,69 + ,68 + ,119291 + ,83 + ,38 + ,64102 + ,123 + ,120 + ,118958 + ,52 + ,68 + ,54506 + ,61 + ,58 + ,118807 + ,56 + ,81 + ,55827 + ,70 + ,70 + ,118372 + ,72 + ,35 + ,66477 + ,142 + ,145 + ,116900 + ,42 + ,36 + ,28340 + ,58 + ,57 + ,116775 + ,30 + ,83 + ,73087 + ,124 + ,112 + ,115199 + ,84 + ,54 + ,51360 + ,87 + ,87 + ,114928 + ,44 + ,72 + ,53009 + ,96 + ,91 + ,114397 + ,70 + ,65 + ,55064 + ,87 + ,85 + ,113337 + ,58 + ,37 + ,63016 + ,68 + ,68 + ,111664 + ,55 + ,59 + ,38650 + ,98 + ,98 + ,108715 + ,64 + ,35 + ,40671 + ,80 + ,78 + ,107342 + ,77 + ,53 + ,82043 + ,116 + ,111 + ,107335 + ,48 + ,61 + ,49319 + ,65 + ,64 + ,106539 + ,36 + ,68 + ,77411 + ,63 + ,63 + ,105615 + ,57 + ,70 + ,202316 + ,51 + ,48 + ,105410 + ,62 + ,72 + ,89041 + ,88 + ,86 + ,105324 + ,42 + ,71 + ,26982 + ,46 + ,46 + ,103012 + ,30 + ,37 + ,29467 + ,28 + ,26 + ,102531 + ,46 + ,63 + ,40001 + ,64 + ,63 + ,101324 + ,81 + ,104 + ,70780 + ,103 + ,100 + ,100885 + ,39 + ,29 + ,49288 + ,49 + ,48 + ,100672 + ,38 + ,69 + ,50466 + ,55 + ,55 + ,99946 + ,106 + ,80 + ,99501 + ,125 + ,119 + ,99768 + ,24 + ,62 + ,15430 + ,27 + ,27 + ,99246 + ,27 + ,63 + ,37361 + ,52 + ,51 + ,98599 + ,48 + ,55 + ,36252 + ,46 + ,44 + ,98030 + ,30 + ,41 + ,31701 + ,35 + ,35 + ,94763 + ,94 + ,75 + ,56979 + ,100 + ,99 + ,93340 + ,41 + ,63 + ,43448 + ,60 + ,60 + ,93125 + ,30 + ,29 + ,50838 + ,37 + ,36 + ,91185 + ,57 + ,66 + ,21067 + ,67 + ,67 + ,90961 + ,42 + ,78 + ,63785 + ,49 + ,49 + ,90938 + ,40 + ,51 + ,37137 + ,43 + ,42 + ,89318 + ,75 + ,78 + ,44970 + ,82 + ,81 + ,88817 + ,70 + ,60 + ,46765 + ,56 + ,56 + ,84944 + ,54 + ,72 + ,54565 + ,90 + ,89 + ,84572 + ,43 + ,82 + ,72571 + ,84 + ,84 + ,84256 + ,97 + ,58 + ,59155 + ,76 + ,75 + ,80953 + ,49 + ,27 + ,56622 + ,59 + ,58 + ,78800 + ,20 + ,66 + ,33032 + ,21 + ,21 + ,78776 + ,30 + ,18 + ,26998 + ,34 + ,34 + ,75812 + ,28 + ,57 + ,35606 + ,30 + ,30 + ,75426 + ,3 + ,19 + ,47261 + ,36 + ,33 + ,74398 + ,41 + ,30 + ,31258 + ,51 + ,51 + ,74112 + ,28 + ,54 + ,174949 + ,52 + ,52 + ,73567 + ,37 + ,31 + ,23238 + ,18 + ,18 + ,69471 + ,22 + ,63 + ,22618 + ,26 + ,25 + ,68948 + ,31 + ,47 + ,35838 + ,45 + ,43 + ,67746 + ,18 + ,35 + ,62832 + ,58 + ,56 + ,67507 + ,101 + ,112 + ,78956 + ,49 + ,49 + ,65029 + ,21 + ,61 + ,32551 + ,21 + ,21 + ,64320 + ,16 + ,56 + ,62147 + ,24 + ,23 + ,61857 + ,23 + ,30 + ,25162 + ,31 + ,28 + ,61499 + ,28 + ,75 + ,36990 + ,15 + ,15 + ,50999 + ,2 + ,66 + ,63989 + ,8 + ,8 + ,46660 + ,12 + ,13 + ,6179 + ,13 + ,13 + ,43287 + ,13 + ,64 + ,43750 + ,49 + ,49 + ,38214 + ,16 + ,21 + ,8773 + ,16 + ,16 + ,35523 + ,0 + ,53 + ,52491 + ,33 + ,33 + ,32750 + ,1 + ,22 + ,22807 + ,5 + ,5 + ,31414 + ,18 + ,9 + ,14116 + ,39 + ,39 + ,24188 + ,8 + ,7 + ,5950 + ,7 + ,7 + ,22938 + ,12 + ,0 + ,1168 + ,11 + ,11 + ,21054 + ,4 + ,0 + ,855 + ,4 + ,4 + ,17547 + ,0 + ,4 + ,3926 + ,3 + ,3 + ,14688 + ,4 + ,0 + ,6023 + ,5 + ,5 + ,7199 + ,7 + ,0 + ,1644 + ,6 + ,6 + ,969 + ,0 + ,0 + ,0 + ,0 + ,0 + ,455 + ,0 + ,0 + ,0 + ,0 + ,0 + ,203 + ,0 + ,0 + ,0 + ,0 + ,0 + ,98 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0) + ,dim=c(6 + ,164) + ,dimnames=list(c('y' + ,'x1' + ,'x2' + ,'x3' + ,'x4' + ,'x5') + ,1:164)) > y <- array(NA,dim=c(6,164),dimnames=list(c('y','x1','x2','x3','x4','x5'),1:164)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par4 = 'yes' > par3 = '2' > par2 = 'quantiles' > par1 = '1' > library(party) Loading required package: survival Loading required package: splines Loading required package: grid Loading required package: modeltools Loading required package: stats4 Loading required package: coin Loading required package: mvtnorm Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from 'package:base': as.Date, as.Date.numeric Loading required package: sandwich Loading required package: strucchange Loading required package: vcd Loading required package: MASS Loading required package: colorspace > library(Hmisc) Hmisc library by Frank E Harrell Jr Type library(help='Hmisc'), ?Overview, or ?Hmisc.Overview') to see overall documentation. NOTE:Hmisc no longer redefines [.factor to drop unused levels when subsetting. To get the old behavior of Hmisc type dropUnusedLevels(). Attaching package: 'Hmisc' The following object(s) are masked from 'package:survival': untangle.specials The following object(s) are masked from 'package:base': format.pval, round.POSIXt, trunc.POSIXt, units > par1 <- as.numeric(par1) > par3 <- as.numeric(par3) > x <- data.frame(t(y)) > is.data.frame(x) [1] TRUE > x <- x[!is.na(x[,par1]),] > k <- length(x[1,]) > n <- length(x[,1]) > colnames(x)[par1] [1] "y" > x[,par1] [1] 293403 277108 264020 260646 246100 244051 241329 234730 234509 233482 [11] 233406 228548 223914 223696 223004 213765 210554 202204 199512 195304 [21] 191467 191381 191276 190410 188967 188780 185139 185039 184217 181853 [31] 181379 181344 179562 178863 178140 176789 176460 175877 175568 174107 [41] 173587 173260 172684 167845 167131 167105 166790 164767 162810 162336 [51] 161678 158980 157250 156833 155383 154991 154730 151503 146455 143937 [61] 142339 142146 142141 142069 141933 139350 139144 137793 136911 136548 [71] 135171 134043 131876 131122 130539 130533 130232 129100 128655 128066 [81] 127619 127324 126683 126681 125971 125366 122433 121135 119291 118958 [91] 118807 118372 116900 116775 115199 114928 114397 113337 111664 108715 [101] 107342 107335 106539 105615 105410 105324 103012 102531 101324 100885 [111] 100672 99946 99768 99246 98599 98030 94763 93340 93125 91185 [121] 90961 90938 89318 88817 84944 84572 84256 80953 78800 78776 [131] 75812 75426 74398 74112 73567 69471 68948 67746 67507 65029 [141] 64320 61857 61499 50999 46660 43287 38214 35523 32750 31414 [151] 24188 22938 21054 17547 14688 7199 969 455 203 98 [161] 0 0 0 0 > if (par2 == 'kmeans') { + cl <- kmeans(x[,par1], par3) + print(cl) + clm <- matrix(cbind(cl$centers,1:par3),ncol=2) + clm <- clm[sort.list(clm[,1]),] + for (i in 1:par3) { + cl$cluster[cl$cluster==clm[i,2]] <- paste('C',i,sep='') + } + cl$cluster <- as.factor(cl$cluster) + print(cl$cluster) + x[,par1] <- cl$cluster + } > if (par2 == 'quantiles') { + x[,par1] <- cut2(x[,par1],g=par3) + } > if (par2 == 'hclust') { + hc <- hclust(dist(x[,par1])^2, 'cen') + print(hc) + memb <- cutree(hc, k = par3) + dum <- c(mean(x[memb==1,par1])) + for (i in 2:par3) { + dum <- c(dum, mean(x[memb==i,par1])) + } + hcm <- matrix(cbind(dum,1:par3),ncol=2) + hcm <- hcm[sort.list(hcm[,1]),] + for (i in 1:par3) { + memb[memb==hcm[i,2]] <- paste('C',i,sep='') + } + memb <- as.factor(memb) + print(memb) + x[,par1] <- memb + } > if (par2=='equal') { + ed <- cut(as.numeric(x[,par1]),par3,labels=paste('C',1:par3,sep='')) + x[,par1] <- as.factor(ed) + } > table(x[,par1]) [ 0,127324) [127324,293403] 82 82 > colnames(x) [1] "y" "x1" "x2" "x3" "x4" "x5" > colnames(x)[par1] [1] "y" > x[,par1] [1] [127324,293403] [127324,293403] [127324,293403] [127324,293403] [5] [127324,293403] [127324,293403] [127324,293403] [127324,293403] [9] [127324,293403] [127324,293403] [127324,293403] [127324,293403] [13] [127324,293403] [127324,293403] [127324,293403] [127324,293403] [17] [127324,293403] [127324,293403] [127324,293403] [127324,293403] [21] [127324,293403] [127324,293403] [127324,293403] [127324,293403] [25] [127324,293403] [127324,293403] [127324,293403] [127324,293403] [29] [127324,293403] [127324,293403] [127324,293403] [127324,293403] [33] [127324,293403] [127324,293403] [127324,293403] [127324,293403] [37] [127324,293403] [127324,293403] [127324,293403] [127324,293403] [41] [127324,293403] [127324,293403] [127324,293403] [127324,293403] [45] [127324,293403] [127324,293403] [127324,293403] [127324,293403] [49] [127324,293403] [127324,293403] [127324,293403] [127324,293403] [53] [127324,293403] [127324,293403] [127324,293403] [127324,293403] [57] [127324,293403] [127324,293403] [127324,293403] [127324,293403] [61] [127324,293403] [127324,293403] [127324,293403] [127324,293403] [65] [127324,293403] [127324,293403] [127324,293403] [127324,293403] [69] [127324,293403] [127324,293403] [127324,293403] [127324,293403] [73] [127324,293403] [127324,293403] [127324,293403] [127324,293403] [77] [127324,293403] [127324,293403] [127324,293403] [127324,293403] [81] [127324,293403] [127324,293403] [ 0,127324) [ 0,127324) [85] [ 0,127324) [ 0,127324) [ 0,127324) [ 0,127324) [89] [ 0,127324) [ 0,127324) [ 0,127324) [ 0,127324) [93] [ 0,127324) [ 0,127324) [ 0,127324) [ 0,127324) [97] [ 0,127324) [ 0,127324) [ 0,127324) [ 0,127324) [101] [ 0,127324) [ 0,127324) [ 0,127324) [ 0,127324) [105] [ 0,127324) [ 0,127324) [ 0,127324) [ 0,127324) [109] [ 0,127324) [ 0,127324) [ 0,127324) [ 0,127324) [113] [ 0,127324) [ 0,127324) [ 0,127324) [ 0,127324) [117] [ 0,127324) [ 0,127324) [ 0,127324) [ 0,127324) [121] [ 0,127324) [ 0,127324) [ 0,127324) [ 0,127324) [125] [ 0,127324) [ 0,127324) [ 0,127324) [ 0,127324) [129] [ 0,127324) [ 0,127324) [ 0,127324) [ 0,127324) [133] [ 0,127324) [ 0,127324) [ 0,127324) [ 0,127324) [137] [ 0,127324) [ 0,127324) [ 0,127324) [ 0,127324) [141] [ 0,127324) [ 0,127324) [ 0,127324) [ 0,127324) [145] [ 0,127324) [ 0,127324) [ 0,127324) [ 0,127324) [149] [ 0,127324) [ 0,127324) [ 0,127324) [ 0,127324) [153] [ 0,127324) [ 0,127324) [ 0,127324) [ 0,127324) [157] [ 0,127324) [ 0,127324) [ 0,127324) [ 0,127324) [161] [ 0,127324) [ 0,127324) [ 0,127324) [ 0,127324) Levels: [ 0,127324) [127324,293403] > if (par2 == 'none') { + m <- ctree(as.formula(paste(colnames(x)[par1],' ~ .',sep='')),data = x) + } > > #Note: the /var/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/rcomp/createtable") > > if (par2 != 'none') { + m <- ctree(as.formula(paste('as.factor(',colnames(x)[par1],') ~ .',sep='')),data = x) + if (par4=='yes') { + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'10-Fold Cross Validation',3+2*par3,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'',1,TRUE) + a<-table.element(a,'Prediction (training)',par3+1,TRUE) + a<-table.element(a,'Prediction (testing)',par3+1,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Actual',1,TRUE) + for (jjj in 1:par3) a<-table.element(a,paste('C',jjj,sep=''),1,TRUE) + a<-table.element(a,'CV',1,TRUE) + for (jjj in 1:par3) a<-table.element(a,paste('C',jjj,sep=''),1,TRUE) + a<-table.element(a,'CV',1,TRUE) + a<-table.row.end(a) + for (i in 1:10) { + ind <- sample(2, nrow(x), replace=T, prob=c(0.9,0.1)) + m.ct <- ctree(as.formula(paste('as.factor(',colnames(x)[par1],') ~ .',sep='')),data =x[ind==1,]) + if (i==1) { + m.ct.i.pred <- predict(m.ct, newdata=x[ind==1,]) + m.ct.i.actu <- x[ind==1,par1] + m.ct.x.pred <- predict(m.ct, newdata=x[ind==2,]) + m.ct.x.actu <- x[ind==2,par1] + } else { + m.ct.i.pred <- c(m.ct.i.pred,predict(m.ct, newdata=x[ind==1,])) + m.ct.i.actu <- c(m.ct.i.actu,x[ind==1,par1]) + m.ct.x.pred <- c(m.ct.x.pred,predict(m.ct, newdata=x[ind==2,])) + m.ct.x.actu <- c(m.ct.x.actu,x[ind==2,par1]) + } + } + print(m.ct.i.tab <- table(m.ct.i.actu,m.ct.i.pred)) + numer <- 0 + for (i in 1:par3) { + print(m.ct.i.tab[i,i] / sum(m.ct.i.tab[i,])) + numer <- numer + m.ct.i.tab[i,i] + } + print(m.ct.i.cp <- numer / sum(m.ct.i.tab)) + print(m.ct.x.tab <- table(m.ct.x.actu,m.ct.x.pred)) + numer <- 0 + for (i in 1:par3) { + print(m.ct.x.tab[i,i] / sum(m.ct.x.tab[i,])) + numer <- numer + m.ct.x.tab[i,i] + } + print(m.ct.x.cp <- numer / sum(m.ct.x.tab)) + for (i in 1:par3) { + a<-table.row.start(a) + a<-table.element(a,paste('C',i,sep=''),1,TRUE) + for (jjj in 1:par3) a<-table.element(a,m.ct.i.tab[i,jjj]) + a<-table.element(a,round(m.ct.i.tab[i,i]/sum(m.ct.i.tab[i,]),4)) + for (jjj in 1:par3) a<-table.element(a,m.ct.x.tab[i,jjj]) + a<-table.element(a,round(m.ct.x.tab[i,i]/sum(m.ct.x.tab[i,]),4)) + a<-table.row.end(a) + } + a<-table.row.start(a) + a<-table.element(a,'Overall',1,TRUE) + for (jjj in 1:par3) a<-table.element(a,'-') + a<-table.element(a,round(m.ct.i.cp,4)) + for (jjj in 1:par3) a<-table.element(a,'-') + a<-table.element(a,round(m.ct.x.cp,4)) + a<-table.row.end(a) + a<-table.end(a) + table.save(a,file="/var/fisher/rcomp/tmp/1xtsb1356093715.tab") + } + } m.ct.i.pred m.ct.i.actu 1 2 1 655 101 2 141 610 [1] 0.8664021 [1] 0.8122503 [1] 0.8394161 m.ct.x.pred m.ct.x.actu 1 2 1 55 9 2 10 59 [1] 0.859375 [1] 0.8550725 [1] 0.8571429 > m Conditional inference tree with 4 terminal nodes Response: as.factor(y) Inputs: x1, x2, x3, x4, x5 Number of observations: 164 1) x1 <= 48; criterion = 1, statistic = 68.565 2)* weights = 60 1) x1 > 48 3) x4 <= 72; criterion = 0.998, statistic = 12.133 4)* weights = 20 3) x4 > 72 5) x2 <= 54; criterion = 0.983, statistic = 8.562 6)* weights = 9 5) x2 > 54 7)* weights = 75 > postscript(file="/var/fisher/rcomp/tmp/233vr1356093715.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(m) > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/3u7z71356093715.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x[,par1] ~ as.factor(where(m)),main='Response by Terminal Node',xlab='Terminal Node',ylab='Response') > dev.off() null device 1 > if (par2 == 'none') { + forec <- predict(m) + result <- as.data.frame(cbind(x[,par1],forec,x[,par1]-forec)) + colnames(result) <- c('Actuals','Forecasts','Residuals') + print(result) + } > if (par2 != 'none') { + print(cbind(as.factor(x[,par1]),predict(m))) + myt <- table(as.factor(x[,par1]),predict(m)) + print(myt) + } [,1] [,2] [1,] 2 2 [2,] 2 1 [3,] 2 2 [4,] 2 2 [5,] 2 2 [6,] 2 2 [7,] 2 2 [8,] 2 2 [9,] 2 2 [10,] 2 2 [11,] 2 2 [12,] 2 2 [13,] 2 2 [14,] 2 2 [15,] 2 2 [16,] 2 2 [17,] 2 2 [18,] 2 1 [19,] 2 2 [20,] 2 1 [21,] 2 2 [22,] 2 2 [23,] 2 2 [24,] 2 2 [25,] 2 2 [26,] 2 2 [27,] 2 2 [28,] 2 2 [29,] 2 1 [30,] 2 2 [31,] 2 2 [32,] 2 2 [33,] 2 2 [34,] 2 2 [35,] 2 2 [36,] 2 2 [37,] 2 2 [38,] 2 2 [39,] 2 2 [40,] 2 2 [41,] 2 2 [42,] 2 1 [43,] 2 2 [44,] 2 2 [45,] 2 1 [46,] 2 1 [47,] 2 1 [48,] 2 2 [49,] 2 2 [50,] 2 2 [51,] 2 2 [52,] 2 2 [53,] 2 2 [54,] 2 2 [55,] 2 2 [56,] 2 2 [57,] 2 2 [58,] 2 2 [59,] 2 2 [60,] 2 2 [61,] 2 2 [62,] 2 2 [63,] 2 1 [64,] 2 2 [65,] 2 2 [66,] 2 2 [67,] 2 2 [68,] 2 2 [69,] 2 2 [70,] 2 2 [71,] 2 2 [72,] 2 1 [73,] 2 1 [74,] 2 1 [75,] 2 1 [76,] 2 2 [77,] 2 2 [78,] 2 1 [79,] 2 2 [80,] 2 1 [81,] 2 1 [82,] 2 2 [83,] 1 1 [84,] 1 1 [85,] 1 1 [86,] 1 1 [87,] 1 1 [88,] 1 1 [89,] 1 1 [90,] 1 1 [91,] 1 1 [92,] 1 1 [93,] 1 1 [94,] 1 1 [95,] 1 1 [96,] 1 1 [97,] 1 2 [98,] 1 1 [99,] 1 2 [100,] 1 1 [101,] 1 1 [102,] 1 1 [103,] 1 1 [104,] 1 1 [105,] 1 2 [106,] 1 1 [107,] 1 1 [108,] 1 1 [109,] 1 2 [110,] 1 1 [111,] 1 1 [112,] 1 2 [113,] 1 1 [114,] 1 1 [115,] 1 1 [116,] 1 1 [117,] 1 2 [118,] 1 1 [119,] 1 1 [120,] 1 1 [121,] 1 1 [122,] 1 1 [123,] 1 2 [124,] 1 1 [125,] 1 2 [126,] 1 1 [127,] 1 2 [128,] 1 1 [129,] 1 1 [130,] 1 1 [131,] 1 1 [132,] 1 1 [133,] 1 1 [134,] 1 1 [135,] 1 1 [136,] 1 1 [137,] 1 1 [138,] 1 1 [139,] 1 1 [140,] 1 1 [141,] 1 1 [142,] 1 1 [143,] 1 1 [144,] 1 1 [145,] 1 1 [146,] 1 1 [147,] 1 1 [148,] 1 1 [149,] 1 1 [150,] 1 1 [151,] 1 1 [152,] 1 1 [153,] 1 1 [154,] 1 1 [155,] 1 1 [156,] 1 1 [157,] 1 1 [158,] 1 1 [159,] 1 1 [160,] 1 1 [161,] 1 1 [162,] 1 1 [163,] 1 1 [164,] 1 1 [ 0,127324) [127324,293403] [ 0,127324) 73 9 [127324,293403] 16 66 > postscript(file="/var/fisher/rcomp/tmp/4l8tj1356093715.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > if(par2=='none') { + op <- par(mfrow=c(2,2)) + plot(density(result$Actuals),main='Kernel Density Plot of Actuals') + plot(density(result$Residuals),main='Kernel Density Plot of Residuals') + plot(result$Forecasts,result$Actuals,main='Actuals versus Predictions',xlab='Predictions',ylab='Actuals') + plot(density(result$Forecasts),main='Kernel Density Plot of Predictions') + par(op) + } > if(par2!='none') { + plot(myt,main='Confusion Matrix',xlab='Actual',ylab='Predicted') + } > dev.off() null device 1 > if (par2 == 'none') { + detcoef <- cor(result$Forecasts,result$Actuals) + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Goodness of Fit',2,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Correlation',1,TRUE) + a<-table.element(a,round(detcoef,4)) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'R-squared',1,TRUE) + a<-table.element(a,round(detcoef*detcoef,4)) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'RMSE',1,TRUE) + a<-table.element(a,round(sqrt(mean((result$Residuals)^2)),4)) + a<-table.row.end(a) + a<-table.end(a) + table.save(a,file="/var/fisher/rcomp/tmp/59q2q1356093715.tab") + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Actuals, Predictions, and Residuals',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'#',header=TRUE) + a<-table.element(a,'Actuals',header=TRUE) + a<-table.element(a,'Forecasts',header=TRUE) + a<-table.element(a,'Residuals',header=TRUE) + a<-table.row.end(a) + for (i in 1:length(result$Actuals)) { + a<-table.row.start(a) + a<-table.element(a,i,header=TRUE) + a<-table.element(a,result$Actuals[i]) + a<-table.element(a,result$Forecasts[i]) + a<-table.element(a,result$Residuals[i]) + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/fisher/rcomp/tmp/6xgf31356093715.tab") + } > if (par2 != 'none') { + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Confusion Matrix (predicted in columns / actuals in rows)',par3+1,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'',1,TRUE) + for (i in 1:par3) { + a<-table.element(a,paste('C',i,sep=''),1,TRUE) + } + a<-table.row.end(a) + for (i in 1:par3) { + a<-table.row.start(a) + a<-table.element(a,paste('C',i,sep=''),1,TRUE) + for (j in 1:par3) { + a<-table.element(a,myt[i,j]) + } + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/fisher/rcomp/tmp/7plnz1356093715.tab") + } > > try(system("convert tmp/233vr1356093715.ps tmp/233vr1356093715.png",intern=TRUE)) character(0) > try(system("convert tmp/3u7z71356093715.ps tmp/3u7z71356093715.png",intern=TRUE)) character(0) > try(system("convert tmp/4l8tj1356093715.ps tmp/4l8tj1356093715.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.241 0.694 5.922