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(129404 + ,20 + ,18158 + ,5636 + ,22622 + ,30 + ,28 + ,130358 + ,38 + ,30461 + ,9079 + ,73570 + ,42 + ,39 + ,7215 + ,0 + ,1423 + ,603 + ,1929 + ,0 + ,0 + ,112861 + ,49 + ,25629 + ,8874 + ,36294 + ,54 + ,54 + ,219904 + ,76 + ,48758 + ,17988 + ,62378 + ,86 + ,80 + ,396382 + ,104 + ,129230 + ,21325 + ,167760 + ,157 + ,144 + ,117604 + ,37 + ,27376 + ,8325 + ,52443 + ,36 + ,36 + ,126737 + ,53 + ,26706 + ,7117 + ,57283 + ,48 + ,48 + ,99729 + ,42 + ,26505 + ,7996 + ,36614 + ,45 + ,42 + ,256310 + ,62 + ,49801 + ,14218 + ,93268 + ,77 + ,71 + ,113066 + ,50 + ,46580 + ,6321 + ,35439 + ,49 + ,49 + ,157228 + ,65 + ,48352 + ,19690 + ,72405 + ,77 + ,74 + ,69952 + ,28 + ,13899 + ,5659 + ,24044 + ,28 + ,27 + ,152673 + ,48 + ,39342 + ,11370 + ,55909 + ,84 + ,83 + ,130642 + ,42 + ,27465 + ,4778 + ,44689 + ,31 + ,31 + ,125769 + ,47 + ,55211 + ,5954 + ,49319 + ,28 + ,28 + ,123467 + ,71 + ,74098 + ,22924 + ,62075 + ,99 + ,98 + ,56232 + ,0 + ,13497 + ,70 + ,2341 + ,2 + ,2 + ,108330 + ,50 + ,38338 + ,14369 + ,40551 + ,41 + ,43 + ,22762 + ,12 + ,52505 + ,3706 + ,11621 + ,25 + ,24 + ,48554 + ,16 + ,10663 + ,3147 + ,18741 + ,16 + ,16 + ,182081 + ,77 + ,74484 + ,16801 + ,84202 + ,96 + ,95 + ,140857 + ,29 + ,28895 + ,2162 + ,15334 + ,23 + ,22 + ,93773 + ,38 + ,32827 + ,4721 + ,28024 + ,33 + ,33 + ,133398 + ,50 + ,36188 + ,5290 + ,53306 + ,46 + ,45 + ,113933 + ,33 + ,28173 + ,6446 + ,37918 + ,59 + ,59 + ,153851 + ,49 + ,54926 + ,14711 + ,54819 + ,72 + ,66 + ,140711 + ,59 + ,38900 + ,13311 + ,89058 + ,72 + ,70 + ,303804 + ,55 + ,88530 + ,13577 + ,103354 + ,62 + ,56 + ,161651 + ,40 + ,35482 + ,14634 + ,70239 + ,55 + ,55 + ,123344 + ,40 + ,26730 + ,6931 + ,33045 + ,27 + ,27 + ,157640 + ,51 + ,29806 + ,9992 + ,63852 + ,41 + ,37 + ,91279 + ,41 + ,41799 + ,6185 + ,30905 + ,51 + ,48 + ,189374 + ,73 + ,54289 + ,3445 + ,24242 + ,26 + ,26 + ,178768 + ,51 + ,36805 + ,12327 + ,78907 + ,65 + ,64 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,175403 + ,46 + ,33146 + ,9898 + ,36005 + ,28 + ,21 + ,92342 + ,44 + ,23333 + ,8022 + ,31972 + ,44 + ,44 + ,100023 + ,31 + ,47686 + ,10765 + ,35853 + ,36 + ,36 + ,178277 + ,71 + ,77783 + ,22717 + ,115301 + ,100 + ,89 + ,145062 + ,61 + ,36042 + ,10090 + ,47689 + ,104 + ,101 + ,110980 + ,28 + ,34541 + ,12385 + ,34223 + ,35 + ,31 + ,86039 + ,21 + ,75620 + ,8513 + ,43431 + ,69 + ,65 + ,125481 + ,42 + ,60610 + ,5508 + ,52220 + ,73 + ,71 + ,95535 + ,44 + ,55041 + ,9628 + ,33863 + ,106 + ,102 + ,126456 + ,40 + ,32087 + ,11872 + ,46879 + ,53 + ,53 + ,61554 + ,15 + ,16356 + ,4186 + ,23228 + ,43 + ,41 + ,164752 + ,46 + ,40161 + ,10877 + ,42827 + ,49 + ,46 + ,159121 + ,43 + ,55459 + ,17066 + ,65765 + ,38 + ,37 + ,129362 + ,47 + ,36679 + ,9175 + ,38167 + ,51 + ,51 + ,48188 + ,12 + ,22346 + ,2102 + ,14812 + ,14 + ,14 + ,95461 + ,46 + ,27377 + ,10807 + ,32615 + ,40 + ,40 + ,229864 + ,56 + ,50273 + ,13662 + ,82188 + ,79 + ,77 + ,191094 + ,47 + ,32104 + ,9224 + ,51763 + ,52 + ,51 + ,150640 + ,48 + ,27016 + ,9001 + ,59325 + ,44 + ,43 + ,111388 + ,35 + ,19715 + ,7204 + ,48976 + ,34 + ,33 + ,165098 + ,44 + ,33629 + ,6572 + ,43384 + ,47 + ,47 + ,63205 + ,25 + ,27084 + ,7509 + ,26692 + ,32 + ,31 + ,109102 + ,47 + ,32352 + ,12920 + ,53279 + ,31 + ,31 + ,137303 + ,28 + ,51845 + ,5438 + ,20652 + ,40 + ,40 + ,125304 + ,48 + ,26591 + ,11489 + ,38338 + ,42 + ,42 + ,85332 + ,32 + ,29677 + ,6661 + ,36735 + ,34 + ,35 + ,95808 + ,28 + ,54237 + ,7941 + ,42764 + ,40 + ,40 + ,83419 + ,31 + ,20284 + ,6173 + ,44331 + ,35 + ,30 + ,101723 + ,13 + ,22741 + ,5562 + ,41354 + ,11 + ,11 + ,94982 + ,38 + ,34178 + ,9492 + ,47879 + ,43 + ,41 + ,129700 + ,39 + ,69551 + ,17456 + ,103793 + ,53 + ,53 + ,113325 + ,68 + ,29653 + ,9422 + ,52235 + ,82 + ,82 + ,81518 + ,32 + ,38071 + ,10913 + ,49825 + ,41 + ,41 + ,31970 + ,5 + ,4157 + ,1283 + ,4105 + ,6 + ,6 + ,192268 + ,53 + ,28321 + ,6198 + ,58687 + ,82 + ,81 + ,91086 + ,33 + ,40195 + ,4501 + ,40745 + ,47 + ,47 + ,80820 + ,54 + ,48158 + ,9560 + ,33187 + ,108 + ,100 + ,83261 + ,36 + ,13310 + ,3394 + ,14063 + ,46 + ,46 + ,116290 + ,52 + ,78474 + ,9871 + ,37407 + ,38 + ,38 + ,56544 + ,0 + ,6386 + ,2419 + ,7190 + ,0 + ,0 + ,116173 + ,52 + ,31588 + ,10630 + ,49562 + ,45 + ,45 + ,111488 + ,45 + ,61254 + ,8536 + ,76324 + ,57 + ,56 + ,60138 + ,16 + ,21152 + ,4911 + ,21928 + ,20 + ,18 + ,73422 + ,33 + ,41272 + ,9775 + ,27860 + ,56 + ,54 + ,67751 + ,48 + ,34165 + ,11227 + ,28078 + ,38 + ,37 + ,213351 + ,33 + ,37054 + ,6916 + ,49577 + ,42 + ,40 + ,51185 + ,24 + ,12368 + ,3424 + ,28145 + ,37 + ,37 + ,97181 + ,37 + ,23168 + ,8637 + ,36241 + ,36 + ,36 + ,45100 + ,17 + ,16380 + ,3189 + ,10824 + ,34 + ,34 + ,115801 + ,32 + ,41242 + ,8178 + ,46892 + ,53 + ,49 + ,186310 + ,55 + ,48450 + ,16739 + ,61264 + ,85 + ,82 + ,71960 + ,39 + ,20790 + ,6094 + ,22933 + ,36 + ,36 + ,80105 + ,31 + ,34585 + ,7237 + ,20787 + ,33 + ,33 + ,103613 + ,26 + ,35672 + ,7355 + ,43978 + ,57 + ,55 + ,98707 + ,37 + ,52168 + ,9734 + ,51305 + ,50 + ,50 + ,136234 + ,66 + ,53933 + ,11225 + ,55593 + ,71 + ,71 + ,136781 + ,35 + ,34474 + ,6213 + ,51648 + ,32 + ,31 + ,105863 + ,24 + ,43753 + ,4875 + ,30552 + ,45 + ,42 + ,38775 + ,18 + ,36456 + ,8159 + ,23470 + ,33 + ,31 + ,179997 + ,37 + ,51183 + ,11893 + ,77530 + ,53 + ,51 + ,169406 + ,86 + ,52742 + ,10754 + ,57299 + ,64 + ,64 + ,19349 + ,13 + ,3895 + ,786 + ,9604 + ,14 + ,14 + ,153069 + ,21 + ,37076 + ,9706 + ,34684 + ,38 + ,37 + ,109510 + ,32 + ,24079 + ,7796 + ,41094 + ,39 + ,37 + ,43803 + ,8 + ,2325 + ,593 + ,3439 + ,8 + ,8 + ,47062 + ,38 + ,29354 + ,5600 + ,25171 + ,38 + ,38 + ,110845 + ,45 + ,30341 + ,7245 + ,23437 + ,24 + ,23 + ,92517 + ,24 + ,18992 + ,7360 + ,34086 + ,22 + ,22 + ,58660 + ,23 + ,15292 + ,4574 + ,24649 + ,18 + ,18 + ,27676 + ,2 + ,5842 + ,522 + ,2342 + ,3 + ,1 + ,98550 + ,52 + ,28918 + ,10905 + ,45571 + ,49 + ,48 + ,43646 + ,5 + ,3738 + ,999 + ,3255 + ,5 + ,5 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,67312 + ,43 + ,95352 + ,9016 + ,30002 + ,47 + ,46 + ,57359 + ,18 + ,37478 + ,5134 + ,19360 + ,33 + ,33 + ,104330 + ,44 + ,26839 + ,6608 + ,43320 + ,44 + ,41 + ,70369 + ,45 + ,26783 + ,8577 + ,35513 + ,56 + ,57 + ,65494 + ,29 + ,33392 + ,1543 + ,23536 + ,49 + ,49 + ,3616 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,143931 + ,32 + ,25446 + ,9803 + ,54438 + ,45 + ,45 + ,117946 + ,65 + ,59847 + ,12140 + ,56812 + ,78 + ,78 + ,131175 + ,26 + ,28162 + ,6678 + ,33838 + ,51 + ,46 + ,84336 + ,24 + ,33298 + ,6420 + ,32366 + ,25 + ,25 + ,43410 + ,7 + ,2781 + ,4 + ,13 + ,1 + ,1 + ,136250 + ,62 + ,37121 + ,7979 + ,55082 + ,62 + ,59 + ,79015 + ,30 + ,22698 + ,5141 + ,31334 + ,29 + ,29 + ,92937 + ,49 + ,27615 + ,1311 + ,16612 + ,26 + ,26 + ,57586 + ,3 + ,32689 + ,443 + ,5084 + ,4 + ,4 + ,19764 + ,10 + ,5752 + ,2416 + ,9927 + ,10 + ,10 + ,105757 + ,42 + ,23164 + ,8396 + ,47413 + ,43 + ,43 + ,97213 + ,18 + ,20304 + ,5462 + ,27389 + ,36 + ,36 + ,113402 + ,40 + ,34409 + ,7271 + ,30425 + ,43 + ,41 + ,11796 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,7627 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,121085 + ,29 + ,92538 + ,4423 + ,33510 + ,33 + ,32 + ,6836 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,139563 + ,46 + ,46037 + ,5331 + ,40389 + ,53 + ,53 + ,5118 + ,5 + ,0 + ,0 + ,0 + ,0 + ,0 + ,40248 + ,8 + ,5444 + ,775 + ,6012 + ,6 + ,6 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,95079 + ,21 + ,23924 + ,6676 + ,22205 + ,19 + ,18 + ,80763 + ,21 + ,52230 + ,1489 + ,17231 + ,26 + ,26 + ,7131 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,4194 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,60378 + ,15 + ,8019 + ,3080 + ,11017 + ,16 + ,16 + ,109173 + ,47 + ,34542 + ,11409 + ,46741 + ,84 + ,84 + ,83484 + ,17 + ,21157 + ,6769 + ,39869 + ,28 + ,22) + ,dim=c(7 + ,144) + ,dimnames=list(c('timeRFC' + ,'blogcomp' + ,'characters' + ,'revisions' + ,'seconds' + ,'inclhyper' + ,'inclblogs') + ,1:144)) > y <- array(NA,dim=c(7,144),dimnames=list(c('timeRFC','blogcomp','characters','revisions','seconds','inclhyper','inclblogs'),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 = 'no' > par3 = '3' > par2 = 'none' > par1 = '5' > 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] "seconds" > x[,par1] [1] 22622 73570 1929 36294 62378 167760 52443 57283 36614 93268 [11] 35439 72405 24044 55909 44689 49319 62075 2341 40551 11621 [21] 18741 84202 15334 28024 53306 37918 54819 89058 103354 70239 [31] 33045 63852 30905 24242 78907 0 36005 31972 35853 115301 [41] 47689 34223 43431 52220 33863 46879 23228 42827 65765 38167 [51] 14812 32615 82188 51763 59325 48976 43384 26692 53279 20652 [61] 38338 36735 42764 44331 41354 47879 103793 52235 49825 4105 [71] 58687 40745 33187 14063 37407 7190 49562 76324 21928 27860 [81] 28078 49577 28145 36241 10824 46892 61264 22933 20787 43978 [91] 51305 55593 51648 30552 23470 77530 57299 9604 34684 41094 [101] 3439 25171 23437 34086 24649 2342 45571 3255 0 30002 [111] 19360 43320 35513 23536 0 0 54438 56812 33838 32366 [121] 13 55082 31334 16612 5084 9927 47413 27389 30425 0 [131] 0 33510 0 40389 0 6012 0 22205 17231 0 [141] 0 11017 46741 39869 > 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 13 1929 2341 2342 3255 3439 4105 5084 6012 7190 11 1 1 1 1 1 1 1 1 1 1 9604 9927 10824 11017 11621 14063 14812 15334 16612 17231 18741 1 1 1 1 1 1 1 1 1 1 1 19360 20652 20787 21928 22205 22622 22933 23228 23437 23470 23536 1 1 1 1 1 1 1 1 1 1 1 24044 24242 24649 25171 26692 27389 27860 28024 28078 28145 30002 1 1 1 1 1 1 1 1 1 1 1 30425 30552 30905 31334 31972 32366 32615 33045 33187 33510 33838 1 1 1 1 1 1 1 1 1 1 1 33863 34086 34223 34684 35439 35513 35853 36005 36241 36294 36614 1 1 1 1 1 1 1 1 1 1 1 36735 37407 37918 38167 38338 39869 40389 40551 40745 41094 41354 1 1 1 1 1 1 1 1 1 1 1 42764 42827 43320 43384 43431 43978 44331 44689 45571 46741 46879 1 1 1 1 1 1 1 1 1 1 1 46892 47413 47689 47879 48976 49319 49562 49577 49825 51305 51648 1 1 1 1 1 1 1 1 1 1 1 51763 52220 52235 52443 53279 53306 54438 54819 55082 55593 55909 1 1 1 1 1 1 1 1 1 1 1 56812 57283 57299 58687 59325 61264 62075 62378 63852 65765 70239 1 1 1 1 1 1 1 1 1 1 1 72405 73570 76324 77530 78907 82188 84202 89058 93268 103354 103793 1 1 1 1 1 1 1 1 1 1 1 115301 167760 1 1 > colnames(x) [1] "timeRFC" "blogcomp" "characters" "revisions" "seconds" [6] "inclhyper" "inclblogs" > colnames(x)[par1] [1] "seconds" > x[,par1] [1] 22622 73570 1929 36294 62378 167760 52443 57283 36614 93268 [11] 35439 72405 24044 55909 44689 49319 62075 2341 40551 11621 [21] 18741 84202 15334 28024 53306 37918 54819 89058 103354 70239 [31] 33045 63852 30905 24242 78907 0 36005 31972 35853 115301 [41] 47689 34223 43431 52220 33863 46879 23228 42827 65765 38167 [51] 14812 32615 82188 51763 59325 48976 43384 26692 53279 20652 [61] 38338 36735 42764 44331 41354 47879 103793 52235 49825 4105 [71] 58687 40745 33187 14063 37407 7190 49562 76324 21928 27860 [81] 28078 49577 28145 36241 10824 46892 61264 22933 20787 43978 [91] 51305 55593 51648 30552 23470 77530 57299 9604 34684 41094 [101] 3439 25171 23437 34086 24649 2342 45571 3255 0 30002 [111] 19360 43320 35513 23536 0 0 54438 56812 33838 32366 [121] 13 55082 31334 16612 5084 9927 47413 27389 30425 0 [131] 0 33510 0 40389 0 6012 0 22205 17231 0 [141] 0 11017 46741 39869 > 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/1sz021323979083.tab") + } + } > m Conditional inference tree with 10 terminal nodes Response: seconds Inputs: timeRFC, blogcomp, characters, revisions, inclhyper, inclblogs Number of observations: 144 1) timeRFC <= 80763; criterion = 1, statistic = 104.279 2) blogcomp <= 13; criterion = 1, statistic = 38.064 3) revisions <= 603; criterion = 1, statistic = 17.782 4)* weights = 17 3) revisions > 603 5)* weights = 8 2) blogcomp > 13 6) blogcomp <= 21; criterion = 0.987, statistic = 9.326 7)* weights = 8 6) blogcomp > 21 8)* weights = 13 1) timeRFC > 80763 9) revisions <= 12920; criterion = 1, statistic = 50.825 10) revisions <= 8022; criterion = 1, statistic = 22.802 11) revisions <= 4721; criterion = 0.989, statistic = 9.624 12)* weights = 7 11) revisions > 4721 13) blogcomp <= 45; criterion = 0.985, statistic = 9.187 14)* weights = 29 13) blogcomp > 45 15)* weights = 7 10) revisions > 8022 16) timeRFC <= 129362; criterion = 0.957, statistic = 7.187 17)* weights = 25 16) timeRFC > 129362 18)* weights = 14 9) revisions > 12920 19)* weights = 16 > postscript(file="/var/wessaorg/rcomp/tmp/2k8yd1323979083.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/3v5ew1323979083.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 22622 36964.3103 -14342.3103 2 73570 56385.0714 17184.9286 3 1929 891.0588 1037.9412 4 36294 44911.1600 -8617.1600 5 62378 83026.2500 -20648.2500 6 167760 83026.2500 84733.7500 7 52443 44911.1600 7531.8400 8 57283 49929.2857 7353.7143 9 36614 36964.3103 -350.3103 10 93268 83026.2500 10241.7500 11 35439 49929.2857 -14490.2857 12 72405 83026.2500 -10621.2500 13 24044 26826.4615 -2782.4615 14 55909 56385.0714 -476.0714 15 44689 36964.3103 7724.6897 16 49319 49929.2857 -610.2857 17 62075 83026.2500 -20951.2500 18 2341 891.0588 1449.9412 19 40551 83026.2500 -42475.2500 20 11621 8315.7500 3305.2500 21 18741 18224.8750 516.1250 22 84202 83026.2500 1175.7500 23 15334 24647.1429 -9313.1429 24 28024 24647.1429 3376.8571 25 53306 49929.2857 3376.7143 26 37918 36964.3103 953.6897 27 54819 83026.2500 -28207.2500 28 89058 83026.2500 6031.7500 29 103354 83026.2500 20327.7500 30 70239 83026.2500 -12787.2500 31 33045 36964.3103 -3919.3103 32 63852 56385.0714 7466.9286 33 30905 36964.3103 -6059.3103 34 24242 24647.1429 -405.1429 35 78907 56385.0714 22521.9286 36 0 891.0588 -891.0588 37 36005 56385.0714 -20380.0714 38 31972 36964.3103 -4992.3103 39 35853 44911.1600 -9058.1600 40 115301 83026.2500 32274.7500 41 47689 56385.0714 -8696.0714 42 34223 44911.1600 -10688.1600 43 43431 44911.1600 -1480.1600 44 52220 36964.3103 15255.6897 45 33863 44911.1600 -11048.1600 46 46879 44911.1600 1967.8400 47 23228 18224.8750 5003.1250 48 42827 56385.0714 -13558.0714 49 65765 83026.2500 -17261.2500 50 38167 44911.1600 -6744.1600 51 14812 8315.7500 6496.2500 52 32615 44911.1600 -12296.1600 53 82188 83026.2500 -838.2500 54 51763 56385.0714 -4622.0714 55 59325 56385.0714 2939.9286 56 48976 36964.3103 12011.6897 57 43384 36964.3103 6419.6897 58 26692 26826.4615 -134.4615 59 53279 44911.1600 8367.8400 60 20652 36964.3103 -16312.3103 61 38338 44911.1600 -6573.1600 62 36735 36964.3103 -229.3103 63 42764 36964.3103 5799.6897 64 44331 36964.3103 7366.6897 65 41354 36964.3103 4389.6897 66 47879 44911.1600 2967.8400 67 103793 83026.2500 20766.7500 68 52235 44911.1600 7323.8400 69 49825 44911.1600 4913.8400 70 4105 8315.7500 -4210.7500 71 58687 49929.2857 8757.7143 72 40745 24647.1429 16097.8571 73 33187 44911.1600 -11724.1600 74 14063 24647.1429 -10584.1429 75 37407 44911.1600 -7504.1600 76 7190 8315.7500 -1125.7500 77 49562 44911.1600 4650.8400 78 76324 44911.1600 31412.8400 79 21928 18224.8750 3703.1250 80 27860 26826.4615 1033.5385 81 28078 26826.4615 1251.5385 82 49577 36964.3103 12612.6897 83 28145 26826.4615 1318.5385 84 36241 44911.1600 -8670.1600 85 10824 18224.8750 -7400.8750 86 46892 44911.1600 1980.8400 87 61264 83026.2500 -21762.2500 88 22933 26826.4615 -3893.4615 89 20787 26826.4615 -6039.4615 90 43978 36964.3103 7013.6897 91 51305 44911.1600 6393.8400 92 55593 56385.0714 -792.0714 93 51648 36964.3103 14683.6897 94 30552 36964.3103 -6412.3103 95 23470 18224.8750 5245.1250 96 77530 56385.0714 21144.9286 97 57299 56385.0714 913.9286 98 9604 8315.7500 1288.2500 99 34684 56385.0714 -21701.0714 100 41094 36964.3103 4129.6897 101 3439 891.0588 2547.9412 102 25171 26826.4615 -1655.4615 103 23437 36964.3103 -13527.3103 104 34086 36964.3103 -2878.3103 105 24649 26826.4615 -2177.4615 106 2342 891.0588 1450.9412 107 45571 44911.1600 659.8400 108 3255 8315.7500 -5060.7500 109 0 891.0588 -891.0588 110 30002 26826.4615 3175.5385 111 19360 18224.8750 1135.1250 112 43320 36964.3103 6355.6897 113 35513 26826.4615 8686.5385 114 23536 26826.4615 -3290.4615 115 0 891.0588 -891.0588 116 0 891.0588 -891.0588 117 54438 56385.0714 -1947.0714 118 56812 44911.1600 11900.8400 119 33838 36964.3103 -3126.3103 120 32366 36964.3103 -4598.3103 121 13 891.0588 -878.0588 122 55082 49929.2857 5152.7143 123 31334 26826.4615 4507.5385 124 16612 24647.1429 -8035.1429 125 5084 891.0588 4192.9412 126 9927 8315.7500 1611.2500 127 47413 44911.1600 2501.8400 128 27389 36964.3103 -9575.3103 129 30425 36964.3103 -6539.3103 130 0 891.0588 -891.0588 131 0 891.0588 -891.0588 132 33510 24647.1429 8862.8571 133 0 891.0588 -891.0588 134 40389 49929.2857 -9540.2857 135 0 891.0588 -891.0588 136 6012 8315.7500 -2303.7500 137 0 891.0588 -891.0588 138 22205 36964.3103 -14759.3103 139 17231 18224.8750 -993.8750 140 0 891.0588 -891.0588 141 0 891.0588 -891.0588 142 11017 18224.8750 -7207.8750 143 46741 44911.1600 1829.8400 144 39869 36964.3103 2904.6897 > 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/4jgyl1323979083.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/515tb1323979083.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/68ghq1323979083.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/78rga1323979083.tab") + } > > try(system("convert tmp/2k8yd1323979083.ps tmp/2k8yd1323979083.png",intern=TRUE)) character(0) > try(system("convert tmp/3v5ew1323979083.ps tmp/3v5ew1323979083.png",intern=TRUE)) character(0) > try(system("convert tmp/4jgyl1323979083.ps tmp/4jgyl1323979083.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.427 0.238 3.672