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(146455 + ,1 + ,22 + ,68 + ,128 + ,95556 + ,84944 + ,4 + ,20 + ,72 + ,89 + ,54565 + ,113337 + ,9 + ,24 + ,37 + ,68 + ,63016 + ,128655 + ,2 + ,21 + ,70 + ,108 + ,79774 + ,74398 + ,1 + ,15 + ,30 + ,51 + ,31258 + ,35523 + ,2 + ,16 + ,53 + ,33 + ,52491 + ,293403 + ,0 + ,20 + ,74 + ,119 + ,91256 + ,32750 + ,0 + ,18 + ,22 + ,5 + ,22807 + ,106539 + ,5 + ,19 + ,68 + ,63 + ,77411 + ,130539 + ,0 + ,20 + ,47 + ,66 + ,48821 + ,154991 + ,0 + ,25 + ,87 + ,98 + ,52295 + ,126683 + ,7 + ,37 + ,123 + ,71 + ,63262 + ,100672 + ,6 + ,23 + ,69 + ,55 + ,50466 + ,179562 + ,3 + ,28 + ,89 + ,116 + ,62932 + ,125971 + ,4 + ,25 + ,45 + ,71 + ,38439 + ,234509 + ,0 + ,35 + ,122 + ,120 + ,70817 + ,158980 + ,4 + ,20 + ,75 + ,122 + ,105965 + ,184217 + ,3 + ,22 + ,45 + ,74 + ,73795 + ,107342 + ,0 + ,19 + ,53 + ,111 + ,82043 + ,141371 + ,5 + ,26 + ,96 + ,103 + ,74349 + ,154730 + ,0 + ,27 + ,82 + ,98 + ,82204 + ,264020 + ,1 + ,22 + ,76 + ,100 + ,55709 + ,90938 + ,3 + ,15 + ,51 + ,42 + ,37137 + ,101324 + ,5 + ,26 + ,104 + ,100 + ,70780 + ,130232 + ,0 + ,24 + ,83 + ,105 + ,55027 + ,137793 + ,0 + ,22 + ,78 + ,77 + ,56699 + ,161678 + ,4 + ,21 + ,59 + ,83 + ,65911 + ,151503 + ,0 + ,23 + ,83 + ,98 + ,56316 + ,105324 + ,0 + ,21 + ,71 + ,46 + ,26982 + ,175914 + ,0 + ,25 + ,81 + ,95 + ,54628 + ,181853 + ,3 + ,25 + ,93 + ,91 + ,96750 + ,114928 + ,4 + ,28 + ,72 + ,91 + ,53009 + ,190410 + ,1 + ,30 + ,107 + ,94 + ,64664 + ,61499 + ,4 + ,20 + ,75 + ,15 + ,36990 + ,223004 + ,1 + ,23 + ,84 + ,137 + ,85224 + ,167131 + ,0 + ,25 + ,69 + ,56 + ,37048 + ,233482 + ,0 + ,26 + ,90 + ,78 + ,59635 + ,121185 + ,2 + ,20 + ,51 + ,68 + ,42051 + ,78776 + ,1 + ,8 + ,18 + ,34 + ,26998 + ,188967 + ,2 + ,20 + ,75 + ,94 + ,63717 + ,199512 + ,8 + ,21 + ,59 + ,82 + ,55071 + ,102531 + ,5 + ,25 + ,63 + ,63 + ,40001 + ,118958 + ,3 + ,20 + ,68 + ,58 + ,54506 + ,68948 + ,4 + ,18 + ,47 + ,43 + ,35838 + ,93125 + ,1 + ,21 + ,29 + ,36 + ,50838 + ,277108 + ,2 + ,22 + ,69 + ,64 + ,86997 + ,78800 + ,2 + ,26 + ,66 + ,21 + ,33032 + ,157250 + ,0 + ,30 + ,106 + ,104 + ,61704 + ,210554 + ,6 + ,24 + ,73 + ,124 + ,117986 + ,127324 + ,3 + ,26 + ,87 + ,101 + ,56733 + ,114397 + ,0 + ,18 + ,65 + ,85 + ,55064 + ,24188 + ,0 + ,4 + ,7 + ,7 + ,5950 + ,246209 + ,6 + ,31 + ,111 + ,124 + ,84607 + ,65029 + ,5 + ,18 + ,61 + ,21 + ,32551 + ,98030 + ,3 + ,14 + ,41 + ,35 + ,31701 + ,173587 + ,1 + ,20 + ,70 + ,95 + ,71170 + ,172684 + ,5 + ,30 + ,112 + ,102 + ,101773 + ,191381 + ,5 + ,20 + ,71 + ,212 + ,101653 + ,191276 + ,0 + ,26 + ,90 + ,141 + ,81493 + ,134043 + ,9 + ,20 + ,69 + ,54 + ,55901 + ,233406 + ,6 + ,27 + ,85 + ,117 + ,109104 + ,195304 + ,6 + ,18 + ,47 + ,145 + ,114425 + ,127619 + ,5 + ,27 + ,50 + ,50 + ,36311 + ,162810 + ,6 + ,22 + ,76 + ,80 + ,70027 + ,129100 + ,2 + ,19 + ,60 + ,87 + ,73713 + ,108715 + ,0 + ,15 + ,35 + ,78 + ,40671 + ,106469 + ,3 + ,19 + ,72 + ,86 + ,89041 + ,142069 + ,8 + ,28 + ,88 + ,82 + ,57231 + ,143937 + ,2 + ,20 + ,66 + ,139 + ,78792 + ,84256 + ,5 + ,17 + ,58 + ,75 + ,59155 + ,118807 + ,11 + ,25 + ,81 + ,70 + ,55827 + ,69471 + ,6 + ,20 + ,63 + ,25 + ,22618 + ,122433 + ,5 + ,25 + ,91 + ,66 + ,58425 + ,131122 + ,1 + ,20 + ,50 + ,89 + ,65724 + ,94763 + ,0 + ,22 + ,75 + ,99 + ,56979 + ,188780 + ,3 + ,25 + ,85 + ,98 + ,72369 + ,191467 + ,3 + ,20 + ,75 + ,104 + ,79194 + ,105615 + ,6 + ,23 + ,70 + ,48 + ,202316 + ,89318 + ,1 + ,22 + ,78 + ,81 + ,44970 + ,107335 + ,0 + ,21 + ,61 + ,64 + ,49319 + ,98599 + ,1 + ,18 + ,55 + ,44 + ,36252 + ,260646 + ,0 + ,25 + ,60 + ,104 + ,75741 + ,131876 + ,5 + ,22 + ,83 + ,36 + ,38417 + ,119291 + ,2 + ,25 + ,38 + ,120 + ,64102 + ,80953 + ,0 + ,8 + ,27 + ,58 + ,56622 + ,99768 + ,0 + ,21 + ,62 + ,27 + ,15430 + ,84572 + ,5 + ,22 + ,82 + ,84 + ,72571 + ,202373 + ,1 + ,21 + ,79 + ,56 + ,67271 + ,166790 + ,0 + ,30 + ,59 + ,46 + ,43460 + ,99946 + ,1 + ,23 + ,80 + ,119 + ,99501 + ,116900 + ,1 + ,20 + ,36 + ,57 + ,28340 + ,142146 + ,2 + ,24 + ,88 + ,139 + ,76013 + ,99246 + ,4 + ,21 + ,63 + ,51 + ,37361 + ,156833 + ,1 + ,20 + ,73 + ,85 + ,48204 + ,175078 + ,4 + ,20 + ,71 + ,91 + ,76168 + ,130533 + ,0 + ,20 + ,76 + ,79 + ,85168 + ,142339 + ,2 + ,20 + ,67 + ,142 + ,125410 + ,176789 + ,0 + ,23 + ,66 + ,149 + ,123328 + ,181379 + ,7 + ,33 + ,123 + ,96 + ,83038 + ,228548 + ,7 + ,19 + ,65 + ,198 + ,120087 + ,142141 + ,6 + ,27 + ,87 + ,61 + ,91939 + ,167845 + ,0 + ,25 + ,77 + ,145 + ,103646 + ,103012 + ,0 + ,20 + ,37 + ,26 + ,29467 + ,43287 + ,4 + ,19 + ,64 + ,49 + ,43750 + ,125366 + ,4 + ,15 + ,22 + ,68 + ,34497 + ,118372 + ,0 + ,21 + ,35 + ,145 + ,66477 + ,135171 + ,0 + ,22 + ,61 + ,82 + ,71181 + ,175568 + ,0 + ,24 + ,80 + ,102 + ,74482 + ,74112 + ,0 + ,19 + ,54 + ,52 + ,174949 + ,88817 + ,0 + ,20 + ,60 + ,56 + ,46765 + ,164767 + ,4 + ,23 + ,87 + ,80 + ,90257 + ,141933 + ,0 + ,27 + ,75 + ,99 + ,51370 + ,22938 + ,0 + ,1 + ,0 + ,11 + ,1168 + ,115199 + ,0 + ,20 + ,54 + ,87 + ,51360 + ,61857 + ,4 + ,11 + ,30 + ,28 + ,25162 + ,91185 + ,0 + ,27 + ,66 + ,67 + ,21067 + ,213765 + ,1 + ,22 + ,56 + ,150 + ,58233 + ,21054 + ,0 + ,0 + ,0 + ,4 + ,855 + ,167105 + ,5 + ,17 + ,32 + ,71 + ,85903 + ,31414 + ,0 + ,8 + ,9 + ,39 + ,14116 + ,178863 + ,1 + ,23 + ,78 + ,87 + ,57637 + ,126681 + ,7 + ,26 + ,90 + ,66 + ,94137 + ,64320 + ,5 + ,20 + ,56 + ,23 + ,62147 + ,67746 + ,2 + ,16 + ,35 + ,56 + ,62832 + ,38214 + ,0 + ,8 + ,21 + ,16 + ,8773 + ,90961 + ,1 + ,22 + ,78 + ,49 + ,63785 + ,181510 + ,0 + ,33 + ,118 + ,108 + ,65196 + ,116775 + ,0 + ,28 + ,83 + ,112 + ,73087 + ,223914 + ,2 + ,26 + ,89 + ,110 + ,72631 + ,185139 + ,0 + ,27 + ,83 + ,126 + ,86281 + ,242879 + ,2 + ,35 + ,124 + ,155 + ,162365 + ,139144 + ,0 + ,21 + ,76 + ,75 + ,56530 + ,75812 + ,0 + ,20 + ,57 + ,30 + ,35606 + ,178218 + ,4 + ,24 + ,91 + ,78 + ,70111 + ,246834 + ,4 + ,26 + ,89 + ,135 + ,92046 + ,50999 + ,8 + ,20 + ,66 + ,8 + ,63989 + ,223842 + ,0 + ,22 + ,82 + ,114 + ,104911 + ,93577 + ,4 + ,24 + ,63 + ,60 + ,43448 + ,155383 + ,0 + ,23 + ,75 + ,99 + ,60029 + ,111664 + ,1 + ,22 + ,59 + ,98 + ,38650 + ,75426 + ,0 + ,12 + ,19 + ,33 + ,47261 + ,243551 + ,9 + ,21 + ,57 + ,93 + ,73586 + ,136548 + ,0 + ,21 + ,62 + ,157 + ,83042 + ,173260 + ,3 + ,21 + ,78 + ,15 + ,37238 + ,185039 + ,7 + ,25 + ,73 + ,98 + ,63958 + ,67507 + ,5 + ,32 + ,112 + ,49 + ,78956 + ,139350 + ,2 + ,24 + ,79 + ,88 + ,99518 + ,172964 + ,1 + ,28 + ,96 + ,151 + ,111436 + ,0 + ,9 + ,0 + ,0 + ,0 + ,0 + ,14688 + ,0 + ,0 + ,0 + ,5 + ,6023 + ,98 + ,0 + ,0 + ,0 + ,0 + ,0 + ,455 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,128066 + ,2 + ,20 + ,48 + ,80 + ,42564 + ,176460 + ,1 + ,27 + ,55 + ,122 + ,38885 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,203 + ,0 + ,0 + ,0 + ,0 + ,0 + ,7199 + ,0 + ,0 + ,0 + ,6 + ,1644 + ,46660 + ,0 + ,5 + ,13 + ,13 + ,6179 + ,17547 + ,0 + ,1 + ,4 + ,3 + ,3926 + ,73567 + ,0 + ,23 + ,31 + ,18 + ,23238 + ,969 + ,0 + ,0 + ,0 + ,0 + ,0 + ,101060 + ,2 + ,16 + ,29 + ,48 + ,49288) + ,dim=c(6 + ,164) + ,dimnames=list(c('Time_in_RFC' + ,'Shared_compendiums' + ,'Reviewed_compendiums' + ,'Long_feedback' + ,'Blogs' + ,'Characters') + ,1:164)) > y <- array(NA,dim=c(6,164),dimnames=list(c('Time_in_RFC','Shared_compendiums','Reviewed_compendiums','Long_feedback','Blogs','Characters'),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 = 'no' > par3 = '3' > par2 = 'none' > 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] "Time_in_RFC" > x[,par1] [1] 146455 84944 113337 128655 74398 35523 293403 32750 106539 130539 [11] 154991 126683 100672 179562 125971 234509 158980 184217 107342 141371 [21] 154730 264020 90938 101324 130232 137793 161678 151503 105324 175914 [31] 181853 114928 190410 61499 223004 167131 233482 121185 78776 188967 [41] 199512 102531 118958 68948 93125 277108 78800 157250 210554 127324 [51] 114397 24188 246209 65029 98030 173587 172684 191381 191276 134043 [61] 233406 195304 127619 162810 129100 108715 106469 142069 143937 84256 [71] 118807 69471 122433 131122 94763 188780 191467 105615 89318 107335 [81] 98599 260646 131876 119291 80953 99768 84572 202373 166790 99946 [91] 116900 142146 99246 156833 175078 130533 142339 176789 181379 228548 [101] 142141 167845 103012 43287 125366 118372 135171 175568 74112 88817 [111] 164767 141933 22938 115199 61857 91185 213765 21054 167105 31414 [121] 178863 126681 64320 67746 38214 90961 181510 116775 223914 185139 [131] 242879 139144 75812 178218 246834 50999 223842 93577 155383 111664 [141] 75426 243551 136548 173260 185039 67507 139350 172964 0 14688 [151] 98 455 0 0 128066 176460 0 203 7199 46660 [161] 17547 73567 969 101060 > 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 98 203 455 969 7199 14688 17547 21054 22938 24188 4 1 1 1 1 1 1 1 1 1 1 31414 32750 35523 38214 43287 46660 50999 61499 61857 64320 65029 1 1 1 1 1 1 1 1 1 1 1 67507 67746 68948 69471 73567 74112 74398 75426 75812 78776 78800 1 1 1 1 1 1 1 1 1 1 1 80953 84256 84572 84944 88817 89318 90938 90961 91185 93125 93577 1 1 1 1 1 1 1 1 1 1 1 94763 98030 98599 99246 99768 99946 100672 101060 101324 102531 103012 1 1 1 1 1 1 1 1 1 1 1 105324 105615 106469 106539 107335 107342 108715 111664 113337 114397 114928 1 1 1 1 1 1 1 1 1 1 1 115199 116775 116900 118372 118807 118958 119291 121185 122433 125366 125971 1 1 1 1 1 1 1 1 1 1 1 126681 126683 127324 127619 128066 128655 129100 130232 130533 130539 131122 1 1 1 1 1 1 1 1 1 1 1 131876 134043 135171 136548 137793 139144 139350 141371 141933 142069 142141 1 1 1 1 1 1 1 1 1 1 1 142146 142339 143937 146455 151503 154730 154991 155383 156833 157250 158980 1 1 1 1 1 1 1 1 1 1 1 161678 162810 164767 166790 167105 167131 167845 172684 172964 173260 173587 1 1 1 1 1 1 1 1 1 1 1 175078 175568 175914 176460 176789 178218 178863 179562 181379 181510 181853 1 1 1 1 1 1 1 1 1 1 1 184217 185039 185139 188780 188967 190410 191276 191381 191467 195304 199512 1 1 1 1 1 1 1 1 1 1 1 202373 210554 213765 223004 223842 223914 228548 233406 233482 234509 242879 1 1 1 1 1 1 1 1 1 1 1 243551 246209 246834 260646 264020 277108 293403 1 1 1 1 1 1 1 > colnames(x) [1] "Time_in_RFC" "Shared_compendiums" "Reviewed_compendiums" [4] "Long_feedback" "Blogs" "Characters" > colnames(x)[par1] [1] "Time_in_RFC" > x[,par1] [1] 146455 84944 113337 128655 74398 35523 293403 32750 106539 130539 [11] 154991 126683 100672 179562 125971 234509 158980 184217 107342 141371 [21] 154730 264020 90938 101324 130232 137793 161678 151503 105324 175914 [31] 181853 114928 190410 61499 223004 167131 233482 121185 78776 188967 [41] 199512 102531 118958 68948 93125 277108 78800 157250 210554 127324 [51] 114397 24188 246209 65029 98030 173587 172684 191381 191276 134043 [61] 233406 195304 127619 162810 129100 108715 106469 142069 143937 84256 [71] 118807 69471 122433 131122 94763 188780 191467 105615 89318 107335 [81] 98599 260646 131876 119291 80953 99768 84572 202373 166790 99946 [91] 116900 142146 99246 156833 175078 130533 142339 176789 181379 228548 [101] 142141 167845 103012 43287 125366 118372 135171 175568 74112 88817 [111] 164767 141933 22938 115199 61857 91185 213765 21054 167105 31414 [121] 178863 126681 64320 67746 38214 90961 181510 116775 223914 185139 [131] 242879 139144 75812 178218 246834 50999 223842 93577 155383 111664 [141] 75426 243551 136548 173260 185039 67507 139350 172964 0 14688 [151] 98 455 0 0 128066 176460 0 203 7199 46660 [161] 17547 73567 969 101060 > 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/148651324553187.tab") + } + } > m Conditional inference tree with 6 terminal nodes Response: Time_in_RFC Inputs: Shared_compendiums, Reviewed_compendiums, Long_feedback, Blogs, Characters Number of observations: 164 1) Blogs <= 52; criterion = 1, statistic = 92.227 2) Reviewed_compendiums <= 4; criterion = 1, statistic = 32.928 3)* weights = 14 2) Reviewed_compendiums > 4 4) Reviewed_compendiums <= 20; criterion = 0.984, statistic = 8.677 5)* weights = 23 4) Reviewed_compendiums > 20 6)* weights = 13 1) Blogs > 52 7) Characters <= 63262; criterion = 1, statistic = 22.659 8) Blogs <= 99; criterion = 0.999, statistic = 13.407 9)* weights = 42 8) Blogs > 99 10)* weights = 7 7) Characters > 63262 11)* weights = 65 > postscript(file="/var/wessaorg/rcomp/tmp/2zmbi1324553187.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/3wi121324553187.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 146455 173330.523 -26875.5231 2 84944 125424.738 -40480.7381 3 113337 125424.738 -12087.7381 4 128655 173330.523 -44675.5231 5 74398 66962.348 7435.6522 6 35523 66962.348 -31439.3478 7 293403 173330.523 120072.4769 8 32750 66962.348 -34212.3478 9 106539 173330.523 -66791.5231 10 130539 125424.738 5114.2619 11 154991 125424.738 29566.2619 12 126683 125424.738 1258.2619 13 100672 125424.738 -24752.7381 14 179562 178373.286 1188.7143 15 125971 125424.738 546.2619 16 234509 173330.523 61178.4769 17 158980 173330.523 -14350.5231 18 184217 173330.523 10886.4769 19 107342 173330.523 -65988.5231 20 141371 173330.523 -31959.5231 21 154730 173330.523 -18600.5231 22 264020 178373.286 85646.7143 23 90938 66962.348 23975.6522 24 101324 173330.523 -72006.5231 25 130232 178373.286 -48141.2857 26 137793 125424.738 12368.2619 27 161678 173330.523 -11652.5231 28 151503 125424.738 26078.2619 29 105324 108727.538 -3403.5385 30 175914 125424.738 50489.2619 31 181853 173330.523 8522.4769 32 114928 125424.738 -10496.7381 33 190410 173330.523 17079.4769 34 61499 66962.348 -5463.3478 35 223004 173330.523 49673.4769 36 167131 125424.738 41706.2619 37 233482 125424.738 108057.2619 38 121185 125424.738 -4239.7381 39 78776 66962.348 11813.6522 40 188967 173330.523 15636.4769 41 199512 125424.738 74087.2619 42 102531 125424.738 -22893.7381 43 118958 125424.738 -6466.7381 44 68948 66962.348 1985.6522 45 93125 108727.538 -15602.5385 46 277108 173330.523 103777.4769 47 78800 108727.538 -29927.5385 48 157250 178373.286 -21123.2857 49 210554 173330.523 37223.4769 50 127324 178373.286 -51049.2857 51 114397 125424.738 -11027.7381 52 24188 7809.929 16378.0714 53 246209 173330.523 72878.4769 54 65029 66962.348 -1933.3478 55 98030 66962.348 31067.6522 56 173587 173330.523 256.4769 57 172684 173330.523 -646.5231 58 191381 173330.523 18050.4769 59 191276 173330.523 17945.4769 60 134043 125424.738 8618.2619 61 233406 173330.523 60075.4769 62 195304 173330.523 21973.4769 63 127619 108727.538 18891.4615 64 162810 173330.523 -10520.5231 65 129100 173330.523 -44230.5231 66 108715 125424.738 -16709.7381 67 106469 173330.523 -66861.5231 68 142069 125424.738 16644.2619 69 143937 173330.523 -29393.5231 70 84256 125424.738 -41168.7381 71 118807 125424.738 -6617.7381 72 69471 66962.348 2508.6522 73 122433 125424.738 -2991.7381 74 131122 173330.523 -42208.5231 75 94763 125424.738 -30661.7381 76 188780 173330.523 15449.4769 77 191467 173330.523 18136.4769 78 105615 108727.538 -3112.5385 79 89318 125424.738 -36106.7381 80 107335 125424.738 -18089.7381 81 98599 66962.348 31636.6522 82 260646 173330.523 87315.4769 83 131876 108727.538 23148.4615 84 119291 173330.523 -54039.5231 85 80953 125424.738 -44471.7381 86 99768 108727.538 -8959.5385 87 84572 173330.523 -88758.5231 88 202373 173330.523 29042.4769 89 166790 108727.538 58062.4615 90 99946 173330.523 -73384.5231 91 116900 125424.738 -8524.7381 92 142146 173330.523 -31184.5231 93 99246 108727.538 -9481.5385 94 156833 125424.738 31408.2619 95 175078 173330.523 1747.4769 96 130533 173330.523 -42797.5231 97 142339 173330.523 -30991.5231 98 176789 173330.523 3458.4769 99 181379 173330.523 8048.4769 100 228548 173330.523 55217.4769 101 142141 173330.523 -31189.5231 102 167845 173330.523 -5485.5231 103 103012 66962.348 36049.6522 104 43287 66962.348 -23675.3478 105 125366 125424.738 -58.7381 106 118372 173330.523 -54958.5231 107 135171 173330.523 -38159.5231 108 175568 173330.523 2237.4769 109 74112 66962.348 7149.6522 110 88817 125424.738 -36607.7381 111 164767 173330.523 -8563.5231 112 141933 125424.738 16508.2619 113 22938 7809.929 15128.0714 114 115199 125424.738 -10225.7381 115 61857 66962.348 -5105.3478 116 91185 125424.738 -34239.7381 117 213765 178373.286 35391.7143 118 21054 7809.929 13244.0714 119 167105 173330.523 -6225.5231 120 31414 66962.348 -35548.3478 121 178863 125424.738 53438.2619 122 126681 173330.523 -46649.5231 123 64320 66962.348 -2642.3478 124 67746 125424.738 -57678.7381 125 38214 66962.348 -28748.3478 126 90961 108727.538 -17766.5385 127 181510 173330.523 8179.4769 128 116775 173330.523 -56555.5231 129 223914 173330.523 50583.4769 130 185139 173330.523 11808.4769 131 242879 173330.523 69548.4769 132 139144 125424.738 13719.2619 133 75812 66962.348 8849.6522 134 178218 173330.523 4887.4769 135 246834 173330.523 73503.4769 136 50999 66962.348 -15963.3478 137 223842 173330.523 50511.4769 138 93577 125424.738 -31847.7381 139 155383 125424.738 29958.2619 140 111664 125424.738 -13760.7381 141 75426 66962.348 8463.6522 142 243551 173330.523 70220.4769 143 136548 173330.523 -36782.5231 144 173260 108727.538 64532.4615 145 185039 173330.523 11708.4769 146 67507 108727.538 -41220.5385 147 139350 173330.523 -33980.5231 148 172964 173330.523 -366.5231 149 0 7809.929 -7809.9286 150 14688 7809.929 6878.0714 151 98 7809.929 -7711.9286 152 455 7809.929 -7354.9286 153 0 7809.929 -7809.9286 154 0 7809.929 -7809.9286 155 128066 125424.738 2641.2619 156 176460 178373.286 -1913.2857 157 0 7809.929 -7809.9286 158 203 7809.929 -7606.9286 159 7199 7809.929 -610.9286 160 46660 66962.348 -20302.3478 161 17547 7809.929 9737.0714 162 73567 108727.538 -35160.5385 163 969 7809.929 -6840.9286 164 101060 66962.348 34097.6522 > 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/4ls9e1324553187.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/54dzc1324553187.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/6tal41324553187.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/7dp5x1324553187.tab") + } > > try(system("convert tmp/2zmbi1324553187.ps tmp/2zmbi1324553187.png",intern=TRUE)) character(0) > try(system("convert tmp/3wi121324553187.ps tmp/3wi121324553187.png",intern=TRUE)) character(0) > try(system("convert tmp/4ls9e1324553187.ps tmp/4ls9e1324553187.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.212 0.352 4.563