R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(1845 + ,162687 + ,48 + ,21 + ,73 + ,20465 + ,23975 + ,1796 + ,201906 + ,58 + ,20 + ,56 + ,33629 + ,85634 + ,192 + ,7215 + ,0 + ,0 + ,0 + ,1423 + ,1929 + ,2444 + ,146367 + ,67 + ,27 + ,63 + ,25629 + ,36294 + ,3567 + ,257045 + ,83 + ,31 + ,116 + ,54002 + ,72255 + ,6917 + ,524450 + ,136 + ,36 + ,138 + ,151036 + ,189748 + ,1840 + ,188294 + ,65 + ,23 + ,71 + ,33287 + ,61834 + ,1740 + ,195674 + ,86 + ,30 + ,107 + ,31172 + ,68167 + ,2078 + ,177020 + ,62 + ,30 + ,50 + ,28113 + ,38462 + ,3118 + ,330194 + ,72 + ,27 + ,81 + ,57803 + ,101219 + ,1946 + ,121844 + ,50 + ,24 + ,58 + ,49830 + ,43270 + ,2370 + ,203938 + ,88 + ,30 + ,91 + ,52143 + ,76183 + ,1944 + ,113213 + ,61 + ,22 + ,41 + ,21055 + ,31476 + ,3198 + ,220751 + ,79 + ,28 + ,100 + ,47007 + ,62157 + ,1491 + ,172905 + ,56 + ,18 + ,61 + ,28735 + ,46261 + ,1573 + ,156326 + ,54 + ,22 + ,74 + ,59147 + ,50063 + ,1807 + ,145178 + ,81 + ,37 + ,147 + ,78950 + ,64483 + ,1309 + ,89171 + ,13 + ,15 + ,45 + ,13497 + ,2341 + ,2820 + ,172624 + ,74 + ,34 + ,110 + ,46154 + ,48149 + ,776 + ,39790 + ,18 + ,18 + ,41 + ,53249 + ,12743 + ,1162 + ,87927 + ,31 + ,15 + ,37 + ,10726 + ,18743 + ,2818 + ,241285 + ,99 + ,30 + ,84 + ,83700 + ,97057 + ,1770 + ,198587 + ,38 + ,25 + ,67 + ,40400 + ,17675 + ,2315 + ,146946 + ,59 + ,34 + ,69 + ,33797 + ,33106 + ,1994 + ,159763 + ,54 + ,21 + ,58 + ,36205 + ,53311 + ,1806 + ,207078 + ,63 + ,21 + ,60 + ,30165 + ,42754 + ,2152 + ,212394 + ,66 + ,25 + ,88 + ,58534 + ,59056 + ,1457 + ,201536 + ,90 + ,31 + ,75 + ,44663 + ,101621 + ,3000 + ,394662 + ,72 + ,31 + ,98 + ,92556 + ,118120 + ,2236 + ,217892 + ,61 + ,20 + ,67 + ,40078 + ,79572 + ,1685 + ,182286 + ,61 + ,28 + ,84 + ,34711 + ,42744 + ,1626 + ,181740 + ,61 + ,22 + ,62 + ,31076 + ,65931 + ,2257 + ,137978 + ,53 + ,17 + ,35 + ,74608 + ,38575 + ,3373 + ,255929 + ,118 + ,25 + ,74 + ,58092 + ,28795 + ,2571 + ,236489 + ,73 + ,25 + ,93 + ,42009 + ,94440 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,2142 + ,230761 + ,54 + ,31 + ,87 + ,36022 + ,38229 + ,1878 + ,132807 + ,54 + ,14 + ,39 + ,23333 + ,31972 + ,2190 + ,157118 + ,46 + ,35 + ,101 + ,53349 + ,40071 + ,2186 + ,253254 + ,83 + ,34 + ,135 + ,92596 + ,132480 + ,2533 + ,269329 + ,106 + ,22 + ,76 + ,49598 + ,62797 + ,1823 + ,161273 + ,44 + ,34 + ,118 + ,44093 + ,40429 + ,1095 + ,107181 + ,27 + ,23 + ,76 + ,84205 + ,45545 + ,2162 + ,195891 + ,64 + ,24 + ,65 + ,63369 + ,57568 + ,1365 + ,139667 + ,71 + ,26 + ,97 + ,60132 + ,39019 + ,1245 + ,171101 + ,44 + ,23 + ,70 + ,37403 + ,53866 + ,756 + ,81407 + ,23 + ,35 + ,63 + ,24460 + ,38345 + ,2417 + ,247563 + ,78 + ,24 + ,96 + ,46456 + ,50210 + ,2327 + ,239807 + ,60 + ,31 + ,112 + ,66616 + ,80947 + ,2786 + ,172743 + ,73 + ,30 + ,82 + ,41554 + ,43461 + ,658 + ,48188 + ,12 + ,22 + ,39 + ,22346 + ,14812 + ,2012 + ,169355 + ,104 + ,23 + ,69 + ,30874 + ,37819 + ,2616 + ,325322 + ,86 + ,27 + ,93 + ,68701 + ,102738 + ,2071 + ,241518 + ,57 + ,30 + ,76 + ,35728 + ,54509 + ,1911 + ,195583 + ,67 + ,33 + ,117 + ,29010 + ,62956 + ,1775 + ,159913 + ,44 + ,12 + ,31 + ,23110 + ,55411 + ,1919 + ,220241 + ,53 + ,26 + ,65 + ,38844 + ,50611 + ,1047 + ,101694 + ,26 + ,26 + ,78 + ,27084 + ,26692 + ,1190 + ,157258 + ,67 + ,23 + ,87 + ,35139 + ,60056 + ,2890 + ,202536 + ,36 + ,38 + ,85 + ,57476 + ,25155 + ,1836 + ,173505 + ,56 + ,32 + ,119 + ,33277 + ,42840 + ,2254 + ,150518 + ,52 + ,21 + ,65 + ,31141 + ,39358 + ,1392 + ,141491 + ,54 + ,22 + ,60 + ,61281 + ,47241 + ,1326 + ,125612 + ,57 + ,26 + ,67 + ,25820 + ,49611 + ,1317 + ,166049 + ,27 + ,28 + ,94 + ,23284 + ,41833 + ,1525 + ,124197 + ,58 + ,33 + ,100 + ,35378 + ,48930 + ,2335 + ,195043 + ,76 + ,36 + ,135 + ,74990 + ,110600 + ,2897 + ,138708 + ,93 + ,25 + ,71 + ,29653 + ,52235 + ,1118 + ,116552 + ,59 + ,25 + ,78 + ,64622 + ,53986 + ,340 + ,31970 + ,5 + ,21 + ,42 + ,4157 + ,4105 + ,2977 + ,258158 + ,57 + ,19 + ,42 + ,29245 + ,59331 + ,1452 + ,151194 + ,42 + ,12 + ,8 + ,50008 + ,47796 + ,1550 + ,135926 + ,88 + ,30 + ,86 + ,52338 + ,38302 + ,1685 + ,119629 + ,53 + ,21 + ,41 + ,13310 + ,14063 + ,2728 + ,171518 + ,81 + ,39 + ,131 + ,92901 + ,54414 + ,1574 + ,108949 + ,35 + ,32 + ,91 + ,10956 + ,9903 + ,2413 + ,183471 + ,102 + ,28 + ,102 + ,34241 + ,53987 + ,2563 + ,159966 + ,71 + ,29 + ,91 + ,75043 + ,88937 + ,1079 + ,93786 + ,28 + ,21 + ,46 + ,21152 + ,21928 + ,1235 + ,84971 + ,34 + ,31 + ,60 + ,42249 + ,29487 + ,980 + ,88882 + ,54 + ,26 + ,69 + ,42005 + ,35334 + ,2246 + ,304603 + ,49 + ,29 + ,95 + ,41152 + ,57596 + ,1076 + ,75101 + ,30 + ,23 + ,17 + ,14399 + ,29750 + ,1637 + ,145043 + ,57 + ,25 + ,61 + ,28263 + ,41029 + ,1208 + ,95827 + ,54 + ,22 + ,55 + ,17215 + ,12416 + ,1865 + ,173924 + ,38 + ,26 + ,55 + ,48140 + ,51158 + ,2726 + ,241957 + ,63 + ,33 + ,124 + ,62897 + ,79935 + ,1208 + ,115367 + ,58 + ,24 + ,73 + ,22883 + ,26552 + ,1419 + ,118408 + ,46 + ,24 + ,73 + ,41622 + ,25807 + ,1609 + ,164078 + ,46 + ,21 + ,67 + ,40715 + ,50620 + ,1864 + ,158931 + ,51 + ,28 + ,66 + ,65897 + ,61467 + ,2412 + ,184139 + ,87 + ,28 + ,77 + ,76542 + ,65292 + ,1238 + ,152856 + ,39 + ,25 + ,83 + ,37477 + ,55516 + ,1463 + ,144014 + ,28 + ,15 + ,55 + ,53216 + ,42006 + ,973 + ,62535 + ,26 + ,13 + ,27 + ,40911 + ,26273 + ,2319 + ,245196 + ,52 + ,36 + ,115 + ,57021 + ,90248 + ,1890 + ,199841 + ,96 + ,27 + ,85 + ,73116 + ,61476 + ,223 + ,19349 + ,13 + ,1 + ,0 + ,3895 + ,9604 + ,2526 + ,247280 + ,43 + ,24 + ,83 + ,46609 + ,45108 + ,2072 + ,159408 + ,42 + ,31 + ,90 + ,29351 + ,47232 + ,778 + ,72128 + ,30 + ,4 + ,4 + ,2325 + ,3439 + ,1194 + ,104253 + ,59 + ,21 + ,60 + ,31747 + ,30553 + ,1424 + ,151090 + ,73 + ,27 + ,74 + ,32665 + ,24751 + ,1328 + ,137382 + ,39 + ,23 + ,52 + ,19249 + ,34458 + ,839 + ,87448 + ,36 + ,12 + ,24 + ,15292 + ,24649 + ,596 + ,27676 + ,2 + ,16 + ,17 + ,5842 + ,2342 + ,1671 + ,165507 + ,102 + ,29 + ,105 + ,33994 + ,52739 + ,1168 + ,132148 + ,30 + ,26 + ,20 + ,13018 + ,6245 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1106 + ,95778 + ,46 + ,25 + ,51 + ,98177 + ,35381 + ,1148 + ,109001 + ,25 + ,21 + ,76 + ,37941 + ,19595 + ,1485 + ,158833 + ,59 + ,24 + ,61 + ,31032 + ,50848 + ,1526 + ,147690 + ,60 + ,21 + ,70 + ,32683 + ,39443 + ,962 + ,89887 + ,36 + ,21 + ,38 + ,34545 + ,27023 + ,78 + ,3616 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1184 + ,199005 + ,45 + ,23 + ,81 + ,27525 + ,61022 + ,1671 + ,160930 + ,79 + ,33 + ,78 + ,66856 + ,63528 + ,2142 + ,177948 + ,30 + ,32 + ,76 + ,28549 + ,34835 + ,1015 + ,136061 + ,43 + ,23 + ,89 + ,38610 + ,37172 + ,778 + ,43410 + ,7 + ,1 + ,3 + ,2781 + ,13 + ,1856 + ,184277 + ,80 + ,29 + ,87 + ,41211 + ,62548 + ,1056 + ,108858 + ,32 + ,20 + ,55 + ,22698 + ,31334 + ,2297 + ,151030 + ,84 + ,33 + ,73 + ,41194 + ,20839 + ,731 + ,60493 + ,3 + ,12 + ,32 + ,32689 + ,5084 + ,285 + ,19764 + ,10 + ,2 + ,4 + ,5752 + ,9927 + ,1872 + ,177559 + ,47 + ,21 + ,70 + ,26757 + ,53229 + ,1181 + ,140281 + ,35 + ,28 + ,102 + ,22527 + ,29877 + ,1725 + ,164249 + ,54 + ,35 + ,109 + ,44810 + ,37310 + ,256 + ,11796 + ,1 + ,2 + ,1 + ,0 + ,0 + ,98 + ,10674 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1435 + ,151322 + ,46 + ,18 + ,39 + ,100674 + ,50067 + ,41 + ,6836 + ,0 + ,1 + ,0 + ,0 + ,0 + ,1930 + ,174712 + ,51 + ,21 + ,45 + ,57786 + ,47708 + ,42 + ,5118 + ,5 + ,0 + ,0 + ,0 + ,0 + ,528 + ,40248 + ,8 + ,4 + ,7 + ,5444 + ,6012 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1121 + ,127628 + ,38 + ,29 + ,86 + ,28470 + ,27749 + ,1305 + ,88837 + ,21 + ,26 + ,52 + ,61849 + ,47555 + ,81 + ,7131 + ,0 + ,0 + ,0 + ,0 + ,0 + ,262 + ,9056 + ,0 + ,4 + ,1 + ,2179 + ,1336 + ,1100 + ,87957 + ,18 + ,19 + ,49 + ,8019 + ,11017 + ,1290 + ,144470 + ,53 + ,22 + ,72 + ,39644 + ,55184 + ,1248 + ,111408 + ,17 + ,22 + ,56 + ,23494 + ,43485) + ,dim=c(7 + ,144) + ,dimnames=list(c('X1' + ,'Y' + ,'X2' + ,'X3' + ,'X4' + ,'X5' + ,'X6 ') + ,1:144)) > y <- array(NA,dim=c(7,144),dimnames=list(c('X1','Y','X2','X3','X4','X5','X6 '),1:144)) > 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 = '2' > 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 Loading required package: sandwich Loading required package: strucchange Loading required package: vcd Loading required package: MASS Loading required package: colorspace > library(Hmisc) 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] 162687 201906 7215 146367 257045 524450 188294 195674 177020 330194 [11] 121844 203938 113213 220751 172905 156326 145178 89171 172624 39790 [21] 87927 241285 198587 146946 159763 207078 212394 201536 394662 217892 [31] 182286 181740 137978 255929 236489 0 230761 132807 157118 253254 [41] 269329 161273 107181 195891 139667 171101 81407 247563 239807 172743 [51] 48188 169355 325322 241518 195583 159913 220241 101694 157258 202536 [61] 173505 150518 141491 125612 166049 124197 195043 138708 116552 31970 [71] 258158 151194 135926 119629 171518 108949 183471 159966 93786 84971 [81] 88882 304603 75101 145043 95827 173924 241957 115367 118408 164078 [91] 158931 184139 152856 144014 62535 245196 199841 19349 247280 159408 [101] 72128 104253 151090 137382 87448 27676 165507 132148 0 95778 [111] 109001 158833 147690 89887 3616 0 199005 160930 177948 136061 [121] 43410 184277 108858 151030 60493 19764 177559 140281 164249 11796 [131] 10674 151322 6836 174712 5118 40248 0 127628 88837 7131 [141] 9056 87957 144470 111408 > 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,151194) [151194,524450] 72 72 > colnames(x) [1] "X1" "Y" "X2" "X3" "X4" "X5" "X6." > colnames(x)[par1] [1] "Y" > x[,par1] [1] [151194,524450] [151194,524450] [ 0,151194) [ 0,151194) [5] [151194,524450] [151194,524450] [151194,524450] [151194,524450] [9] [151194,524450] [151194,524450] [ 0,151194) [151194,524450] [13] [ 0,151194) [151194,524450] [151194,524450] [151194,524450] [17] [ 0,151194) [ 0,151194) [151194,524450] [ 0,151194) [21] [ 0,151194) [151194,524450] [151194,524450] [ 0,151194) [25] [151194,524450] [151194,524450] [151194,524450] [151194,524450] [29] [151194,524450] [151194,524450] [151194,524450] [151194,524450] [33] [ 0,151194) [151194,524450] [151194,524450] [ 0,151194) [37] [151194,524450] [ 0,151194) [151194,524450] [151194,524450] [41] [151194,524450] [151194,524450] [ 0,151194) [151194,524450] [45] [ 0,151194) [151194,524450] [ 0,151194) [151194,524450] [49] [151194,524450] [151194,524450] [ 0,151194) [151194,524450] [53] [151194,524450] [151194,524450] [151194,524450] [151194,524450] [57] [151194,524450] [ 0,151194) [151194,524450] [151194,524450] [61] [151194,524450] [ 0,151194) [ 0,151194) [ 0,151194) [65] [151194,524450] [ 0,151194) [151194,524450] [ 0,151194) [69] [ 0,151194) [ 0,151194) [151194,524450] [151194,524450] [73] [ 0,151194) [ 0,151194) [151194,524450] [ 0,151194) [77] [151194,524450] [151194,524450] [ 0,151194) [ 0,151194) [81] [ 0,151194) [151194,524450] [ 0,151194) [ 0,151194) [85] [ 0,151194) [151194,524450] [151194,524450] [ 0,151194) [89] [ 0,151194) [151194,524450] [151194,524450] [151194,524450] [93] [151194,524450] [ 0,151194) [ 0,151194) [151194,524450] [97] [151194,524450] [ 0,151194) [151194,524450] [151194,524450] [101] [ 0,151194) [ 0,151194) [ 0,151194) [ 0,151194) [105] [ 0,151194) [ 0,151194) [151194,524450] [ 0,151194) [109] [ 0,151194) [ 0,151194) [ 0,151194) [151194,524450] [113] [ 0,151194) [ 0,151194) [ 0,151194) [ 0,151194) [117] [151194,524450] [151194,524450] [151194,524450] [ 0,151194) [121] [ 0,151194) [151194,524450] [ 0,151194) [ 0,151194) [125] [ 0,151194) [ 0,151194) [151194,524450] [ 0,151194) [129] [151194,524450] [ 0,151194) [ 0,151194) [151194,524450] [133] [ 0,151194) [151194,524450] [ 0,151194) [ 0,151194) [137] [ 0,151194) [ 0,151194) [ 0,151194) [ 0,151194) [141] [ 0,151194) [ 0,151194) [ 0,151194) [ 0,151194) Levels: [ 0,151194) [151194,524450] > if (par2 == 'none') { + m <- ctree(as.formula(paste(colnames(x)[par1],' ~ .',sep='')),data = x) + } > > #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/1mm8y1324567954.tab") + } + } m.ct.i.pred m.ct.i.actu 1 2 1 531 108 2 61 564 [1] 0.8309859 [1] 0.9024 [1] 0.8662975 m.ct.x.pred m.ct.x.actu 1 2 1 64 17 2 21 74 [1] 0.7901235 [1] 0.7789474 [1] 0.7840909 > m Conditional inference tree with 3 terminal nodes Response: as.factor(Y) Inputs: X1, X2, X3, X4, X5, X6. Number of observations: 144 1) X6. <= 39443; criterion = 1, statistic = 59.039 2) X1 <= 1685; criterion = 1, statistic = 20.261 3)* weights = 52 2) X1 > 1685 4)* weights = 16 1) X6. > 39443 5)* weights = 76 > postscript(file="/var/wessaorg/rcomp/tmp/2m3wh1324567954.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/wessaorg/rcomp/tmp/3bou51324567954.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 2 [3,] 1 1 [4,] 1 2 [5,] 2 2 [6,] 2 2 [7,] 2 2 [8,] 2 2 [9,] 2 2 [10,] 2 2 [11,] 1 2 [12,] 2 2 [13,] 1 2 [14,] 2 2 [15,] 2 2 [16,] 2 2 [17,] 1 2 [18,] 1 1 [19,] 2 2 [20,] 1 1 [21,] 1 1 [22,] 2 2 [23,] 2 2 [24,] 1 2 [25,] 2 2 [26,] 2 2 [27,] 2 2 [28,] 2 2 [29,] 2 2 [30,] 2 2 [31,] 2 2 [32,] 2 2 [33,] 1 2 [34,] 2 2 [35,] 2 2 [36,] 1 1 [37,] 2 2 [38,] 1 2 [39,] 2 2 [40,] 2 2 [41,] 2 2 [42,] 2 2 [43,] 1 2 [44,] 2 2 [45,] 1 1 [46,] 2 2 [47,] 1 1 [48,] 2 2 [49,] 2 2 [50,] 2 2 [51,] 1 1 [52,] 2 2 [53,] 2 2 [54,] 2 2 [55,] 2 2 [56,] 2 2 [57,] 2 2 [58,] 1 1 [59,] 2 2 [60,] 2 2 [61,] 2 2 [62,] 1 2 [63,] 1 2 [64,] 1 2 [65,] 2 2 [66,] 1 2 [67,] 2 2 [68,] 1 2 [69,] 1 2 [70,] 1 1 [71,] 2 2 [72,] 2 2 [73,] 1 1 [74,] 1 1 [75,] 2 2 [76,] 1 1 [77,] 2 2 [78,] 2 2 [79,] 1 1 [80,] 1 1 [81,] 1 1 [82,] 2 2 [83,] 1 1 [84,] 1 2 [85,] 1 1 [86,] 2 2 [87,] 2 2 [88,] 1 1 [89,] 1 1 [90,] 2 2 [91,] 2 2 [92,] 2 2 [93,] 2 2 [94,] 1 2 [95,] 1 1 [96,] 2 2 [97,] 2 2 [98,] 1 1 [99,] 2 2 [100,] 2 2 [101,] 1 1 [102,] 1 1 [103,] 1 1 [104,] 1 1 [105,] 1 1 [106,] 1 1 [107,] 2 2 [108,] 1 1 [109,] 1 1 [110,] 1 1 [111,] 1 1 [112,] 2 2 [113,] 1 1 [114,] 1 1 [115,] 1 1 [116,] 1 1 [117,] 2 2 [118,] 2 2 [119,] 2 2 [120,] 1 1 [121,] 1 1 [122,] 2 2 [123,] 1 1 [124,] 1 2 [125,] 1 1 [126,] 1 1 [127,] 2 2 [128,] 1 1 [129,] 2 2 [130,] 1 1 [131,] 1 1 [132,] 2 2 [133,] 1 1 [134,] 2 2 [135,] 1 1 [136,] 1 1 [137,] 1 1 [138,] 1 1 [139,] 1 2 [140,] 1 1 [141,] 1 1 [142,] 1 1 [143,] 1 2 [144,] 1 2 [ 0,151194) [151194,524450] [ 0,151194) 52 20 [151194,524450] 0 72 > postscript(file="/var/wessaorg/rcomp/tmp/47wrj1324567954.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/wessaorg/rcomp/tmp/59i181324567954.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/wessaorg/rcomp/tmp/6fkgv1324567954.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/wessaorg/rcomp/tmp/7yvwc1324567954.tab") + } > > try(system("convert tmp/2m3wh1324567954.ps tmp/2m3wh1324567954.png",intern=TRUE)) character(0) > try(system("convert tmp/3bou51324567954.ps tmp/3bou51324567954.png",intern=TRUE)) character(0) > try(system("convert tmp/47wrj1324567954.ps tmp/47wrj1324567954.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.263 0.262 3.791