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(112285 + ,210907 + ,81 + ,79 + ,30 + ,84786 + ,120982 + ,55 + ,58 + ,28 + ,83123 + ,176508 + ,50 + ,60 + ,38 + ,101193 + ,179321 + ,125 + ,108 + ,30 + ,38361 + ,123185 + ,40 + ,49 + ,22 + ,68504 + ,52746 + ,37 + ,0 + ,26 + ,119182 + ,385534 + ,63 + ,121 + ,25 + ,22807 + ,33170 + ,44 + ,1 + ,18 + ,116174 + ,149061 + ,66 + ,43 + ,26 + ,57635 + ,165446 + ,57 + ,69 + ,25 + ,66198 + ,237213 + ,74 + ,78 + ,38 + ,71701 + ,173326 + ,49 + ,86 + ,44 + ,57793 + ,133131 + ,52 + ,44 + ,30 + ,80444 + ,258873 + ,88 + ,104 + ,40 + ,53855 + ,180083 + ,36 + ,63 + ,34 + ,97668 + ,324799 + ,108 + ,158 + ,47 + ,133824 + ,230964 + ,43 + ,102 + ,30 + ,101481 + ,236785 + ,75 + ,77 + ,31 + ,99645 + ,135473 + ,32 + ,82 + ,23 + ,114789 + ,202925 + ,44 + ,115 + ,36 + ,99052 + ,215147 + ,85 + ,101 + ,36 + ,67654 + ,344297 + ,86 + ,80 + ,30 + ,65553 + ,153935 + ,56 + ,50 + ,25 + ,97500 + ,132943 + ,50 + ,83 + ,39 + ,69112 + ,174724 + ,135 + ,123 + ,34 + ,82753 + ,174415 + ,63 + ,73 + ,31 + ,85323 + ,225548 + ,81 + ,81 + ,31 + ,72654 + ,223632 + ,52 + ,105 + ,33 + ,30727 + ,124817 + ,44 + ,47 + ,25 + ,77873 + ,221698 + ,113 + ,105 + ,33 + ,117478 + ,210767 + ,39 + ,94 + ,35 + ,74007 + ,170266 + ,73 + ,44 + ,42 + ,90183 + ,260561 + ,48 + ,114 + ,43 + ,61542 + ,84853 + ,33 + ,38 + ,30 + ,101494 + ,294424 + ,59 + ,107 + ,33 + ,55813 + ,215641 + ,69 + ,71 + ,32 + ,79215 + ,325107 + ,64 + ,84 + ,36 + ,55461 + ,167542 + ,59 + ,59 + ,28 + ,31081 + ,106408 + ,32 + ,33 + ,14 + ,83122 + ,265769 + ,37 + ,96 + ,32 + ,70106 + ,269651 + ,31 + ,106 + ,30 + ,60578 + ,149112 + ,65 + ,56 + ,35 + ,79892 + ,152871 + ,74 + ,59 + ,28 + ,49810 + ,111665 + ,54 + ,39 + ,28 + ,71570 + ,116408 + ,76 + ,34 + ,39 + ,100708 + ,362301 + ,715 + ,76 + ,34 + ,33032 + ,78800 + ,57 + ,20 + ,26 + ,82875 + ,183167 + ,66 + ,91 + ,39 + ,139077 + ,277965 + ,106 + ,115 + ,39 + ,71595 + ,150629 + ,54 + ,85 + ,33 + ,72260 + ,168809 + ,32 + ,76 + ,28 + ,5950 + ,24188 + ,20 + ,8 + ,4 + ,115762 + ,329267 + ,71 + ,79 + ,39 + ,32551 + ,65029 + ,21 + ,21 + ,18 + ,31701 + ,101097 + ,70 + ,30 + ,14 + ,80670 + ,218946 + ,112 + ,76 + ,29 + ,143558 + ,244052 + ,66 + ,101 + ,44 + ,120733 + ,233328 + ,165 + ,92 + ,28 + ,105195 + ,256462 + ,56 + ,123 + ,35 + ,73107 + ,206161 + ,61 + ,75 + ,28 + ,132068 + ,311473 + ,53 + ,128 + ,38 + ,149193 + ,235800 + ,127 + ,105 + ,23 + ,46821 + ,177939 + ,63 + ,55 + ,36 + ,87011 + ,207176 + ,38 + ,56 + ,32 + ,95260 + ,196553 + ,50 + ,41 + ,29 + ,55183 + ,174184 + ,52 + ,72 + ,25 + ,106671 + ,143246 + ,42 + ,67 + ,27 + ,73511 + ,187559 + ,76 + ,75 + ,36 + ,92945 + ,187681 + ,67 + ,114 + ,28 + ,78664 + ,119016 + ,50 + ,118 + ,23 + ,70054 + ,182192 + ,53 + ,77 + ,40 + ,22618 + ,73566 + ,39 + ,22 + ,23 + ,74011 + ,194979 + ,50 + ,66 + ,40 + ,83737 + ,167488 + ,77 + ,69 + ,28 + ,69094 + ,143756 + ,57 + ,105 + ,34 + ,93133 + ,275541 + ,73 + ,116 + ,33 + ,95536 + ,243199 + ,34 + ,88 + ,28 + ,225920 + ,182999 + ,39 + ,73 + ,34 + ,62133 + ,135649 + ,46 + ,99 + ,30 + ,61370 + ,152299 + ,63 + ,62 + ,33 + ,43836 + ,120221 + ,35 + ,53 + ,22 + ,106117 + ,346485 + ,106 + ,118 + ,38 + ,38692 + ,145790 + ,43 + ,30 + ,26 + ,84651 + ,193339 + ,47 + ,100 + ,35 + ,56622 + ,80953 + ,31 + ,49 + ,8 + ,15986 + ,122774 + ,162 + ,24 + ,24 + ,95364 + ,130585 + ,57 + ,67 + ,29 + ,89691 + ,286468 + ,263 + ,57 + ,29 + ,67267 + ,241066 + ,78 + ,75 + ,45 + ,126846 + ,148446 + ,63 + ,135 + ,37 + ,41140 + ,204713 + ,54 + ,68 + ,33 + ,102860 + ,182079 + ,63 + ,124 + ,33 + ,51715 + ,140344 + ,77 + ,33 + ,25 + ,55801 + ,220516 + ,79 + ,98 + ,32 + ,111813 + ,243060 + ,110 + ,58 + ,29 + ,120293 + ,162765 + ,56 + ,68 + ,28 + ,138599 + ,182613 + ,56 + ,81 + ,28 + ,161647 + ,232138 + ,43 + ,131 + ,31 + ,115929 + ,265318 + ,111 + ,110 + ,52 + ,162901 + ,310839 + ,62 + ,130 + ,24 + ,109825 + ,225060 + ,56 + ,93 + ,41 + ,129838 + ,232317 + ,74 + ,118 + ,33 + ,37510 + ,144966 + ,60 + ,39 + ,32 + ,43750 + ,43287 + ,43 + ,13 + ,19 + ,40652 + ,155754 + ,68 + ,74 + ,20 + ,87771 + ,164709 + ,53 + ,81 + ,31 + ,85872 + ,201940 + ,87 + ,109 + ,31 + ,89275 + ,235454 + ,46 + ,151 + ,32 + ,192565 + ,99466 + ,32 + ,28 + ,23 + ,140867 + ,100750 + ,67 + ,83 + ,30 + ,120662 + ,224549 + ,47 + ,54 + ,31 + ,101338 + ,243511 + ,65 + ,133 + ,42 + ,1168 + ,22938 + ,9 + ,12 + ,1 + ,65567 + ,152474 + ,45 + ,106 + ,32 + ,25162 + ,61857 + ,25 + ,23 + ,11 + ,40735 + ,132487 + ,97 + ,71 + ,36 + ,91413 + ,317394 + ,53 + ,116 + ,31 + ,855 + ,21054 + ,2 + ,4 + ,0 + ,97068 + ,209641 + ,52 + ,62 + ,24 + ,14116 + ,31414 + ,22 + ,18 + ,8 + ,76643 + ,244749 + ,144 + ,98 + ,33 + ,110681 + ,184510 + ,60 + ,64 + ,40 + ,92696 + ,128423 + ,89 + ,32 + ,38 + ,94785 + ,97839 + ,42 + ,25 + ,24 + ,8773 + ,38214 + ,52 + ,16 + ,8 + ,83209 + ,151101 + ,98 + ,48 + ,35 + ,93815 + ,272458 + ,99 + ,100 + ,43 + ,86687 + ,172494 + ,52 + ,46 + ,43 + ,105547 + ,328107 + ,125 + ,129 + ,41 + ,103487 + ,250579 + ,106 + ,130 + ,38 + ,213688 + ,351067 + ,95 + ,136 + ,45 + ,71220 + ,158015 + ,40 + ,59 + ,31 + ,56926 + ,85439 + ,43 + ,32 + ,28 + ,91721 + ,229242 + ,128 + ,63 + ,31 + ,115168 + ,351619 + ,142 + ,95 + ,40 + ,111194 + ,84207 + ,73 + ,14 + ,30 + ,135777 + ,324598 + ,128 + ,113 + ,37 + ,51513 + ,131069 + ,61 + ,47 + ,30 + ,74163 + ,204271 + ,73 + ,92 + ,35 + ,51633 + ,165543 + ,148 + ,70 + ,32 + ,75345 + ,141722 + ,64 + ,19 + ,27 + ,98952 + ,299775 + ,97 + ,91 + ,31 + ,102372 + ,195838 + ,50 + ,111 + ,31 + ,37238 + ,173260 + ,37 + ,41 + ,21 + ,103772 + ,254488 + ,50 + ,120 + ,39 + ,123969 + ,104389 + ,105 + ,135 + ,41 + ,135400 + ,199476 + ,46 + ,87 + ,32 + ,130115 + ,224330 + ,52 + ,131 + ,39 + ,6023 + ,14688 + ,0 + ,4 + ,0 + ,64466 + ,181633 + ,48 + ,47 + ,30 + ,54990 + ,271856 + ,91 + ,109 + ,37 + ,1644 + ,7199 + ,0 + ,7 + ,0 + ,6179 + ,46660 + ,7 + ,12 + ,5 + ,3926 + ,17547 + ,3 + ,0 + ,1 + ,34777 + ,95227 + ,70 + ,37 + ,32 + ,73224 + ,152601 + ,36 + ,46 + ,24) + ,dim=c(5 + ,156) + ,dimnames=list(c('Total_size' + ,'Time_RFC' + ,'PR_views' + ,'Blogged' + ,'Reviewed') + ,1:156)) > y <- array(NA,dim=c(5,156),dimnames=list(c('Total_size','Time_RFC','PR_views','Blogged','Reviewed'),1:156)) > 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 = '2' > 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_RFC" > x[,par1] [1] 210907 120982 176508 179321 123185 52746 385534 33170 149061 165446 [11] 237213 173326 133131 258873 180083 324799 230964 236785 135473 202925 [21] 215147 344297 153935 132943 174724 174415 225548 223632 124817 221698 [31] 210767 170266 260561 84853 294424 215641 325107 167542 106408 265769 [41] 269651 149112 152871 111665 116408 362301 78800 183167 277965 150629 [51] 168809 24188 329267 65029 101097 218946 244052 233328 256462 206161 [61] 311473 235800 177939 207176 196553 174184 143246 187559 187681 119016 [71] 182192 73566 194979 167488 143756 275541 243199 182999 135649 152299 [81] 120221 346485 145790 193339 80953 122774 130585 286468 241066 148446 [91] 204713 182079 140344 220516 243060 162765 182613 232138 265318 310839 [101] 225060 232317 144966 43287 155754 164709 201940 235454 99466 100750 [111] 224549 243511 22938 152474 61857 132487 317394 21054 209641 31414 [121] 244749 184510 128423 97839 38214 151101 272458 172494 328107 250579 [131] 351067 158015 85439 229242 351619 84207 324598 131069 204271 165543 [141] 141722 299775 195838 173260 254488 104389 199476 224330 14688 181633 [151] 271856 7199 46660 17547 95227 152601 > 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]) 7199 14688 17547 21054 22938 24188 31414 33170 38214 43287 46660 1 1 1 1 1 1 1 1 1 1 1 52746 61857 65029 73566 78800 80953 84207 84853 85439 95227 97839 1 1 1 1 1 1 1 1 1 1 1 99466 100750 101097 104389 106408 111665 116408 119016 120221 120982 122774 1 1 1 1 1 1 1 1 1 1 1 123185 124817 128423 130585 131069 132487 132943 133131 135473 135649 140344 1 1 1 1 1 1 1 1 1 1 1 141722 143246 143756 144966 145790 148446 149061 149112 150629 151101 152299 1 1 1 1 1 1 1 1 1 1 1 152474 152601 152871 153935 155754 158015 162765 164709 165446 165543 167488 1 1 1 1 1 1 1 1 1 1 1 167542 168809 170266 172494 173260 173326 174184 174415 174724 176508 177939 1 1 1 1 1 1 1 1 1 1 1 179321 180083 181633 182079 182192 182613 182999 183167 184510 187559 187681 1 1 1 1 1 1 1 1 1 1 1 193339 194979 195838 196553 199476 201940 202925 204271 204713 206161 207176 1 1 1 1 1 1 1 1 1 1 1 209641 210767 210907 215147 215641 218946 220516 221698 223632 224330 224549 1 1 1 1 1 1 1 1 1 1 1 225060 225548 229242 230964 232138 232317 233328 235454 235800 236785 237213 1 1 1 1 1 1 1 1 1 1 1 241066 243060 243199 243511 244052 244749 250579 254488 256462 258873 260561 1 1 1 1 1 1 1 1 1 1 1 265318 265769 269651 271856 272458 275541 277965 286468 294424 299775 310839 1 1 1 1 1 1 1 1 1 1 1 311473 317394 324598 324799 325107 328107 329267 344297 346485 351067 351619 1 1 1 1 1 1 1 1 1 1 1 362301 385534 1 1 > colnames(x) [1] "Total_size" "Time_RFC" "PR_views" "Blogged" "Reviewed" > colnames(x)[par1] [1] "Time_RFC" > x[,par1] [1] 210907 120982 176508 179321 123185 52746 385534 33170 149061 165446 [11] 237213 173326 133131 258873 180083 324799 230964 236785 135473 202925 [21] 215147 344297 153935 132943 174724 174415 225548 223632 124817 221698 [31] 210767 170266 260561 84853 294424 215641 325107 167542 106408 265769 [41] 269651 149112 152871 111665 116408 362301 78800 183167 277965 150629 [51] 168809 24188 329267 65029 101097 218946 244052 233328 256462 206161 [61] 311473 235800 177939 207176 196553 174184 143246 187559 187681 119016 [71] 182192 73566 194979 167488 143756 275541 243199 182999 135649 152299 [81] 120221 346485 145790 193339 80953 122774 130585 286468 241066 148446 [91] 204713 182079 140344 220516 243060 162765 182613 232138 265318 310839 [101] 225060 232317 144966 43287 155754 164709 201940 235454 99466 100750 [111] 224549 243511 22938 152474 61857 132487 317394 21054 209641 31414 [121] 244749 184510 128423 97839 38214 151101 272458 172494 328107 250579 [131] 351067 158015 85439 229242 351619 84207 324598 131069 204271 165543 [141] 141722 299775 195838 173260 254488 104389 199476 224330 14688 181633 [151] 271856 7199 46660 17547 95227 152601 > 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/1bmp41324132823.tab") + } + } > m Conditional inference tree with 6 terminal nodes Response: Time_RFC Inputs: Total_size, PR_views, Blogged, Reviewed Number of observations: 156 1) Blogged <= 53; criterion = 1, statistic = 86.781 2) Blogged <= 23; criterion = 1, statistic = 31.592 3)* weights = 18 2) Blogged > 23 4)* weights = 29 1) Blogged > 53 5) Blogged <= 74; criterion = 1, statistic = 16.234 6) PR_views <= 68; criterion = 0.982, statistic = 8.035 7)* weights = 22 6) PR_views > 68 8)* weights = 8 5) Blogged > 74 9) PR_views <= 85; criterion = 0.983, statistic = 8.11 10)* weights = 55 9) PR_views > 85 11)* weights = 24 > postscript(file="/var/wessaorg/rcomp/tmp/2kmd11324132823.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/3il861324132823.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 210907 218589.04 -7682.0364 2 120982 172611.00 -51629.0000 3 176508 172611.00 3897.0000 4 179321 268541.33 -89220.3333 5 123185 130861.34 -7676.3448 6 52746 47682.56 5063.4444 7 385534 218589.04 166944.9636 8 33170 47682.56 -14512.5556 9 149061 130861.34 18199.6552 10 165446 172611.00 -7165.0000 11 237213 218589.04 18623.9636 12 173326 218589.04 -45263.0364 13 133131 130861.34 2269.6552 14 258873 268541.33 -9668.3333 15 180083 172611.00 7472.0000 16 324799 268541.33 56257.6667 17 230964 218589.04 12374.9636 18 236785 218589.04 18195.9636 19 135473 218589.04 -83116.0364 20 202925 218589.04 -15664.0364 21 215147 218589.04 -3442.0364 22 344297 268541.33 75755.6667 23 153935 130861.34 23073.6552 24 132943 218589.04 -85646.0364 25 174724 268541.33 -93817.3333 26 174415 172611.00 1804.0000 27 225548 218589.04 6958.9636 28 223632 218589.04 5042.9636 29 124817 130861.34 -6044.3448 30 221698 268541.33 -46843.3333 31 210767 218589.04 -7822.0364 32 170266 130861.34 39404.6552 33 260561 218589.04 41971.9636 34 84853 130861.34 -46008.3448 35 294424 218589.04 75834.9636 36 215641 199100.00 16541.0000 37 325107 218589.04 106517.9636 38 167542 172611.00 -5069.0000 39 106408 130861.34 -24453.3448 40 265769 218589.04 47179.9636 41 269651 218589.04 51061.9636 42 149112 172611.00 -23499.0000 43 152871 199100.00 -46229.0000 44 111665 130861.34 -19196.3448 45 116408 130861.34 -14453.3448 46 362301 268541.33 93759.6667 47 78800 47682.56 31117.4444 48 183167 218589.04 -35422.0364 49 277965 268541.33 9423.6667 50 150629 218589.04 -67960.0364 51 168809 218589.04 -49780.0364 52 24188 47682.56 -23494.5556 53 329267 218589.04 110677.9636 54 65029 47682.56 17346.4444 55 101097 130861.34 -29764.3448 56 218946 268541.33 -49595.3333 57 244052 218589.04 25462.9636 58 233328 268541.33 -35213.3333 59 256462 218589.04 37872.9636 60 206161 218589.04 -12428.0364 61 311473 218589.04 92883.9636 62 235800 268541.33 -32741.3333 63 177939 172611.00 5328.0000 64 207176 172611.00 34565.0000 65 196553 130861.34 65691.6552 66 174184 172611.00 1573.0000 67 143246 172611.00 -29365.0000 68 187559 218589.04 -31030.0364 69 187681 218589.04 -30908.0364 70 119016 218589.04 -99573.0364 71 182192 218589.04 -36397.0364 72 73566 47682.56 25883.4444 73 194979 172611.00 22368.0000 74 167488 199100.00 -31612.0000 75 143756 218589.04 -74833.0364 76 275541 218589.04 56951.9636 77 243199 218589.04 24609.9636 78 182999 172611.00 10388.0000 79 135649 218589.04 -82940.0364 80 152299 172611.00 -20312.0000 81 120221 130861.34 -10640.3448 82 346485 268541.33 77943.6667 83 145790 130861.34 14928.6552 84 193339 218589.04 -25250.0364 85 80953 130861.34 -49908.3448 86 122774 130861.34 -8087.3448 87 130585 172611.00 -42026.0000 88 286468 199100.00 87368.0000 89 241066 218589.04 22476.9636 90 148446 218589.04 -70143.0364 91 204713 172611.00 32102.0000 92 182079 218589.04 -36510.0364 93 140344 130861.34 9482.6552 94 220516 218589.04 1926.9636 95 243060 199100.00 43960.0000 96 162765 172611.00 -9846.0000 97 182613 218589.04 -35976.0364 98 232138 218589.04 13548.9636 99 265318 268541.33 -3223.3333 100 310839 218589.04 92249.9636 101 225060 218589.04 6470.9636 102 232317 218589.04 13727.9636 103 144966 130861.34 14104.6552 104 43287 47682.56 -4395.5556 105 155754 172611.00 -16857.0000 106 164709 218589.04 -53880.0364 107 201940 268541.33 -66601.3333 108 235454 218589.04 16864.9636 109 99466 130861.34 -31395.3448 110 100750 218589.04 -117839.0364 111 224549 172611.00 51938.0000 112 243511 218589.04 24921.9636 113 22938 47682.56 -24744.5556 114 152474 218589.04 -66115.0364 115 61857 47682.56 14174.4444 116 132487 199100.00 -66613.0000 117 317394 218589.04 98804.9636 118 21054 47682.56 -26628.5556 119 209641 172611.00 37030.0000 120 31414 47682.56 -16268.5556 121 244749 268541.33 -23792.3333 122 184510 172611.00 11899.0000 123 128423 130861.34 -2438.3448 124 97839 130861.34 -33022.3448 125 38214 47682.56 -9468.5556 126 151101 130861.34 20239.6552 127 272458 268541.33 3916.6667 128 172494 130861.34 41632.6552 129 328107 268541.33 59565.6667 130 250579 268541.33 -17962.3333 131 351067 268541.33 82525.6667 132 158015 172611.00 -14596.0000 133 85439 130861.34 -45422.3448 134 229242 199100.00 30142.0000 135 351619 268541.33 83077.6667 136 84207 47682.56 36524.4444 137 324598 268541.33 56056.6667 138 131069 130861.34 207.6552 139 204271 218589.04 -14318.0364 140 165543 199100.00 -33557.0000 141 141722 47682.56 94039.4444 142 299775 268541.33 31233.6667 143 195838 218589.04 -22751.0364 144 173260 130861.34 42398.6552 145 254488 218589.04 35898.9636 146 104389 268541.33 -164152.3333 147 199476 218589.04 -19113.0364 148 224330 218589.04 5740.9636 149 14688 47682.56 -32994.5556 150 181633 130861.34 50771.6552 151 271856 268541.33 3314.6667 152 7199 47682.56 -40483.5556 153 46660 47682.56 -1022.5556 154 17547 47682.56 -30135.5556 155 95227 130861.34 -35634.3448 156 152601 130861.34 21739.6552 > 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/4n2ze1324132823.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/5khjb1324132823.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/6ibnp1324132823.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/7dru61324132823.tab") + } > > try(system("convert tmp/2kmd11324132823.ps tmp/2kmd11324132823.png",intern=TRUE)) character(0) > try(system("convert tmp/3il861324132823.ps tmp/3il861324132823.png",intern=TRUE)) character(0) > try(system("convert tmp/4n2ze1324132823.ps tmp/4n2ze1324132823.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.193 0.273 3.463