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(162687 + ,0 + ,48 + ,21 + ,20465 + ,23975 + ,39 + ,201906 + ,1 + ,58 + ,20 + ,33629 + ,85634 + ,46 + ,7215 + ,0 + ,0 + ,0 + ,1423 + ,1929 + ,0 + ,146367 + ,0 + ,67 + ,27 + ,25629 + ,36294 + ,54 + ,257045 + ,0 + ,83 + ,31 + ,54002 + ,72255 + ,93 + ,524450 + ,1 + ,136 + ,36 + ,151036 + ,189748 + ,198 + ,188294 + ,1 + ,65 + ,23 + ,33287 + ,61834 + ,42 + ,195674 + ,0 + ,86 + ,30 + ,31172 + ,68167 + ,59 + ,177020 + ,0 + ,62 + ,30 + ,28113 + ,38462 + ,49 + ,325899 + ,1 + ,71 + ,27 + ,57803 + ,101219 + ,83 + ,121844 + ,2 + ,50 + ,24 + ,49830 + ,43270 + ,49 + ,203938 + ,0 + ,88 + ,30 + ,52143 + ,76183 + ,83 + ,113213 + ,0 + ,61 + ,22 + ,21055 + ,31476 + ,39 + ,220751 + ,4 + ,79 + ,28 + ,47007 + ,62157 + ,93 + ,172905 + ,4 + ,56 + ,18 + ,28735 + ,46261 + ,31 + ,156326 + ,3 + ,54 + ,22 + ,59147 + ,50063 + ,29 + ,145178 + ,0 + ,81 + ,37 + ,78950 + ,64483 + ,104 + ,89171 + ,5 + ,13 + ,15 + ,13497 + ,2341 + ,2 + ,172624 + ,0 + ,74 + ,34 + ,46154 + ,48149 + ,46 + ,39790 + ,0 + ,18 + ,18 + ,53249 + ,12743 + ,27 + ,87927 + ,0 + ,31 + ,15 + ,10726 + ,18743 + ,16 + ,241285 + ,0 + ,99 + ,30 + ,83700 + ,97057 + ,108 + ,195820 + ,1 + ,38 + ,25 + ,40400 + ,17675 + ,36 + ,146946 + ,1 + ,59 + ,34 + ,33797 + ,33106 + ,33 + ,159763 + ,1 + ,54 + ,21 + ,36205 + ,53311 + ,46 + ,207078 + ,0 + ,63 + ,21 + ,30165 + ,42754 + ,65 + ,212394 + ,0 + ,66 + ,25 + ,58534 + ,59056 + ,80 + ,201536 + ,0 + ,90 + ,31 + ,44663 + ,101621 + ,81 + ,394662 + ,0 + ,72 + ,31 + ,92556 + ,118120 + ,69 + ,217892 + ,0 + ,61 + ,20 + ,40078 + ,79572 + ,69 + ,182286 + ,0 + ,61 + ,28 + ,34711 + ,42744 + ,37 + ,181740 + ,2 + ,61 + ,22 + ,31076 + ,65931 + ,45 + ,137978 + ,4 + ,53 + ,17 + ,74608 + ,38575 + ,62 + ,255929 + ,0 + ,118 + ,25 + ,58092 + ,28795 + ,33 + ,236489 + ,1 + ,73 + ,25 + ,42009 + ,94440 + ,77 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,230761 + ,0 + ,54 + ,31 + ,36022 + ,38229 + ,34 + ,132807 + ,3 + ,54 + ,14 + ,23333 + ,31972 + ,44 + ,157118 + ,9 + ,46 + ,35 + ,53349 + ,40071 + ,43 + ,253254 + ,0 + ,83 + ,34 + ,92596 + ,132480 + ,117 + ,269329 + ,2 + ,106 + ,22 + ,49598 + ,62797 + ,125 + ,161273 + ,0 + ,44 + ,34 + ,44093 + ,40429 + ,49 + ,107181 + ,2 + ,27 + ,23 + ,84205 + ,45545 + ,76 + ,195891 + ,1 + ,64 + ,24 + ,63369 + ,57568 + ,81 + ,139667 + ,2 + ,71 + ,26 + ,60132 + ,39019 + ,111 + ,171101 + ,2 + ,44 + ,23 + ,37403 + ,53866 + ,61 + ,81407 + ,1 + ,23 + ,35 + ,24460 + ,38345 + ,56 + ,247563 + ,0 + ,78 + ,24 + ,46456 + ,50210 + ,54 + ,239807 + ,1 + ,60 + ,31 + ,66616 + ,80947 + ,47 + ,172743 + ,8 + ,73 + ,30 + ,41554 + ,43461 + ,55 + ,48188 + ,0 + ,12 + ,22 + ,22346 + ,14812 + ,14 + ,169355 + ,0 + ,104 + ,23 + ,30874 + ,37819 + ,44 + ,315622 + ,0 + ,83 + ,27 + ,68701 + ,102738 + ,115 + ,241518 + ,0 + ,57 + ,30 + ,35728 + ,54509 + ,57 + ,195583 + ,1 + ,67 + ,33 + ,29010 + ,62956 + ,48 + ,159913 + ,8 + ,44 + ,12 + ,23110 + ,55411 + ,40 + ,220241 + ,0 + ,53 + ,26 + ,38844 + ,50611 + ,51 + ,101694 + ,1 + ,26 + ,26 + ,27084 + ,26692 + ,32 + ,157258 + ,0 + ,67 + ,23 + ,35139 + ,60056 + ,36 + ,202536 + ,10 + ,36 + ,38 + ,57476 + ,25155 + ,47 + ,173505 + ,6 + ,56 + ,32 + ,33277 + ,42840 + ,51 + ,150518 + ,0 + ,52 + ,21 + ,31141 + ,39358 + ,37 + ,141491 + ,11 + ,54 + ,22 + ,61281 + ,47241 + ,52 + ,125612 + ,3 + ,57 + ,26 + ,25820 + ,49611 + ,42 + ,166049 + ,0 + ,27 + ,28 + ,23284 + ,41833 + ,11 + ,124197 + ,0 + ,58 + ,33 + ,35378 + ,48930 + ,47 + ,195043 + ,8 + ,76 + ,36 + ,74990 + ,110600 + ,59 + ,138708 + ,2 + ,93 + ,25 + ,29653 + ,52235 + ,82 + ,116552 + ,0 + ,59 + ,25 + ,64622 + ,53986 + ,49 + ,31970 + ,0 + ,5 + ,21 + ,4157 + ,4105 + ,6 + ,258158 + ,3 + ,57 + ,19 + ,29245 + ,59331 + ,83 + ,151184 + ,1 + ,42 + ,12 + ,50008 + ,47796 + ,56 + ,135926 + ,2 + ,88 + ,30 + ,52338 + ,38302 + ,114 + ,119629 + ,1 + ,53 + ,21 + ,13310 + ,14063 + ,46 + ,171518 + ,0 + ,81 + ,39 + ,92901 + ,54414 + ,46 + ,108949 + ,2 + ,35 + ,32 + ,10956 + ,9903 + ,2 + ,183471 + ,1 + ,102 + ,28 + ,34241 + ,53987 + ,51 + ,159966 + ,0 + ,71 + ,29 + ,75043 + ,88937 + ,96 + ,93786 + ,0 + ,28 + ,21 + ,21152 + ,21928 + ,20 + ,84971 + ,0 + ,34 + ,31 + ,42249 + ,29487 + ,57 + ,88882 + ,0 + ,54 + ,26 + ,42005 + ,35334 + ,49 + ,304603 + ,0 + ,49 + ,29 + ,41152 + ,57596 + ,51 + ,75101 + ,1 + ,30 + ,23 + ,14399 + ,29750 + ,40 + ,145043 + ,0 + ,57 + ,25 + ,28263 + ,41029 + ,40 + ,95827 + ,0 + ,54 + ,22 + ,17215 + ,12416 + ,36 + ,173924 + ,0 + ,38 + ,26 + ,48140 + ,51158 + ,64 + ,241957 + ,0 + ,63 + ,33 + ,62897 + ,79935 + ,117 + ,115367 + ,0 + ,58 + ,24 + ,22883 + ,26552 + ,40 + ,118408 + ,7 + ,46 + ,24 + ,41622 + ,25807 + ,46 + ,164078 + ,0 + ,46 + ,21 + ,40715 + ,50620 + ,61 + ,158931 + ,5 + ,51 + ,28 + ,65897 + ,61467 + ,59 + ,184139 + ,1 + ,87 + ,28 + ,76542 + ,65292 + ,94 + ,152856 + ,0 + ,39 + ,25 + ,37477 + ,55516 + ,36 + ,144014 + ,0 + ,28 + ,15 + ,53216 + ,42006 + ,51 + ,62535 + ,0 + ,26 + ,13 + ,40911 + ,26273 + ,39 + ,245196 + ,0 + ,52 + ,36 + ,57021 + ,90248 + ,62 + ,199841 + ,0 + ,96 + ,27 + ,73116 + ,61476 + ,79 + ,19349 + ,0 + ,13 + ,1 + ,3895 + ,9604 + ,14 + ,247280 + ,3 + ,43 + ,24 + ,46609 + ,45108 + ,45 + ,159408 + ,0 + ,42 + ,31 + ,29351 + ,47232 + ,43 + ,72128 + ,0 + ,30 + ,4 + ,2325 + ,3439 + ,8 + ,104253 + ,0 + ,59 + ,21 + ,31747 + ,30553 + ,41 + ,151090 + ,0 + ,73 + ,27 + ,32665 + ,24751 + ,25 + ,137382 + ,1 + ,39 + ,23 + ,19249 + ,34458 + ,22 + ,87448 + ,1 + ,36 + ,12 + ,15292 + ,24649 + ,18 + ,27676 + ,0 + ,2 + ,16 + ,5842 + ,2342 + ,3 + ,165507 + ,0 + ,102 + ,29 + ,33994 + ,52739 + ,54 + ,132148 + ,1 + ,30 + ,26 + ,13018 + ,6245 + ,6 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,95778 + ,0 + ,46 + ,25 + ,98177 + ,35381 + ,50 + ,109001 + ,0 + ,25 + ,21 + ,37941 + ,19595 + ,33 + ,158833 + ,0 + ,59 + ,24 + ,31032 + ,50848 + ,54 + ,147690 + ,1 + ,60 + ,21 + ,32683 + ,39443 + ,63 + ,89887 + ,0 + ,36 + ,21 + ,34545 + ,27023 + ,56 + ,3616 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,199005 + ,0 + ,45 + ,23 + ,27525 + ,61022 + ,49 + ,160930 + ,0 + ,79 + ,33 + ,66856 + ,63528 + ,90 + ,177948 + ,2 + ,30 + ,32 + ,28549 + ,34835 + ,51 + ,136061 + ,0 + ,43 + ,23 + ,38610 + ,37172 + ,29 + ,43410 + ,0 + ,7 + ,1 + ,2781 + ,13 + ,1 + ,184277 + ,1 + ,80 + ,29 + ,41211 + ,62548 + ,68 + ,108858 + ,0 + ,32 + ,20 + ,22698 + ,31334 + ,29 + ,141744 + ,8 + ,81 + ,33 + ,41194 + ,20839 + ,27 + ,60493 + ,3 + ,3 + ,12 + ,32689 + ,5084 + ,4 + ,19764 + ,1 + ,10 + ,2 + ,5752 + ,9927 + ,10 + ,177559 + ,3 + ,47 + ,21 + ,26757 + ,53229 + ,47 + ,140281 + ,0 + ,35 + ,28 + ,22527 + ,29877 + ,44 + ,164249 + ,0 + ,54 + ,35 + ,44810 + ,37310 + ,53 + ,11796 + ,0 + ,1 + ,2 + ,0 + ,0 + ,0 + ,10674 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,151322 + ,0 + ,46 + ,18 + ,100674 + ,50067 + ,40 + ,6836 + ,0 + ,0 + ,1 + ,0 + ,0 + ,0 + ,174712 + ,6 + ,51 + ,21 + ,57786 + ,47708 + ,57 + ,5118 + ,0 + ,5 + ,0 + ,0 + ,0 + ,0 + ,40248 + ,1 + ,8 + ,4 + ,5444 + ,6012 + ,6 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,127628 + ,0 + ,38 + ,29 + ,28470 + ,27749 + ,24 + ,88837 + ,0 + ,21 + ,26 + ,61849 + ,47555 + ,34 + ,7131 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,9056 + ,0 + ,0 + ,4 + ,2179 + ,1336 + ,10 + ,87957 + ,1 + ,18 + ,19 + ,8019 + ,11017 + ,16 + ,144470 + ,0 + ,53 + ,22 + ,39644 + ,55184 + ,93 + ,111408 + ,1 + ,17 + ,22 + ,23494 + ,43485 + ,28) + ,dim=c(7 + ,144) + ,dimnames=list(c('timeRFC' + ,'compshared' + ,'blogged' + ,'reviewedcomp' + ,'characters' + ,'seconds' + ,'inclhyperlinks') + ,1:144)) > y <- array(NA,dim=c(7,144),dimnames=list(c('timeRFC','compshared','blogged','reviewedcomp','characters','seconds','inclhyperlinks'),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 = '' > par2 = 'none' > par1 = '1' > library(party) Loading required package: survival Loading required package: splines Loading required package: grid Loading required package: modeltools Loading required package: stats4 Loading required package: coin Loading required package: mvtnorm Loading required package: zoo Loading required package: sandwich Loading required package: strucchange Loading required package: vcd Loading required package: MASS Loading required package: colorspace > library(Hmisc) Attaching package: 'Hmisc' The following object(s) are masked from 'package:survival': untangle.specials The following object(s) are masked from 'package:base': format.pval, round.POSIXt, trunc.POSIXt, units > par1 <- as.numeric(par1) > par3 <- as.numeric(par3) > x <- data.frame(t(y)) > is.data.frame(x) [1] TRUE > x <- x[!is.na(x[,par1]),] > k <- length(x[1,]) > n <- length(x[,1]) > colnames(x)[par1] [1] "timeRFC" > x[,par1] [1] 162687 201906 7215 146367 257045 524450 188294 195674 177020 325899 [11] 121844 203938 113213 220751 172905 156326 145178 89171 172624 39790 [21] 87927 241285 195820 146946 159763 207078 212394 201536 394662 217892 [31] 182286 181740 137978 255929 236489 0 230761 132807 157118 253254 [41] 269329 161273 107181 195891 139667 171101 81407 247563 239807 172743 [51] 48188 169355 315622 241518 195583 159913 220241 101694 157258 202536 [61] 173505 150518 141491 125612 166049 124197 195043 138708 116552 31970 [71] 258158 151184 135926 119629 171518 108949 183471 159966 93786 84971 [81] 88882 304603 75101 145043 95827 173924 241957 115367 118408 164078 [91] 158931 184139 152856 144014 62535 245196 199841 19349 247280 159408 [101] 72128 104253 151090 137382 87448 27676 165507 132148 0 95778 [111] 109001 158833 147690 89887 3616 0 199005 160930 177948 136061 [121] 43410 184277 108858 141744 60493 19764 177559 140281 164249 11796 [131] 10674 151322 6836 174712 5118 40248 0 127628 88837 7131 [141] 9056 87957 144470 111408 > 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 3616 5118 6836 7131 7215 9056 10674 11796 19349 19764 4 1 1 1 1 1 1 1 1 1 1 27676 31970 39790 40248 43410 48188 60493 62535 72128 75101 81407 1 1 1 1 1 1 1 1 1 1 1 84971 87448 87927 87957 88837 88882 89171 89887 93786 95778 95827 1 1 1 1 1 1 1 1 1 1 1 101694 104253 107181 108858 108949 109001 111408 113213 115367 116552 118408 1 1 1 1 1 1 1 1 1 1 1 119629 121844 124197 125612 127628 132148 132807 135926 136061 137382 137978 1 1 1 1 1 1 1 1 1 1 1 138708 139667 140281 141491 141744 144014 144470 145043 145178 146367 146946 1 1 1 1 1 1 1 1 1 1 1 147690 150518 151090 151184 151322 152856 156326 157118 157258 158833 158931 1 1 1 1 1 1 1 1 1 1 1 159408 159763 159913 159966 160930 161273 162687 164078 164249 165507 166049 1 1 1 1 1 1 1 1 1 1 1 169355 171101 171518 172624 172743 172905 173505 173924 174712 177020 177559 1 1 1 1 1 1 1 1 1 1 1 177948 181740 182286 183471 184139 184277 188294 195043 195583 195674 195820 1 1 1 1 1 1 1 1 1 1 1 195891 199005 199841 201536 201906 202536 203938 207078 212394 217892 220241 1 1 1 1 1 1 1 1 1 1 1 220751 230761 236489 239807 241285 241518 241957 245196 247280 247563 253254 1 1 1 1 1 1 1 1 1 1 1 255929 257045 258158 269329 304603 315622 325899 394662 524450 1 1 1 1 1 1 1 1 1 > colnames(x) [1] "timeRFC" "compshared" "blogged" "reviewedcomp" [5] "characters" "seconds" "inclhyperlinks" > colnames(x)[par1] [1] "timeRFC" > x[,par1] [1] 162687 201906 7215 146367 257045 524450 188294 195674 177020 325899 [11] 121844 203938 113213 220751 172905 156326 145178 89171 172624 39790 [21] 87927 241285 195820 146946 159763 207078 212394 201536 394662 217892 [31] 182286 181740 137978 255929 236489 0 230761 132807 157118 253254 [41] 269329 161273 107181 195891 139667 171101 81407 247563 239807 172743 [51] 48188 169355 315622 241518 195583 159913 220241 101694 157258 202536 [61] 173505 150518 141491 125612 166049 124197 195043 138708 116552 31970 [71] 258158 151184 135926 119629 171518 108949 183471 159966 93786 84971 [81] 88882 304603 75101 145043 95827 173924 241957 115367 118408 164078 [91] 158931 184139 152856 144014 62535 245196 199841 19349 247280 159408 [101] 72128 104253 151090 137382 87448 27676 165507 132148 0 95778 [111] 109001 158833 147690 89887 3616 0 199005 160930 177948 136061 [121] 43410 184277 108858 141744 60493 19764 177559 140281 164249 11796 [131] 10674 151322 6836 174712 5118 40248 0 127628 88837 7131 [141] 9056 87957 144470 111408 > 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/1zxu51324655897.tab") + } + } > m Conditional inference tree with 6 terminal nodes Response: timeRFC Inputs: compshared, blogged, reviewedcomp, characters, seconds, inclhyperlinks Number of observations: 144 1) seconds <= 14812; criterion = 1, statistic = 103.443 2) blogged <= 12; criterion = 1, statistic = 19.481 3)* weights = 19 2) blogged > 12 4)* weights = 9 1) seconds > 14812 5) seconds <= 55516; criterion = 1, statistic = 66.898 6) blogged <= 36; criterion = 1, statistic = 16.11 7)* weights = 19 6) blogged > 36 8)* weights = 62 5) seconds > 55516 9) seconds <= 97057; criterion = 1, statistic = 18.354 10)* weights = 28 9) seconds > 97057 11)* weights = 7 > postscript(file="/var/wessaorg/rcomp/tmp/20bc91324655897.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/3gvbh1324655897.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 162687 159178.26 3508.7419 2 201906 209194.89 -7288.8929 3 7215 17536.37 -10321.3684 4 146367 159178.26 -12811.2581 5 257045 209194.89 47850.1071 6 524450 315780.86 208669.1429 7 188294 209194.89 -20900.8929 8 195674 209194.89 -13520.8929 9 177020 159178.26 17841.7419 10 325899 315780.86 10118.1429 11 121844 159178.26 -37334.2581 12 203938 209194.89 -5256.8929 13 113213 159178.26 -45965.2581 14 220751 209194.89 11556.1071 15 172905 159178.26 13726.7419 16 156326 159178.26 -2852.2581 17 145178 209194.89 -64016.8929 18 89171 84994.22 4176.7778 19 172624 159178.26 13445.7419 20 39790 84994.22 -45204.2222 21 87927 111624.68 -23697.6842 22 241285 209194.89 32090.1071 23 195820 159178.26 36641.7419 24 146946 159178.26 -12232.2581 25 159763 159178.26 584.7419 26 207078 159178.26 47899.7419 27 212394 209194.89 3199.1071 28 201536 315780.86 -114244.8571 29 394662 315780.86 78881.1429 30 217892 209194.89 8697.1071 31 182286 159178.26 23107.7419 32 181740 209194.89 -27454.8929 33 137978 159178.26 -21200.2581 34 255929 159178.26 96750.7419 35 236489 209194.89 27294.1071 36 0 17536.37 -17536.3684 37 230761 159178.26 71582.7419 38 132807 159178.26 -26371.2581 39 157118 159178.26 -2060.2581 40 253254 315780.86 -62526.8571 41 269329 209194.89 60134.1071 42 161273 159178.26 2094.7419 43 107181 111624.68 -4443.6842 44 195891 209194.89 -13303.8929 45 139667 159178.26 -19511.2581 46 171101 159178.26 11922.7419 47 81407 111624.68 -30217.6842 48 247563 159178.26 88384.7419 49 239807 209194.89 30612.1071 50 172743 159178.26 13564.7419 51 48188 17536.37 30651.6316 52 169355 159178.26 10176.7419 53 315622 315780.86 -158.8571 54 241518 159178.26 82339.7419 55 195583 209194.89 -13611.8929 56 159913 159178.26 734.7419 57 220241 159178.26 61062.7419 58 101694 111624.68 -9930.6842 59 157258 209194.89 -51936.8929 60 202536 111624.68 90911.3158 61 173505 159178.26 14326.7419 62 150518 159178.26 -8660.2581 63 141491 159178.26 -17687.2581 64 125612 159178.26 -33566.2581 65 166049 111624.68 54424.3158 66 124197 159178.26 -34981.2581 67 195043 315780.86 -120737.8571 68 138708 159178.26 -20470.2581 69 116552 159178.26 -42626.2581 70 31970 17536.37 14433.6316 71 258158 209194.89 48963.1071 72 151184 159178.26 -7994.2581 73 135926 159178.26 -23252.2581 74 119629 84994.22 34634.7778 75 171518 159178.26 12339.7419 76 108949 84994.22 23954.7778 77 183471 159178.26 24292.7419 78 159966 209194.89 -49228.8929 79 93786 111624.68 -17838.6842 80 84971 111624.68 -26653.6842 81 88882 159178.26 -70296.2581 82 304603 209194.89 95408.1071 83 75101 111624.68 -36523.6842 84 145043 159178.26 -14135.2581 85 95827 84994.22 10832.7778 86 173924 159178.26 14745.7419 87 241957 209194.89 32762.1071 88 115367 159178.26 -43811.2581 89 118408 159178.26 -40770.2581 90 164078 159178.26 4899.7419 91 158931 209194.89 -50263.8929 92 184139 209194.89 -25055.8929 93 152856 159178.26 -6322.2581 94 144014 111624.68 32389.3158 95 62535 111624.68 -49089.6842 96 245196 209194.89 36001.1071 97 199841 209194.89 -9353.8929 98 19349 84994.22 -65645.2222 99 247280 159178.26 88101.7419 100 159408 159178.26 229.7419 101 72128 84994.22 -12866.2222 102 104253 159178.26 -54925.2581 103 151090 159178.26 -8088.2581 104 137382 159178.26 -21796.2581 105 87448 111624.68 -24176.6842 106 27676 17536.37 10139.6316 107 165507 159178.26 6328.7419 108 132148 84994.22 47153.7778 109 0 17536.37 -17536.3684 110 95778 159178.26 -63400.2581 111 109001 111624.68 -2623.6842 112 158833 159178.26 -345.2581 113 147690 159178.26 -11488.2581 114 89887 111624.68 -21737.6842 115 3616 17536.37 -13920.3684 116 0 17536.37 -17536.3684 117 199005 209194.89 -10189.8929 118 160930 209194.89 -48264.8929 119 177948 111624.68 66323.3158 120 136061 159178.26 -23117.2581 121 43410 17536.37 25873.6316 122 184277 209194.89 -24917.8929 123 108858 111624.68 -2766.6842 124 141744 159178.26 -17434.2581 125 60493 17536.37 42956.6316 126 19764 17536.37 2227.6316 127 177559 159178.26 18380.7419 128 140281 111624.68 28656.3158 129 164249 159178.26 5070.7419 130 11796 17536.37 -5740.3684 131 10674 17536.37 -6862.3684 132 151322 159178.26 -7856.2581 133 6836 17536.37 -10700.3684 134 174712 159178.26 15533.7419 135 5118 17536.37 -12418.3684 136 40248 17536.37 22711.6316 137 0 17536.37 -17536.3684 138 127628 159178.26 -31550.2581 139 88837 111624.68 -22787.6842 140 7131 17536.37 -10405.3684 141 9056 17536.37 -8480.3684 142 87957 84994.22 2962.7778 143 144470 159178.26 -14708.2581 144 111408 111624.68 -216.6842 > 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/43h8z1324655897.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/5d8d01324655897.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/6iqkf1324655897.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/7a0qr1324655897.tab") + } > > try(system("convert tmp/20bc91324655897.ps tmp/20bc91324655897.png",intern=TRUE)) character(0) > try(system("convert tmp/3gvbh1324655897.ps tmp/3gvbh1324655897.png",intern=TRUE)) character(0) > try(system("convert tmp/43h8z1324655897.ps tmp/43h8z1324655897.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.305 0.268 3.566