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(269998 + ,38 + ,116 + ,140824 + ,186099 + ,165 + ,176565 + ,34 + ,127 + ,110459 + ,113854 + ,132 + ,222373 + ,42 + ,106 + ,105079 + ,99776 + ,121 + ,218443 + ,38 + ,133 + ,112098 + ,106194 + ,145 + ,157206 + ,27 + ,64 + ,43929 + ,100792 + ,71 + ,70849 + ,35 + ,89 + ,76173 + ,47552 + ,47 + ,482608 + ,33 + ,122 + ,187326 + ,250931 + ,177 + ,33186 + ,18 + ,22 + ,22807 + ,6853 + ,5 + ,207822 + ,34 + ,117 + ,144408 + ,115466 + ,124 + ,211698 + ,33 + ,82 + ,66485 + ,110896 + ,92 + ,292874 + ,42 + ,136 + ,79089 + ,169351 + ,149 + ,235891 + ,55 + ,184 + ,81625 + ,94853 + ,93 + ,156623 + ,35 + ,106 + ,68788 + ,72591 + ,70 + ,344166 + ,52 + ,162 + ,103297 + ,101345 + ,148 + ,211787 + ,42 + ,86 + ,69446 + ,113713 + ,100 + ,369753 + ,59 + ,199 + ,114948 + ,165354 + ,142 + ,292100 + ,36 + ,139 + ,167949 + ,164263 + ,194 + ,315018 + ,39 + ,92 + ,125081 + ,135213 + ,113 + ,172883 + ,29 + ,85 + ,125818 + ,111669 + ,162 + ,256016 + ,46 + ,174 + ,136588 + ,134163 + ,186 + ,269240 + ,45 + ,148 + ,112431 + ,140303 + ,147 + ,425544 + ,39 + ,144 + ,103037 + ,150773 + ,137 + ,161962 + ,25 + ,84 + ,82317 + ,111848 + ,71 + ,189897 + ,52 + ,208 + ,118906 + ,102509 + ,123 + ,207445 + ,41 + ,144 + ,83515 + ,96785 + ,134 + ,203723 + ,38 + ,139 + ,104581 + ,116136 + ,115 + ,267198 + ,41 + ,127 + ,103129 + ,158376 + ,138 + ,263212 + ,39 + ,136 + ,83243 + ,153990 + ,125 + ,155915 + ,32 + ,99 + ,37110 + ,64057 + ,66 + ,326805 + ,41 + ,135 + ,113344 + ,230054 + ,137 + ,271661 + ,45 + ,165 + ,139165 + ,184531 + ,152 + ,197192 + ,47 + ,139 + ,86652 + ,114198 + ,159 + ,318563 + ,48 + ,178 + ,112302 + ,198299 + ,159 + ,97717 + ,37 + ,137 + ,69652 + ,33750 + ,31 + ,346931 + ,39 + ,148 + ,119442 + ,189723 + ,185 + ,273950 + ,42 + ,127 + ,69867 + ,100826 + ,78 + ,411809 + ,41 + ,141 + ,101629 + ,188355 + ,117 + ,208192 + ,36 + ,89 + ,70168 + ,104470 + ,109 + ,115469 + ,17 + ,46 + ,31081 + ,58391 + ,41 + ,328339 + ,39 + ,143 + ,103925 + ,164808 + ,149 + ,324178 + ,39 + ,122 + ,92622 + ,134097 + ,123 + ,157897 + ,38 + ,103 + ,79011 + ,80238 + ,103 + ,192883 + ,36 + ,108 + ,93487 + ,133252 + ,87 + ,173450 + ,42 + ,126 + ,64520 + ,54518 + ,71 + ,153778 + ,45 + ,45 + ,93473 + ,121850 + ,51 + ,445562 + ,38 + ,122 + ,114360 + ,79367 + ,70 + ,78800 + ,26 + ,66 + ,33032 + ,56968 + ,21 + ,208051 + ,52 + ,180 + ,96125 + ,106314 + ,155 + ,323152 + ,47 + ,165 + ,151911 + ,191889 + ,172 + ,175523 + ,45 + ,146 + ,89256 + ,104864 + ,133 + ,213050 + ,40 + ,137 + ,95671 + ,160791 + ,125 + ,24188 + ,4 + ,7 + ,5950 + ,15049 + ,7 + ,372225 + ,44 + ,157 + ,149695 + ,191179 + ,158 + ,65029 + ,18 + ,61 + ,32551 + ,25109 + ,21 + ,101097 + ,14 + ,41 + ,31701 + ,45824 + ,35 + ,269593 + ,37 + ,120 + ,100087 + ,129711 + ,133 + ,302218 + ,56 + ,208 + ,169707 + ,210012 + ,169 + ,315889 + ,36 + ,127 + ,150491 + ,194679 + ,256 + ,322546 + ,41 + ,147 + ,120192 + ,197680 + ,190 + ,246873 + ,36 + ,127 + ,95893 + ,81180 + ,100 + ,360665 + ,46 + ,161 + ,151715 + ,197765 + ,171 + ,296186 + ,28 + ,73 + ,176225 + ,214738 + ,267 + ,232391 + ,42 + ,94 + ,59900 + ,96252 + ,80 + ,254550 + ,42 + ,142 + ,104767 + ,124527 + ,126 + ,228595 + ,37 + ,125 + ,114799 + ,153242 + ,132 + ,216027 + ,30 + ,87 + ,72128 + ,145707 + ,121 + ,187959 + ,35 + ,128 + ,143592 + ,113963 + ,156 + ,227699 + ,44 + ,148 + ,89626 + ,134904 + ,133 + ,229698 + ,36 + ,116 + ,131072 + ,114268 + ,199 + ,166791 + ,28 + ,89 + ,126817 + ,94333 + ,98 + ,239277 + ,45 + ,154 + ,81351 + ,102204 + ,109 + ,73566 + ,23 + ,67 + ,22618 + ,23824 + ,25 + ,242498 + ,45 + ,171 + ,88977 + ,111563 + ,113 + ,187167 + ,38 + ,90 + ,92059 + ,91313 + ,126 + ,178281 + ,38 + ,133 + ,81897 + ,89770 + ,137 + ,349060 + ,42 + ,137 + ,108146 + ,100125 + ,121 + ,323126 + ,36 + ,133 + ,126372 + ,165278 + ,178 + ,206059 + ,41 + ,125 + ,249771 + ,181712 + ,63 + ,184970 + ,38 + ,134 + ,71154 + ,80906 + ,109 + ,168990 + ,37 + ,110 + ,71571 + ,75881 + ,101 + ,153613 + ,28 + ,89 + ,55918 + ,83963 + ,61 + ,429481 + ,45 + ,138 + ,160141 + ,175721 + ,157 + ,145919 + ,26 + ,99 + ,38692 + ,68580 + ,38 + ,280343 + ,44 + ,92 + ,102812 + ,136323 + ,159 + ,80953 + ,8 + ,27 + ,56622 + ,55792 + ,58 + ,148106 + ,27 + ,77 + ,15986 + ,25157 + ,27 + ,146777 + ,35 + ,127 + ,123534 + ,100922 + ,108 + ,336054 + ,37 + ,137 + ,108535 + ,118845 + ,83 + ,307486 + ,57 + ,122 + ,93879 + ,170492 + ,88 + ,178495 + ,41 + ,143 + ,144551 + ,81716 + ,164 + ,251466 + ,37 + ,85 + ,56750 + ,115750 + ,96 + ,230961 + ,38 + ,131 + ,127654 + ,105590 + ,192 + ,175244 + ,31 + ,90 + ,65594 + ,92795 + ,94 + ,261494 + ,36 + ,135 + ,59938 + ,82390 + ,107 + ,301883 + ,36 + ,132 + ,146975 + ,135599 + ,144 + ,189252 + ,36 + ,139 + ,143372 + ,111542 + ,123 + ,222504 + ,35 + ,127 + ,168553 + ,162519 + ,170 + ,278170 + ,39 + ,104 + ,183500 + ,211381 + ,210 + ,367723 + ,58 + ,221 + ,165986 + ,189944 + ,193 + ,392346 + ,30 + ,106 + ,184923 + ,226168 + ,297 + ,284676 + ,51 + ,176 + ,140358 + ,117495 + ,125 + ,273642 + ,41 + ,130 + ,149959 + ,195894 + ,204 + ,186856 + ,36 + ,59 + ,57224 + ,80684 + ,70 + ,43287 + ,19 + ,64 + ,43750 + ,19630 + ,49 + ,185302 + ,23 + ,36 + ,48029 + ,88634 + ,82 + ,203088 + ,40 + ,88 + ,104978 + ,139292 + ,205 + ,259692 + ,40 + ,125 + ,100046 + ,128602 + ,111 + ,301456 + ,40 + ,124 + ,101047 + ,135848 + ,135 + ,119969 + ,30 + ,83 + ,197426 + ,178377 + ,59 + ,153028 + ,41 + ,127 + ,160902 + ,106330 + ,70 + ,306952 + ,40 + ,143 + ,147172 + ,178303 + ,108 + ,297807 + ,45 + ,115 + ,109432 + ,116938 + ,141 + ,23623 + ,1 + ,0 + ,1168 + ,5841 + ,11 + ,175532 + ,36 + ,94 + ,83248 + ,106020 + ,130 + ,61857 + ,11 + ,30 + ,25162 + ,24610 + ,28 + ,163766 + ,45 + ,119 + ,45724 + ,74151 + ,101 + ,384053 + ,38 + ,102 + ,110529 + ,232241 + ,216 + ,21054 + ,0 + ,0 + ,855 + ,6622 + ,4 + ,252805 + ,30 + ,77 + ,101382 + ,127097 + ,97 + ,31961 + ,8 + ,9 + ,14116 + ,13155 + ,39 + ,294609 + ,39 + ,137 + ,89506 + ,160501 + ,119 + ,235069 + ,46 + ,157 + ,135356 + ,91502 + ,118 + ,174862 + ,48 + ,146 + ,116066 + ,24469 + ,41 + ,152043 + ,29 + ,84 + ,144244 + ,88229 + ,107 + ,38214 + ,8 + ,21 + ,8773 + ,13983 + ,16 + ,189451 + ,39 + ,139 + ,102153 + ,80716 + ,69 + ,344802 + ,47 + ,168 + ,117440 + ,157384 + ,160 + ,190943 + ,50 + ,163 + ,104128 + ,122975 + ,158 + ,396160 + ,48 + ,167 + ,134238 + ,191469 + ,161 + ,314212 + ,48 + ,145 + ,134047 + ,231257 + ,165 + ,396712 + ,50 + ,175 + ,279488 + ,258287 + ,246 + ,187992 + ,40 + ,137 + ,79756 + ,122531 + ,89 + ,102424 + ,36 + ,100 + ,66089 + ,61394 + ,49 + ,283392 + ,40 + ,150 + ,102070 + ,86480 + ,107 + ,401260 + ,46 + ,163 + ,146760 + ,195791 + ,182 + ,135936 + ,39 + ,137 + ,154771 + ,18284 + ,16 + ,373146 + ,42 + ,149 + ,165933 + ,147581 + ,173 + ,157429 + ,39 + ,112 + ,64593 + ,72558 + ,90 + ,236370 + ,41 + ,135 + ,92280 + ,147341 + ,140 + ,258959 + ,42 + ,114 + ,67150 + ,114651 + ,142 + ,214338 + ,32 + ,45 + ,128692 + ,100187 + ,126 + ,363154 + ,39 + ,120 + ,124089 + ,130332 + ,123 + ,232339 + ,36 + ,115 + ,125386 + ,134218 + ,239 + ,173260 + ,21 + ,78 + ,37238 + ,10901 + ,15 + ,317676 + ,45 + ,136 + ,140015 + ,145758 + ,170 + ,168994 + ,50 + ,179 + ,150047 + ,75767 + ,123 + ,233293 + ,36 + ,118 + ,154451 + ,134969 + ,151 + ,301585 + ,44 + ,147 + ,156349 + ,169216 + ,194 + ,216803 + ,37 + ,88 + ,84601 + ,105406 + ,122 + ,365230 + ,47 + ,115 + ,68946 + ,174586 + ,173 + ,46660 + ,5 + ,13 + ,6179 + ,21509 + ,13 + ,116678 + ,43 + ,76 + ,52789 + ,15673 + ,35 + ,195592 + ,31 + ,63 + ,100350 + ,75882 + ,72) + ,dim=c(6 + ,153) + ,dimnames=list(c('Total_Time_spent_in_RFC_in_seconds' + ,'Total_Number_of_Reviewed_Compendiums' + ,'Total_number_of_submitted_Feedback_Messages_in_Peer_Reviews_(+120characters)' + ,'Compendium_Writing_total_number_of_characters' + ,'Compendium_Writing_total_number_of_seconds' + ,'Compendium_Writing_total_number_of_included_blogs') + ,1:153)) > y <- array(NA,dim=c(6,153),dimnames=list(c('Total_Time_spent_in_RFC_in_seconds','Total_Number_of_Reviewed_Compendiums','Total_number_of_submitted_Feedback_Messages_in_Peer_Reviews_(+120characters)','Compendium_Writing_total_number_of_characters','Compendium_Writing_total_number_of_seconds','Compendium_Writing_total_number_of_included_blogs'),1:153)) > 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 = 'none' > par1 = '3' > 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] "Total_number_of_submitted_Feedback_Messages_in_Peer_Reviews_..120characters." > x[,par1] [1] 116 127 106 133 64 89 122 22 117 82 136 184 106 162 86 199 139 92 [19] 85 174 148 144 84 208 144 139 127 136 99 135 165 139 178 137 148 127 [37] 141 89 46 143 122 103 108 126 45 122 66 180 165 146 137 7 157 61 [55] 41 120 208 127 147 127 161 73 94 142 125 87 128 148 116 89 154 67 [73] 171 90 133 137 133 125 134 110 89 138 99 92 27 77 127 137 122 143 [91] 85 131 90 135 132 139 127 104 221 106 176 130 59 64 36 88 125 124 [109] 83 127 143 115 0 94 30 119 102 0 77 9 137 157 146 84 21 139 [127] 168 163 167 145 175 137 100 150 163 137 149 112 135 114 45 120 115 78 [145] 136 179 118 147 88 115 13 76 63 > 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 7 9 13 21 22 27 30 36 41 45 46 59 61 63 64 66 67 73 76 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 2 1 1 1 1 77 78 82 83 84 85 86 87 88 89 90 92 94 99 100 102 103 104 106 108 2 1 1 1 2 2 1 1 2 4 2 2 2 2 1 1 1 1 3 1 110 112 114 115 116 117 118 119 120 122 124 125 126 127 128 130 131 132 133 134 1 1 1 3 2 1 1 1 2 4 1 3 1 8 1 1 1 1 3 1 135 136 137 138 139 141 142 143 144 145 146 147 148 149 150 154 157 161 162 163 3 3 7 1 5 1 1 3 2 1 2 2 3 1 1 1 2 1 1 2 165 167 168 171 174 175 176 178 179 180 184 199 208 221 2 1 1 1 1 1 1 1 1 1 1 1 2 1 > colnames(x) [1] "Total_Time_spent_in_RFC_in_seconds" [2] "Total_Number_of_Reviewed_Compendiums" [3] "Total_number_of_submitted_Feedback_Messages_in_Peer_Reviews_..120characters." [4] "Compendium_Writing_total_number_of_characters" [5] "Compendium_Writing_total_number_of_seconds" [6] "Compendium_Writing_total_number_of_included_blogs" > colnames(x)[par1] [1] "Total_number_of_submitted_Feedback_Messages_in_Peer_Reviews_..120characters." > x[,par1] [1] 116 127 106 133 64 89 122 22 117 82 136 184 106 162 86 199 139 92 [19] 85 174 148 144 84 208 144 139 127 136 99 135 165 139 178 137 148 127 [37] 141 89 46 143 122 103 108 126 45 122 66 180 165 146 137 7 157 61 [55] 41 120 208 127 147 127 161 73 94 142 125 87 128 148 116 89 154 67 [73] 171 90 133 137 133 125 134 110 89 138 99 92 27 77 127 137 122 143 [91] 85 131 90 135 132 139 127 104 221 106 176 130 59 64 36 88 125 124 [109] 83 127 143 115 0 94 30 119 102 0 77 9 137 157 146 84 21 139 [127] 168 163 167 145 175 137 100 150 163 137 149 112 135 114 45 120 115 78 [145] 136 179 118 147 88 115 13 76 63 > 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/1txmw1324321752.tab") + } + } > m Conditional inference tree with 5 terminal nodes Response: Total_number_of_submitted_Feedback_Messages_in_Peer_Reviews_..120characters. Inputs: Total_Time_spent_in_RFC_in_seconds, Total_Number_of_Reviewed_Compendiums, Compendium_Writing_total_number_of_characters, Compendium_Writing_total_number_of_seconds, Compendium_Writing_total_number_of_included_blogs Number of observations: 153 1) Total_Number_of_Reviewed_Compendiums <= 32; criterion = 1, statistic = 115.493 2) Total_Number_of_Reviewed_Compendiums <= 18; criterion = 1, statistic = 26.03 3)* weights = 12 2) Total_Number_of_Reviewed_Compendiums > 18 4)* weights = 22 1) Total_Number_of_Reviewed_Compendiums > 32 5) Total_Number_of_Reviewed_Compendiums <= 45; criterion = 1, statistic = 50 6) Total_Time_spent_in_RFC_in_seconds <= 233293; criterion = 0.995, statistic = 10.958 7)* weights = 47 6) Total_Time_spent_in_RFC_in_seconds > 233293 8)* weights = 48 5) Total_Number_of_Reviewed_Compendiums > 45 9)* weights = 24 > postscript(file="/var/wessaorg/rcomp/tmp/272ia1324321752.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/3jd641324321752.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) + } Actuals Forecasts Residuals 1 116 131.83333 -15.8333333 2 127 114.87234 12.1276596 3 106 114.87234 -8.8723404 4 133 114.87234 18.1276596 5 64 77.50000 -13.5000000 6 89 114.87234 -25.8723404 7 122 131.83333 -9.8333333 8 22 23.08333 -1.0833333 9 117 114.87234 2.1276596 10 82 114.87234 -32.8723404 11 136 131.83333 4.1666667 12 184 168.95833 15.0416667 13 106 114.87234 -8.8723404 14 162 168.95833 -6.9583333 15 86 114.87234 -28.8723404 16 199 168.95833 30.0416667 17 139 131.83333 7.1666667 18 92 131.83333 -39.8333333 19 85 77.50000 7.5000000 20 174 168.95833 5.0416667 21 148 131.83333 16.1666667 22 144 131.83333 12.1666667 23 84 77.50000 6.5000000 24 208 168.95833 39.0416667 25 144 114.87234 29.1276596 26 139 114.87234 24.1276596 27 127 131.83333 -4.8333333 28 136 131.83333 4.1666667 29 99 77.50000 21.5000000 30 135 131.83333 3.1666667 31 165 131.83333 33.1666667 32 139 168.95833 -29.9583333 33 178 168.95833 9.0416667 34 137 114.87234 22.1276596 35 148 131.83333 16.1666667 36 127 131.83333 -4.8333333 37 141 131.83333 9.1666667 38 89 114.87234 -25.8723404 39 46 23.08333 22.9166667 40 143 131.83333 11.1666667 41 122 131.83333 -9.8333333 42 103 114.87234 -11.8723404 43 108 114.87234 -6.8723404 44 126 114.87234 11.1276596 45 45 114.87234 -69.8723404 46 122 131.83333 -9.8333333 47 66 77.50000 -11.5000000 48 180 168.95833 11.0416667 49 165 168.95833 -3.9583333 50 146 114.87234 31.1276596 51 137 114.87234 22.1276596 52 7 23.08333 -16.0833333 53 157 131.83333 25.1666667 54 61 23.08333 37.9166667 55 41 23.08333 17.9166667 56 120 131.83333 -11.8333333 57 208 168.95833 39.0416667 58 127 131.83333 -4.8333333 59 147 131.83333 15.1666667 60 127 131.83333 -4.8333333 61 161 168.95833 -7.9583333 62 73 77.50000 -4.5000000 63 94 114.87234 -20.8723404 64 142 131.83333 10.1666667 65 125 114.87234 10.1276596 66 87 77.50000 9.5000000 67 128 114.87234 13.1276596 68 148 114.87234 33.1276596 69 116 114.87234 1.1276596 70 89 77.50000 11.5000000 71 154 131.83333 22.1666667 72 67 77.50000 -10.5000000 73 171 131.83333 39.1666667 74 90 114.87234 -24.8723404 75 133 114.87234 18.1276596 76 137 131.83333 5.1666667 77 133 131.83333 1.1666667 78 125 114.87234 10.1276596 79 134 114.87234 19.1276596 80 110 114.87234 -4.8723404 81 89 77.50000 11.5000000 82 138 131.83333 6.1666667 83 99 77.50000 21.5000000 84 92 131.83333 -39.8333333 85 27 23.08333 3.9166667 86 77 77.50000 -0.5000000 87 127 114.87234 12.1276596 88 137 131.83333 5.1666667 89 122 168.95833 -46.9583333 90 143 114.87234 28.1276596 91 85 131.83333 -46.8333333 92 131 114.87234 16.1276596 93 90 77.50000 12.5000000 94 135 131.83333 3.1666667 95 132 131.83333 0.1666667 96 139 114.87234 24.1276596 97 127 114.87234 12.1276596 98 104 131.83333 -27.8333333 99 221 168.95833 52.0416667 100 106 77.50000 28.5000000 101 176 168.95833 7.0416667 102 130 131.83333 -1.8333333 103 59 114.87234 -55.8723404 104 64 77.50000 -13.5000000 105 36 77.50000 -41.5000000 106 88 114.87234 -26.8723404 107 125 131.83333 -6.8333333 108 124 131.83333 -7.8333333 109 83 77.50000 5.5000000 110 127 114.87234 12.1276596 111 143 131.83333 11.1666667 112 115 131.83333 -16.8333333 113 0 23.08333 -23.0833333 114 94 114.87234 -20.8723404 115 30 23.08333 6.9166667 116 119 114.87234 4.1276596 117 102 131.83333 -29.8333333 118 0 23.08333 -23.0833333 119 77 77.50000 -0.5000000 120 9 23.08333 -14.0833333 121 137 131.83333 5.1666667 122 157 168.95833 -11.9583333 123 146 168.95833 -22.9583333 124 84 77.50000 6.5000000 125 21 23.08333 -2.0833333 126 139 114.87234 24.1276596 127 168 168.95833 -0.9583333 128 163 168.95833 -5.9583333 129 167 168.95833 -1.9583333 130 145 168.95833 -23.9583333 131 175 168.95833 6.0416667 132 137 114.87234 22.1276596 133 100 114.87234 -14.8723404 134 150 131.83333 18.1666667 135 163 168.95833 -5.9583333 136 137 114.87234 22.1276596 137 149 131.83333 17.1666667 138 112 114.87234 -2.8723404 139 135 131.83333 3.1666667 140 114 131.83333 -17.8333333 141 45 77.50000 -32.5000000 142 120 131.83333 -11.8333333 143 115 114.87234 0.1276596 144 78 77.50000 0.5000000 145 136 131.83333 4.1666667 146 179 168.95833 10.0416667 147 118 114.87234 3.1276596 148 147 131.83333 15.1666667 149 88 114.87234 -26.8723404 150 115 168.95833 -53.9583333 151 13 23.08333 -10.0833333 152 76 114.87234 -38.8723404 153 63 77.50000 -14.5000000 > if (par2 != 'none') { + print(cbind(as.factor(x[,par1]),predict(m))) + myt <- table(as.factor(x[,par1]),predict(m)) + print(myt) + } > postscript(file="/var/wessaorg/rcomp/tmp/4e0we1324321752.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/5r4ck1324321752.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/687m81324321752.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/7a2931324321752.tab") + } > > try(system("convert tmp/272ia1324321752.ps tmp/272ia1324321752.png",intern=TRUE)) character(0) > try(system("convert tmp/3jd641324321752.ps tmp/3jd641324321752.png",intern=TRUE)) character(0) > try(system("convert tmp/4e0we1324321752.ps tmp/4e0we1324321752.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.276 0.293 3.561