R version 2.12.1 (2010-12-16) Copyright (C) 2010 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(210907 + ,56 + ,115 + ,112285 + ,145 + ,120982 + ,56 + ,109 + ,84786 + ,101 + ,176508 + ,54 + ,146 + ,83123 + ,98 + ,179321 + ,89 + ,116 + ,101193 + ,132 + ,123185 + ,40 + ,68 + ,38361 + ,60 + ,52746 + ,25 + ,101 + ,68504 + ,38 + ,385534 + ,92 + ,96 + ,119182 + ,144 + ,33170 + ,18 + ,67 + ,22807 + ,5 + ,101645 + ,63 + ,44 + ,17140 + ,28 + ,149061 + ,44 + ,100 + ,116174 + ,84 + ,165446 + ,33 + ,93 + ,57635 + ,79 + ,237213 + ,84 + ,140 + ,66198 + ,127 + ,173326 + ,88 + ,166 + ,71701 + ,78 + ,133131 + ,55 + ,99 + ,57793 + ,60 + ,258873 + ,60 + ,139 + ,80444 + ,131 + ,180083 + ,66 + ,130 + ,53855 + ,84 + ,324799 + ,154 + ,181 + ,97668 + ,133 + ,230964 + ,53 + ,116 + ,133824 + ,150 + ,236785 + ,119 + ,116 + ,101481 + ,91 + ,135473 + ,41 + ,88 + ,99645 + ,132 + ,202925 + ,61 + ,139 + ,114789 + ,136 + ,215147 + ,58 + ,135 + ,99052 + ,124 + ,344297 + ,75 + ,108 + ,67654 + ,118 + ,153935 + ,33 + ,89 + ,65553 + ,70 + ,132943 + ,40 + ,156 + ,97500 + ,107 + ,174724 + ,92 + ,129 + ,69112 + ,119 + ,174415 + ,100 + ,118 + ,82753 + ,89 + ,225548 + ,112 + ,118 + ,85323 + ,112 + ,223632 + ,73 + ,125 + ,72654 + ,108 + ,124817 + ,40 + ,95 + ,30727 + ,52 + ,221698 + ,45 + ,126 + ,77873 + ,112 + ,210767 + ,60 + ,135 + ,117478 + ,116 + ,170266 + ,62 + ,154 + ,74007 + ,123 + ,260561 + ,75 + ,165 + ,90183 + ,125 + ,84853 + ,31 + ,113 + ,61542 + ,27 + ,294424 + ,77 + ,127 + ,101494 + ,162 + ,101011 + ,34 + ,52 + ,27570 + ,32 + ,215641 + ,46 + ,121 + ,55813 + ,64 + ,325107 + ,99 + ,136 + ,79215 + ,92 + ,7176 + ,17 + ,0 + ,1423 + ,0 + ,167542 + ,66 + ,108 + ,55461 + ,83 + ,106408 + ,30 + ,46 + ,31081 + ,41 + ,96560 + ,76 + ,54 + ,22996 + ,47 + ,265769 + ,146 + ,124 + ,83122 + ,120 + ,269651 + ,67 + ,115 + ,70106 + ,105 + ,149112 + ,56 + ,128 + ,60578 + ,79 + ,175824 + ,107 + ,80 + ,39992 + ,65 + ,152871 + ,58 + ,97 + ,79892 + ,70 + ,111665 + ,34 + ,104 + ,49810 + ,55 + ,116408 + ,61 + ,59 + ,71570 + ,39 + ,362301 + ,119 + ,125 + ,100708 + ,67 + ,78800 + ,42 + ,82 + ,33032 + ,21 + ,183167 + ,66 + ,149 + ,82875 + ,127 + ,277965 + ,89 + ,149 + ,139077 + ,152 + ,150629 + ,44 + ,122 + ,71595 + ,113 + ,168809 + ,66 + ,118 + ,72260 + ,99 + ,24188 + ,24 + ,12 + ,5950 + ,7 + ,329267 + ,259 + ,144 + ,115762 + ,141 + ,65029 + ,17 + ,67 + ,32551 + ,21 + ,101097 + ,64 + ,52 + ,31701 + ,35 + ,218946 + ,41 + ,108 + ,80670 + ,109 + ,244052 + ,68 + ,166 + ,143558 + ,133 + ,341570 + ,168 + ,80 + ,117105 + ,123 + ,103597 + ,43 + ,60 + ,23789 + ,26 + ,233328 + ,132 + ,107 + ,120733 + ,230 + ,256462 + ,105 + ,127 + ,105195 + ,166 + ,206161 + ,71 + ,107 + ,73107 + ,68 + ,311473 + ,112 + ,146 + ,132068 + ,147 + ,235800 + ,94 + ,84 + ,149193 + ,179 + ,177939 + ,82 + ,141 + ,46821 + ,61 + ,207176 + ,70 + ,123 + ,87011 + ,101 + ,196553 + ,57 + ,111 + ,95260 + ,108 + ,174184 + ,53 + ,98 + ,55183 + ,90 + ,143246 + ,103 + ,105 + ,106671 + ,114 + ,187559 + ,121 + ,135 + ,73511 + ,103 + ,187681 + ,62 + ,107 + ,92945 + ,142 + ,119016 + ,52 + ,85 + ,78664 + ,79 + ,182192 + ,52 + ,155 + ,70054 + ,88 + ,73566 + ,32 + ,88 + ,22618 + ,25 + ,194979 + ,62 + ,155 + ,74011 + ,83 + ,167488 + ,45 + ,104 + ,83737 + ,113 + ,143756 + ,46 + ,132 + ,69094 + ,118 + ,275541 + ,63 + ,127 + ,93133 + ,110 + ,243199 + ,75 + ,108 + ,95536 + ,129 + ,182999 + ,88 + ,129 + ,225920 + ,51 + ,135649 + ,46 + ,116 + ,62133 + ,93 + ,152299 + ,53 + ,122 + ,61370 + ,76 + ,120221 + ,37 + ,85 + ,43836 + ,49 + ,346485 + ,90 + ,147 + ,106117 + ,118 + ,145790 + ,63 + ,99 + ,38692 + ,38 + ,193339 + ,78 + ,87 + ,84651 + ,141 + ,80953 + ,25 + ,28 + ,56622 + ,58 + ,122774 + ,45 + ,90 + ,15986 + ,27 + ,130585 + ,46 + ,109 + ,95364 + ,91 + ,112611 + ,41 + ,78 + ,26706 + ,48 + ,286468 + ,144 + ,111 + ,89691 + ,63 + ,241066 + ,82 + ,158 + ,67267 + ,56 + ,148446 + ,91 + ,141 + ,126846 + ,144 + ,204713 + ,71 + ,122 + ,41140 + ,73 + ,182079 + ,63 + ,124 + ,102860 + ,168 + ,140344 + ,53 + ,93 + ,51715 + ,64 + ,220516 + ,62 + ,124 + ,55801 + ,97 + ,243060 + ,63 + ,112 + ,111813 + ,117 + ,162765 + ,32 + ,108 + ,120293 + ,100 + ,182613 + ,39 + ,99 + ,138599 + ,149 + ,232138 + ,62 + ,117 + ,161647 + ,187 + ,265318 + ,117 + ,199 + ,115929 + ,127 + ,85574 + ,34 + ,78 + ,24266 + ,37 + ,310839 + ,92 + ,91 + ,162901 + ,245 + ,225060 + ,93 + ,158 + ,109825 + ,87 + ,232317 + ,54 + ,126 + ,129838 + ,177 + ,144966 + ,144 + ,122 + ,37510 + ,49 + ,43287 + ,14 + ,71 + ,43750 + ,49 + ,155754 + ,61 + ,75 + ,40652 + ,73 + ,164709 + ,109 + ,115 + ,87771 + ,177 + ,201940 + ,38 + ,119 + ,85872 + ,94 + ,235454 + ,73 + ,124 + ,89275 + ,117 + ,220801 + ,75 + ,72 + ,44418 + ,60 + ,99466 + ,50 + ,91 + ,192565 + ,55 + ,92661 + ,61 + ,45 + ,35232 + ,39 + ,133328 + ,55 + ,78 + ,40909 + ,64 + ,61361 + ,77 + ,39 + ,13294 + ,26 + ,125930 + ,75 + ,68 + ,32387 + ,64 + ,100750 + ,72 + ,119 + ,140867 + ,58 + ,224549 + ,50 + ,117 + ,120662 + ,95 + ,82316 + ,32 + ,39 + ,21233 + ,25 + ,102010 + ,53 + ,50 + ,44332 + ,26 + ,101523 + ,42 + ,88 + ,61056 + ,76 + ,243511 + ,71 + ,155 + ,101338 + ,129 + ,22938 + ,10 + ,0 + ,1168 + ,11 + ,41566 + ,35 + ,36 + ,13497 + ,2 + ,152474 + ,65 + ,123 + ,65567 + ,101 + ,61857 + ,25 + ,32 + ,25162 + ,28 + ,99923 + ,66 + ,99 + ,32334 + ,36 + ,132487 + ,41 + ,136 + ,40735 + ,89 + ,317394 + ,86 + ,117 + ,91413 + ,193 + ,21054 + ,16 + ,0 + ,855 + ,4 + ,209641 + ,42 + ,88 + ,97068 + ,84 + ,22648 + ,19 + ,39 + ,44339 + ,23 + ,31414 + ,19 + ,25 + ,14116 + ,39 + ,46698 + ,45 + ,52 + ,10288 + ,14 + ,131698 + ,65 + ,75 + ,65622 + ,78 + ,91735 + ,35 + ,71 + ,16563 + ,14 + ,244749 + ,95 + ,124 + ,76643 + ,101 + ,184510 + ,49 + ,151 + ,110681 + ,82 + ,79863 + ,37 + ,71 + ,29011 + ,24 + ,128423 + ,64 + ,145 + ,92696 + ,36 + ,97839 + ,38 + ,87 + ,94785 + ,75 + ,38214 + ,34 + ,27 + ,8773 + ,16 + ,151101 + ,32 + ,131 + ,83209 + ,55 + ,272458 + ,65 + ,162 + ,93815 + ,131 + ,172494 + ,52 + ,165 + ,86687 + ,131 + ,108043 + ,62 + ,54 + ,34553 + ,39 + ,328107 + ,65 + ,159 + ,105547 + ,144 + ,250579 + ,83 + ,147 + ,103487 + ,139 + ,351067 + ,95 + ,170 + ,213688 + ,211 + ,158015 + ,29 + ,119 + ,71220 + ,78 + ,98866 + ,18 + ,49 + ,23517 + ,50 + ,85439 + ,33 + ,104 + ,56926 + ,39 + ,229242 + ,247 + ,120 + ,91721 + ,90 + ,351619 + ,139 + ,150 + ,115168 + ,166 + ,84207 + ,29 + ,112 + ,111194 + ,12 + ,120445 + ,118 + ,59 + ,51009 + ,57 + ,324598 + ,110 + ,136 + ,135777 + ,133 + ,131069 + ,67 + ,107 + ,51513 + ,69 + ,204271 + ,42 + ,130 + ,74163 + ,119 + ,165543 + ,65 + ,115 + ,51633 + ,119 + ,141722 + ,94 + ,107 + ,75345 + ,65 + ,116048 + ,64 + ,75 + ,33416 + ,61 + ,250047 + ,81 + ,71 + ,83305 + ,49 + ,299775 + ,95 + ,120 + ,98952 + ,101 + ,195838 + ,67 + ,116 + ,102372 + ,196 + ,173260 + ,63 + ,79 + ,37238 + ,15 + ,254488 + ,83 + ,150 + ,103772 + ,136 + ,104389 + ,45 + ,156 + ,123969 + ,89 + ,136084 + ,30 + ,51 + ,27142 + ,40 + ,199476 + ,70 + ,118 + ,135400 + ,123 + ,92499 + ,32 + ,71 + ,21399 + ,21 + ,224330 + ,83 + ,144 + ,130115 + ,163 + ,135781 + ,31 + ,47 + ,24874 + ,29 + ,74408 + ,67 + ,28 + ,34988 + ,35 + ,81240 + ,66 + ,68 + ,45549 + ,13 + ,14688 + ,10 + ,0 + ,6023 + ,5 + ,181633 + ,70 + ,110 + ,64466 + ,96 + ,271856 + ,103 + ,147 + ,54990 + ,151 + ,7199 + ,5 + ,0 + ,1644 + ,6 + ,46660 + ,20 + ,15 + ,6179 + ,13 + ,17547 + ,5 + ,4 + ,3926 + ,3 + ,133368 + ,36 + ,64 + ,32755 + ,56 + ,95227 + ,34 + ,111 + ,34777 + ,23 + ,152601 + ,48 + ,85 + ,73224 + ,57 + ,98146 + ,40 + ,68 + ,27114 + ,14 + ,79619 + ,43 + ,40 + ,20760 + ,43 + ,59194 + ,31 + ,80 + ,37636 + ,20 + ,139942 + ,42 + ,88 + ,65461 + ,72 + ,118612 + ,46 + ,48 + ,30080 + ,87 + ,72880 + ,33 + ,76 + ,24094 + ,21) + ,dim=c(5 + ,197) + ,dimnames=list(c('time_in_rfc' + ,'logins' + ,'feedback_messages_p1' + ,'totsize' + ,'totblogs') + ,1:197)) > y <- array(NA,dim=c(5,197),dimnames=list(c('time_in_rfc','logins','feedback_messages_p1','totsize','totblogs'),1:197)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par4 = 'no' > 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 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] "time_in_rfc" > x[,par1] [1] 210907 120982 176508 179321 123185 52746 385534 33170 101645 149061 [11] 165446 237213 173326 133131 258873 180083 324799 230964 236785 135473 [21] 202925 215147 344297 153935 132943 174724 174415 225548 223632 124817 [31] 221698 210767 170266 260561 84853 294424 101011 215641 325107 7176 [41] 167542 106408 96560 265769 269651 149112 175824 152871 111665 116408 [51] 362301 78800 183167 277965 150629 168809 24188 329267 65029 101097 [61] 218946 244052 341570 103597 233328 256462 206161 311473 235800 177939 [71] 207176 196553 174184 143246 187559 187681 119016 182192 73566 194979 [81] 167488 143756 275541 243199 182999 135649 152299 120221 346485 145790 [91] 193339 80953 122774 130585 112611 286468 241066 148446 204713 182079 [101] 140344 220516 243060 162765 182613 232138 265318 85574 310839 225060 [111] 232317 144966 43287 155754 164709 201940 235454 220801 99466 92661 [121] 133328 61361 125930 100750 224549 82316 102010 101523 243511 22938 [131] 41566 152474 61857 99923 132487 317394 21054 209641 22648 31414 [141] 46698 131698 91735 244749 184510 79863 128423 97839 38214 151101 [151] 272458 172494 108043 328107 250579 351067 158015 98866 85439 229242 [161] 351619 84207 120445 324598 131069 204271 165543 141722 116048 250047 [171] 299775 195838 173260 254488 104389 136084 199476 92499 224330 135781 [181] 74408 81240 14688 181633 271856 7199 46660 17547 133368 95227 [191] 152601 98146 79619 59194 139942 118612 72880 > 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]) [ 7176,164709) [164709,385534] 99 98 > colnames(x) [1] "time_in_rfc" "logins" "feedback_messages_p1" [4] "totsize" "totblogs" > colnames(x)[par1] [1] "time_in_rfc" > x[,par1] [1] [164709,385534] [ 7176,164709) [164709,385534] [164709,385534] [5] [ 7176,164709) [ 7176,164709) [164709,385534] [ 7176,164709) [9] [ 7176,164709) [ 7176,164709) [164709,385534] [164709,385534] [13] [164709,385534] [ 7176,164709) [164709,385534] [164709,385534] [17] [164709,385534] [164709,385534] [164709,385534] [ 7176,164709) [21] [164709,385534] [164709,385534] [164709,385534] [ 7176,164709) [25] [ 7176,164709) [164709,385534] [164709,385534] [164709,385534] [29] [164709,385534] [ 7176,164709) [164709,385534] [164709,385534] [33] [164709,385534] [164709,385534] [ 7176,164709) [164709,385534] [37] [ 7176,164709) [164709,385534] [164709,385534] [ 7176,164709) [41] [164709,385534] [ 7176,164709) [ 7176,164709) [164709,385534] [45] [164709,385534] [ 7176,164709) [164709,385534] [ 7176,164709) [49] [ 7176,164709) [ 7176,164709) [164709,385534] [ 7176,164709) [53] [164709,385534] [164709,385534] [ 7176,164709) [164709,385534] [57] [ 7176,164709) [164709,385534] [ 7176,164709) [ 7176,164709) [61] [164709,385534] [164709,385534] [164709,385534] [ 7176,164709) [65] [164709,385534] [164709,385534] [164709,385534] [164709,385534] [69] [164709,385534] [164709,385534] [164709,385534] [164709,385534] [73] [164709,385534] [ 7176,164709) [164709,385534] [164709,385534] [77] [ 7176,164709) [164709,385534] [ 7176,164709) [164709,385534] [81] [164709,385534] [ 7176,164709) [164709,385534] [164709,385534] [85] [164709,385534] [ 7176,164709) [ 7176,164709) [ 7176,164709) [89] [164709,385534] [ 7176,164709) [164709,385534] [ 7176,164709) [93] [ 7176,164709) [ 7176,164709) [ 7176,164709) [164709,385534] [97] [164709,385534] [ 7176,164709) [164709,385534] [164709,385534] [101] [ 7176,164709) [164709,385534] [164709,385534] [ 7176,164709) [105] [164709,385534] [164709,385534] [164709,385534] [ 7176,164709) [109] [164709,385534] [164709,385534] [164709,385534] [ 7176,164709) [113] [ 7176,164709) [ 7176,164709) [164709,385534] [164709,385534] [117] [164709,385534] [164709,385534] [ 7176,164709) [ 7176,164709) [121] [ 7176,164709) [ 7176,164709) [ 7176,164709) [ 7176,164709) [125] [164709,385534] [ 7176,164709) [ 7176,164709) [ 7176,164709) [129] [164709,385534] [ 7176,164709) [ 7176,164709) [ 7176,164709) [133] [ 7176,164709) [ 7176,164709) [ 7176,164709) [164709,385534] [137] [ 7176,164709) [164709,385534] [ 7176,164709) [ 7176,164709) [141] [ 7176,164709) [ 7176,164709) [ 7176,164709) [164709,385534] [145] [164709,385534] [ 7176,164709) [ 7176,164709) [ 7176,164709) [149] [ 7176,164709) [ 7176,164709) [164709,385534] [164709,385534] [153] [ 7176,164709) [164709,385534] [164709,385534] [164709,385534] [157] [ 7176,164709) [ 7176,164709) [ 7176,164709) [164709,385534] [161] [164709,385534] [ 7176,164709) [ 7176,164709) [164709,385534] [165] [ 7176,164709) [164709,385534] [164709,385534] [ 7176,164709) [169] [ 7176,164709) [164709,385534] [164709,385534] [164709,385534] [173] [164709,385534] [164709,385534] [ 7176,164709) [ 7176,164709) [177] [164709,385534] [ 7176,164709) [164709,385534] [ 7176,164709) [181] [ 7176,164709) [ 7176,164709) [ 7176,164709) [164709,385534] [185] [164709,385534] [ 7176,164709) [ 7176,164709) [ 7176,164709) [189] [ 7176,164709) [ 7176,164709) [ 7176,164709) [ 7176,164709) [193] [ 7176,164709) [ 7176,164709) [ 7176,164709) [ 7176,164709) [197] [ 7176,164709) Levels: [ 7176,164709) [164709,385534] > if (par2 == 'none') { + m <- ctree(as.formula(paste(colnames(x)[par1],' ~ .',sep='')),data = x) + } > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/www/rcomp/tmp/1yfrp1323963151.tab") + } + } > m Conditional inference tree with 4 terminal nodes Response: as.factor(time_in_rfc) Inputs: logins, feedback_messages_p1, totsize, totblogs Number of observations: 197 1) totblogs <= 79; criterion = 1, statistic = 95.105 2) logins <= 67; criterion = 1, statistic = 23.789 3)* weights = 80 2) logins > 67 4)* weights = 18 1) totblogs > 79 5) logins <= 46; criterion = 0.983, statistic = 8.186 6)* weights = 18 5) logins > 46 7)* weights = 81 > postscript(file="/var/www/rcomp/tmp/2r59u1323963151.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/www/rcomp/tmp/3o34o1323963151.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,] 1 2 [3,] 2 2 [4,] 2 2 [5,] 1 1 [6,] 1 1 [7,] 2 2 [8,] 1 1 [9,] 1 1 [10,] 1 1 [11,] 2 1 [12,] 2 2 [13,] 2 2 [14,] 1 1 [15,] 2 2 [16,] 2 2 [17,] 2 2 [18,] 2 2 [19,] 2 2 [20,] 1 1 [21,] 2 2 [22,] 2 2 [23,] 2 2 [24,] 1 1 [25,] 1 1 [26,] 2 2 [27,] 2 2 [28,] 2 2 [29,] 2 2 [30,] 1 1 [31,] 2 1 [32,] 2 2 [33,] 2 2 [34,] 2 2 [35,] 1 1 [36,] 2 2 [37,] 1 1 [38,] 2 1 [39,] 2 2 [40,] 1 1 [41,] 2 2 [42,] 1 1 [43,] 1 2 [44,] 2 2 [45,] 2 2 [46,] 1 1 [47,] 2 2 [48,] 1 1 [49,] 1 1 [50,] 1 1 [51,] 2 2 [52,] 1 1 [53,] 2 2 [54,] 2 2 [55,] 1 1 [56,] 2 2 [57,] 1 1 [58,] 2 2 [59,] 1 1 [60,] 1 1 [61,] 2 1 [62,] 2 2 [63,] 2 2 [64,] 1 1 [65,] 2 2 [66,] 2 2 [67,] 2 2 [68,] 2 2 [69,] 2 2 [70,] 2 2 [71,] 2 2 [72,] 2 2 [73,] 2 2 [74,] 1 2 [75,] 2 2 [76,] 2 2 [77,] 1 1 [78,] 2 2 [79,] 1 1 [80,] 2 2 [81,] 2 1 [82,] 1 1 [83,] 2 2 [84,] 2 2 [85,] 2 2 [86,] 1 1 [87,] 1 1 [88,] 1 1 [89,] 2 2 [90,] 1 1 [91,] 2 2 [92,] 1 1 [93,] 1 1 [94,] 1 1 [95,] 1 1 [96,] 2 2 [97,] 2 2 [98,] 1 2 [99,] 2 2 [100,] 2 2 [101,] 1 1 [102,] 2 2 [103,] 2 2 [104,] 1 1 [105,] 2 1 [106,] 2 2 [107,] 2 2 [108,] 1 1 [109,] 2 2 [110,] 2 2 [111,] 2 2 [112,] 1 2 [113,] 1 1 [114,] 1 1 [115,] 2 2 [116,] 2 1 [117,] 2 2 [118,] 2 2 [119,] 1 1 [120,] 1 1 [121,] 1 1 [122,] 1 2 [123,] 1 2 [124,] 1 2 [125,] 2 2 [126,] 1 1 [127,] 1 1 [128,] 1 1 [129,] 2 2 [130,] 1 1 [131,] 1 1 [132,] 1 2 [133,] 1 1 [134,] 1 1 [135,] 1 1 [136,] 2 2 [137,] 1 1 [138,] 2 1 [139,] 1 1 [140,] 1 1 [141,] 1 1 [142,] 1 1 [143,] 1 1 [144,] 2 2 [145,] 2 2 [146,] 1 1 [147,] 1 1 [148,] 1 1 [149,] 1 1 [150,] 1 1 [151,] 2 2 [152,] 2 2 [153,] 1 1 [154,] 2 2 [155,] 2 2 [156,] 2 2 [157,] 1 1 [158,] 1 1 [159,] 1 1 [160,] 2 2 [161,] 2 2 [162,] 1 1 [163,] 1 2 [164,] 2 2 [165,] 1 1 [166,] 2 1 [167,] 2 2 [168,] 1 2 [169,] 1 1 [170,] 2 2 [171,] 2 2 [172,] 2 2 [173,] 2 1 [174,] 2 2 [175,] 1 1 [176,] 1 1 [177,] 2 2 [178,] 1 1 [179,] 2 2 [180,] 1 1 [181,] 1 1 [182,] 1 1 [183,] 1 1 [184,] 2 2 [185,] 2 2 [186,] 1 1 [187,] 1 1 [188,] 1 1 [189,] 1 1 [190,] 1 1 [191,] 1 1 [192,] 1 1 [193,] 1 1 [194,] 1 1 [195,] 1 1 [196,] 1 1 [197,] 1 1 [ 7176,164709) [164709,385534] [ 7176,164709) 88 11 [164709,385534] 10 88 > postscript(file="/var/www/rcomp/tmp/45jrm1323963151.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/www/rcomp/tmp/5iiee1323963151.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/www/rcomp/tmp/6w9gd1323963151.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/www/rcomp/tmp/7o80r1323963151.tab") + } > > try(system("convert tmp/2r59u1323963151.ps tmp/2r59u1323963151.png",intern=TRUE)) character(0) > try(system("convert tmp/3o34o1323963151.ps tmp/3o34o1323963151.png",intern=TRUE)) character(0) > try(system("convert tmp/45jrm1323963151.ps tmp/45jrm1323963151.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.036 0.248 3.313