R version 2.12.0 (2010-10-15) 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(140824 + ,96 + ,275243 + ,151 + ,71 + ,32033 + ,110459 + ,71 + ,180141 + ,133 + ,66 + ,20654 + ,105079 + ,70 + ,228925 + ,170 + ,75 + ,16346 + ,112098 + ,134 + ,218443 + ,148 + ,104 + ,35926 + ,43929 + ,67 + ,171533 + ,88 + ,52 + ,10621 + ,76173 + ,8 + ,70849 + ,129 + ,28 + ,10024 + ,187326 + ,160 + ,532492 + ,128 + ,125 + ,43068 + ,22807 + ,1 + ,33186 + ,67 + ,19 + ,1271 + ,144408 + ,83 + ,217320 + ,132 + ,59 + ,34416 + ,66485 + ,82 + ,213274 + ,120 + ,44 + ,20318 + ,79089 + ,92 + ,309323 + ,169 + ,111 + ,24409 + ,81625 + ,117 + ,242739 + ,218 + ,122 + ,20648 + ,68788 + ,56 + ,194882 + ,122 + ,76 + ,12347 + ,103297 + ,139 + ,364569 + ,191 + ,81 + ,21857 + ,69446 + ,80 + ,255231 + ,162 + ,86 + ,11034 + ,114948 + ,176 + ,391748 + ,227 + ,181 + ,33433 + ,167949 + ,114 + ,334118 + ,156 + ,75 + ,35902 + ,125081 + ,105 + ,374892 + ,144 + ,163 + ,22355 + ,125818 + ,103 + ,176082 + ,111 + ,56 + ,31219 + ,136588 + ,135 + ,266736 + ,199 + ,87 + ,21983 + ,112431 + ,123 + ,278265 + ,187 + ,70 + ,40085 + ,103037 + ,87 + ,442703 + ,144 + ,104 + ,18507 + ,82317 + ,66 + ,180393 + ,89 + ,42 + ,16278 + ,118906 + ,103 + ,189897 + ,208 + ,55 + ,24662 + ,83515 + ,149 + ,242176 + ,165 + ,125 + ,31452 + ,104581 + ,113 + ,241883 + ,146 + ,129 + ,32580 + ,103129 + ,99 + ,267318 + ,158 + ,129 + ,22883 + ,83243 + ,117 + ,277501 + ,154 + ,88 + ,27652 + ,37110 + ,57 + ,155915 + ,117 + ,52 + ,9845 + ,113344 + ,141 + ,365373 + ,158 + ,72 + ,20190 + ,139165 + ,130 + ,291907 + ,195 + ,80 + ,46201 + ,86652 + ,50 + ,247188 + ,186 + ,81 + ,10971 + ,112302 + ,140 + ,342856 + ,197 + ,95 + ,34811 + ,69652 + ,43 + ,101014 + ,141 + ,39 + ,3029 + ,119442 + ,141 + ,409551 + ,168 + ,100 + ,38941 + ,69867 + ,83 + ,273950 + ,159 + ,56 + ,4958 + ,101629 + ,112 + ,425253 + ,161 + ,122 + ,32344 + ,70168 + ,79 + ,227636 + ,139 + ,84 + ,19433 + ,31081 + ,33 + ,115658 + ,55 + ,33 + ,12558 + ,103925 + ,137 + ,375992 + ,166 + ,201 + ,36524 + ,92622 + ,125 + ,334004 + ,151 + ,82 + ,26041 + ,79011 + ,76 + ,186648 + ,148 + ,71 + ,16637 + ,93487 + ,78 + ,206196 + ,115 + ,76 + ,28395 + ,64520 + ,68 + ,182286 + ,181 + ,64 + ,16747 + ,93473 + ,50 + ,153778 + ,73 + ,82 + ,9105 + ,114360 + ,101 + ,455401 + ,147 + ,153 + ,11941 + ,33032 + ,20 + ,78800 + ,82 + ,42 + ,7935 + ,96125 + ,101 + ,208277 + ,201 + ,77 + ,19499 + ,151911 + ,149 + ,358127 + ,193 + ,121 + ,22938 + ,89256 + ,108 + ,182715 + ,164 + ,60 + ,25314 + ,95676 + ,95 + ,224649 + ,158 + ,76 + ,28527 + ,5950 + ,8 + ,24188 + ,12 + ,24 + ,2694 + ,149695 + ,88 + ,380576 + ,163 + ,326 + ,20867 + ,32551 + ,21 + ,65029 + ,67 + ,17 + ,3597 + ,31701 + ,30 + ,101097 + ,52 + ,64 + ,5296 + ,100087 + ,97 + ,279128 + ,134 + ,60 + ,32982 + ,169707 + ,130 + ,328024 + ,230 + ,86 + ,38975 + ,150491 + ,132 + ,359138 + ,145 + ,198 + ,42721 + ,120192 + ,161 + ,369539 + ,153 + ,145 + ,41455 + ,95893 + ,89 + ,266240 + ,155 + ,86 + ,23923 + ,151715 + ,160 + ,389724 + ,198 + ,147 + ,26719 + ,176225 + ,139 + ,305351 + ,101 + ,119 + ,53405 + ,59900 + ,104 + ,281929 + ,169 + ,118 + ,12526 + ,104767 + ,92 + ,264889 + ,163 + ,89 + ,26584 + ,114799 + ,52 + ,229585 + ,139 + ,68 + ,37062 + ,72128 + ,117 + ,235052 + ,116 + ,68 + ,25696 + ,143592 + ,93 + ,209030 + ,145 + ,135 + ,24634 + ,89626 + ,85 + ,240070 + ,167 + ,151 + ,27269 + ,131072 + ,143 + ,243937 + ,135 + ,84 + ,25270 + ,126817 + ,143 + ,175816 + ,102 + ,70 + ,24634 + ,81351 + ,99 + ,239337 + ,173 + ,70 + ,17828 + ,22618 + ,22 + ,73566 + ,88 + ,32 + ,3007 + ,88977 + ,78 + ,242622 + ,175 + ,86 + ,20065 + ,92059 + ,83 + ,196387 + ,133 + ,55 + ,24648 + ,81897 + ,131 + ,209049 + ,148 + ,64 + ,21588 + ,108146 + ,140 + ,363250 + ,169 + ,88 + ,25217 + ,126372 + ,148 + ,362030 + ,143 + ,96 + ,30927 + ,249771 + ,80 + ,217036 + ,154 + ,108 + ,18487 + ,71154 + ,133 + ,212643 + ,164 + ,66 + ,18050 + ,71571 + ,97 + ,202011 + ,146 + ,67 + ,17696 + ,55918 + ,62 + ,153654 + ,109 + ,48 + ,17326 + ,160141 + ,161 + ,475859 + ,175 + ,128 + ,39361 + ,38692 + ,30 + ,145943 + ,99 + ,69 + ,9648 + ,102812 + ,118 + ,287359 + ,122 + ,106 + ,26759 + ,56622 + ,49 + ,80953 + ,28 + ,25 + ,7905 + ,15986 + ,52 + ,150216 + ,101 + ,55 + ,4527 + ,123534 + ,76 + ,179317 + ,139 + ,60 + ,41517 + ,108535 + ,85 + ,394546 + ,143 + ,213 + ,21261 + ,93879 + ,146 + ,345373 + ,206 + ,120 + ,36099 + ,144551 + ,165 + ,179811 + ,171 + ,106 + ,39039 + ,56750 + ,84 + ,283459 + ,150 + ,100 + ,13841 + ,127654 + ,165 + ,274449 + ,154 + ,81 + ,23841 + ,65594 + ,48 + ,190312 + ,114 + ,65 + ,8589 + ,59938 + ,149 + ,280628 + ,140 + ,77 + ,15049 + ,146975 + ,75 + ,329007 + ,156 + ,85 + ,39038 + ,166616 + ,83 + ,194106 + ,156 + ,40 + ,36918 + ,168553 + ,110 + ,259365 + ,127 + ,59 + ,39932 + ,183500 + ,164 + ,297464 + ,141 + ,83 + ,43840 + ,165986 + ,154 + ,399815 + ,251 + ,155 + ,43146 + ,184923 + ,165 + ,402133 + ,126 + ,113 + ,50099 + ,140358 + ,121 + ,291970 + ,198 + ,138 + ,40312 + ,149959 + ,150 + ,296670 + ,155 + ,67 + ,32616 + ,57224 + ,73 + ,189276 + ,138 + ,188 + ,11338 + ,43750 + ,13 + ,43287 + ,71 + ,14 + ,7409 + ,48029 + ,89 + ,185969 + ,84 + ,83 + ,18213 + ,104978 + ,105 + ,250254 + ,167 + ,148 + ,45873 + ,100046 + ,129 + ,268391 + ,155 + ,50 + ,39844 + ,101047 + ,169 + ,314131 + ,162 + ,92 + ,28317 + ,197426 + ,28 + ,156967 + ,112 + ,81 + ,24797 + ,160902 + ,118 + ,161884 + ,168 + ,97 + ,7471 + ,147172 + ,79 + ,334485 + ,157 + ,74 + ,27259 + ,109432 + ,147 + ,300526 + ,164 + ,89 + ,23201 + ,1168 + ,12 + ,23623 + ,0 + ,11 + ,238 + ,83248 + ,146 + ,195817 + ,155 + ,73 + ,28830 + ,25162 + ,23 + ,61857 + ,32 + ,25 + ,3913 + ,45724 + ,83 + ,163871 + ,169 + ,50 + ,9935 + ,110529 + ,163 + ,428191 + ,140 + ,120 + ,27738 + ,855 + ,4 + ,21054 + ,0 + ,16 + ,338 + ,101382 + ,81 + ,252805 + ,111 + ,52 + ,13326 + ,14116 + ,18 + ,31961 + ,25 + ,22 + ,3988 + ,89506 + ,114 + ,333052 + ,152 + ,119 + ,24347 + ,135356 + ,76 + ,243223 + ,183 + ,68 + ,27111 + ,116066 + ,55 + ,177264 + ,181 + ,93 + ,3938 + ,144244 + ,44 + ,152043 + ,107 + ,54 + ,17416 + ,8773 + ,16 + ,38214 + ,27 + ,34 + ,1888 + ,102153 + ,81 + ,224597 + ,163 + ,43 + ,18700 + ,117440 + ,137 + ,357602 + ,198 + ,82 + ,36809 + ,104128 + ,50 + ,198104 + ,205 + ,61 + ,24959 + ,134238 + ,142 + ,423741 + ,187 + ,85 + ,37343 + ,134047 + ,157 + ,338606 + ,187 + ,99 + ,21849 + ,279488 + ,141 + ,417175 + ,210 + ,129 + ,49809 + ,79756 + ,71 + ,190323 + ,151 + ,37 + ,21654 + ,66089 + ,42 + ,102424 + ,131 + ,43 + ,8728 + ,102070 + ,94 + ,302158 + ,171 + ,347 + ,20920 + ,146760 + ,117 + ,437141 + ,172 + ,182 + ,27195 + ,154771 + ,63 + ,146250 + ,164 + ,56 + ,1037 + ,165933 + ,127 + ,395382 + ,172 + ,134 + ,42570 + ,64593 + ,55 + ,162575 + ,143 + ,79 + ,17672 + ,92280 + ,117 + ,278077 + ,151 + ,49 + ,34245 + ,67150 + ,110 + ,282410 + ,158 + ,96 + ,16786 + ,128692 + ,39 + ,219493 + ,125 + ,115 + ,20954 + ,124089 + ,95 + ,384177 + ,169 + ,122 + ,16378 + ,125386 + ,128 + ,246963 + ,145 + ,92 + ,31852 + ,37238 + ,41 + ,173260 + ,79 + ,63 + ,2805 + ,140015 + ,146 + ,333967 + ,190 + ,103 + ,38086 + ,150047 + ,147 + ,168994 + ,192 + ,58 + ,21166 + ,154451 + ,119 + ,253330 + ,132 + ,87 + ,34672 + ,156349 + ,185 + ,305217 + ,168 + ,109 + ,36171 + ,0 + ,0 + ,1 + ,0 + ,0 + ,0 + ,6023 + ,4 + ,14688 + ,0 + ,10 + ,2065 + ,0 + ,0 + ,98 + ,0 + ,1 + ,0 + ,0 + ,0 + ,455 + ,0 + ,2 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,84601 + ,75 + ,260345 + ,133 + ,88 + ,19354 + ,68946 + ,157 + ,409163 + ,204 + ,162 + ,22124 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,203 + ,0 + ,4 + ,0 + ,1644 + ,7 + ,7199 + ,0 + ,5 + ,556 + ,6179 + ,12 + ,46660 + ,15 + ,20 + ,2089 + ,3926 + ,0 + ,17547 + ,4 + ,5 + ,2658 + ,52789 + ,37 + ,116969 + ,152 + ,45 + ,1813 + ,0 + ,0 + ,969 + ,0 + ,2 + ,0 + ,100350 + ,59 + ,229447 + ,125 + ,70 + ,17372) + ,dim=c(6 + ,164) + ,dimnames=list(c('#characters' + ,'bloggedcomputations' + ,'totalseconds' + ,'PeerReviews' + ,'#logins' + ,'') + ,1:164)) > y <- array(NA,dim=c(6,164),dimnames=list(c('#characters','bloggedcomputations','totalseconds','PeerReviews','#logins',''),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 = 'equal' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Dr. Ian E. Holliday > #To cite this work: Ian E. Holliday, 2009, YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: > #Technical description: > 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] "X.characters" > x[,par1] [1] 140824 110459 105079 112098 43929 76173 187326 22807 144408 66485 [11] 79089 81625 68788 103297 69446 114948 167949 125081 125818 136588 [21] 112431 103037 82317 118906 83515 104581 103129 83243 37110 113344 [31] 139165 86652 112302 69652 119442 69867 101629 70168 31081 103925 [41] 92622 79011 93487 64520 93473 114360 33032 96125 151911 89256 [51] 95676 5950 149695 32551 31701 100087 169707 150491 120192 95893 [61] 151715 176225 59900 104767 114799 72128 143592 89626 131072 126817 [71] 81351 22618 88977 92059 81897 108146 126372 249771 71154 71571 [81] 55918 160141 38692 102812 56622 15986 123534 108535 93879 144551 [91] 56750 127654 65594 59938 146975 166616 168553 183500 165986 184923 [101] 140358 149959 57224 43750 48029 104978 100046 101047 197426 160902 [111] 147172 109432 1168 83248 25162 45724 110529 855 101382 14116 [121] 89506 135356 116066 144244 8773 102153 117440 104128 134238 134047 [131] 279488 79756 66089 102070 146760 154771 165933 64593 92280 67150 [141] 128692 124089 125386 37238 140015 150047 154451 156349 0 6023 [151] 0 0 0 0 84601 68946 0 0 1644 6179 [161] 3926 52789 0 100350 > 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]) C1 C2 130 34 > colnames(x) [1] "X.characters" "bloggedcomputations" "totalseconds" [4] "PeerReviews" "X.logins" "V6" > colnames(x)[par1] [1] "X.characters" > x[,par1] [1] C2 C1 C1 C1 C1 C1 C2 C1 C2 C1 C1 C1 C1 C1 C1 C1 C2 C1 C1 C1 C1 C1 C1 C1 C1 [26] C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C2 C1 [51] C1 C1 C2 C1 C1 C1 C2 C2 C1 C1 C2 C2 C1 C1 C1 C1 C2 C1 C1 C1 C1 C1 C1 C1 C1 [76] C1 C1 C2 C1 C1 C1 C2 C1 C1 C1 C1 C1 C1 C1 C2 C1 C1 C1 C1 C2 C2 C2 C2 C2 C2 [101] C2 C2 C1 C1 C1 C1 C1 C1 C2 C2 C2 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C2 C1 [126] C1 C1 C1 C1 C1 C2 C1 C1 C1 C2 C2 C2 C1 C1 C1 C1 C1 C1 C1 C2 C2 C2 C2 C1 C1 [151] C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 Levels: C1 C2 > 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/1n3bk1324651707.tab") + } + } m.ct.i.pred m.ct.i.actu 1 2 1 1079 96 2 139 167 [1] 0.9182979 [1] 0.5457516 [1] 0.8413234 m.ct.x.pred m.ct.x.actu 1 2 1 109 16 2 22 12 [1] 0.872 [1] 0.3529412 [1] 0.7610063 > m Conditional inference tree with 3 terminal nodes Response: as.factor(X.characters) Inputs: bloggedcomputations, totalseconds, PeerReviews, X.logins, V6 Number of observations: 164 1) V6 <= 34245; criterion = 1, statistic = 32.556 2) X.logins <= 129; criterion = 0.963, statistic = 7.124 3)* weights = 118 2) X.logins > 129 4)* weights = 12 1) V6 > 34245 5)* weights = 34 > postscript(file="/var/www/rcomp/tmp/24v111324651707.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/3rwej1324651707.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 1 [2,] 1 1 [3,] 1 1 [4,] 1 2 [5,] 1 1 [6,] 1 1 [7,] 2 2 [8,] 1 1 [9,] 2 2 [10,] 1 1 [11,] 1 1 [12,] 1 1 [13,] 1 1 [14,] 1 1 [15,] 1 1 [16,] 1 1 [17,] 2 2 [18,] 1 1 [19,] 1 1 [20,] 1 1 [21,] 1 2 [22,] 1 1 [23,] 1 1 [24,] 1 1 [25,] 1 1 [26,] 1 1 [27,] 1 1 [28,] 1 1 [29,] 1 1 [30,] 1 1 [31,] 1 2 [32,] 1 1 [33,] 1 2 [34,] 1 1 [35,] 1 2 [36,] 1 1 [37,] 1 1 [38,] 1 1 [39,] 1 1 [40,] 1 2 [41,] 1 1 [42,] 1 1 [43,] 1 1 [44,] 1 1 [45,] 1 1 [46,] 1 1 [47,] 1 1 [48,] 1 1 [49,] 2 1 [50,] 1 1 [51,] 1 1 [52,] 1 1 [53,] 2 1 [54,] 1 1 [55,] 1 1 [56,] 1 1 [57,] 2 2 [58,] 2 2 [59,] 1 2 [60,] 1 1 [61,] 2 1 [62,] 2 2 [63,] 1 1 [64,] 1 1 [65,] 1 2 [66,] 1 1 [67,] 2 1 [68,] 1 1 [69,] 1 1 [70,] 1 1 [71,] 1 1 [72,] 1 1 [73,] 1 1 [74,] 1 1 [75,] 1 1 [76,] 1 1 [77,] 1 1 [78,] 2 1 [79,] 1 1 [80,] 1 1 [81,] 1 1 [82,] 2 2 [83,] 1 1 [84,] 1 1 [85,] 1 1 [86,] 1 1 [87,] 1 2 [88,] 1 1 [89,] 1 2 [90,] 2 2 [91,] 1 1 [92,] 1 1 [93,] 1 1 [94,] 1 1 [95,] 2 2 [96,] 2 2 [97,] 2 2 [98,] 2 2 [99,] 2 2 [100,] 2 2 [101,] 2 2 [102,] 2 1 [103,] 1 1 [104,] 1 1 [105,] 1 1 [106,] 1 2 [107,] 1 2 [108,] 1 1 [109,] 2 1 [110,] 2 1 [111,] 2 1 [112,] 1 1 [113,] 1 1 [114,] 1 1 [115,] 1 1 [116,] 1 1 [117,] 1 1 [118,] 1 1 [119,] 1 1 [120,] 1 1 [121,] 1 1 [122,] 1 1 [123,] 1 1 [124,] 2 1 [125,] 1 1 [126,] 1 1 [127,] 1 2 [128,] 1 1 [129,] 1 2 [130,] 1 1 [131,] 2 2 [132,] 1 1 [133,] 1 1 [134,] 1 1 [135,] 2 1 [136,] 2 1 [137,] 2 2 [138,] 1 1 [139,] 1 1 [140,] 1 1 [141,] 1 1 [142,] 1 1 [143,] 1 1 [144,] 1 1 [145,] 2 2 [146,] 2 1 [147,] 2 2 [148,] 2 2 [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 C1 C2 C1 116 14 C2 14 20 > postscript(file="/var/www/rcomp/tmp/4wmx81324651707.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/5bxuy1324651707.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/6egpl1324651707.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/7i4ck1324651707.tab") + } > > try(system("convert tmp/24v111324651707.ps tmp/24v111324651707.png",intern=TRUE)) character(0) > try(system("convert tmp/3rwej1324651707.ps tmp/3rwej1324651707.png",intern=TRUE)) character(0) > try(system("convert tmp/4wmx81324651707.ps tmp/4wmx81324651707.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.680 0.070 2.763