R version 2.12.1 (2010-12-16) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list(264530 + ,34 + ,124252 + ,135248 + ,30 + ,98956 + ,207253 + ,42 + ,98073 + ,202898 + ,35 + ,106816 + ,145249 + ,26 + ,41449 + ,65295 + ,31 + ,76173 + ,439387 + ,29 + ,177551 + ,33186 + ,18 + ,22807 + ,183696 + ,30 + ,126938 + ,190673 + ,29 + ,61680 + ,287239 + ,42 + ,72117 + ,205260 + ,50 + ,79738 + ,141987 + ,33 + ,57793 + ,322679 + ,49 + ,91677 + ,199717 + ,40 + ,64631 + ,349227 + ,52 + ,106385 + ,276709 + ,33 + ,161961 + ,273576 + ,35 + ,112669 + ,157448 + ,25 + ,114029 + ,242782 + ,43 + ,124550 + ,256814 + ,40 + ,105416 + ,405942 + ,37 + ,72875 + ,161189 + ,25 + ,81964 + ,156389 + ,46 + ,104880 + ,200181 + ,41 + ,76302 + ,192645 + ,35 + ,96740 + ,249893 + ,38 + ,93071 + ,241171 + ,36 + ,78912 + ,143182 + ,28 + ,35224 + ,285266 + ,37 + ,90694 + ,243048 + ,40 + ,125369 + ,176062 + ,42 + ,80849 + ,305210 + ,48 + ,104434 + ,87995 + ,33 + ,65702 + ,343613 + ,39 + ,108179 + ,264159 + ,37 + ,63583 + ,394976 + ,41 + ,95066 + ,192718 + ,32 + ,62486 + ,114673 + ,17 + ,31081 + ,310108 + ,39 + ,94584 + ,292891 + ,36 + ,87408 + ,157518 + ,38 + ,68966 + ,180362 + ,36 + ,88766 + ,146175 + ,35 + ,57139 + ,140319 + ,45 + ,90586 + ,405267 + ,38 + ,109249 + ,78800 + ,26 + ,33032 + ,201970 + ,45 + ,96056 + ,309762 + ,46 + ,146648 + ,166270 + ,41 + ,80613 + ,199186 + ,34 + ,87026 + ,24188 + ,4 + ,5950 + ,346142 + ,41 + ,131106 + ,65029 + ,18 + ,32551 + ,101097 + ,14 + ,31701 + ,255082 + ,37 + ,91072 + ,287314 + ,53 + ,159803 + ,308944 + ,36 + ,143950 + ,280943 + ,37 + ,112368 + ,225816 + ,36 + ,82124 + ,348955 + ,46 + ,144068 + ,283283 + ,28 + ,162627 + ,199642 + ,42 + ,55062 + ,232791 + ,38 + ,95329 + ,212262 + ,33 + ,105612 + ,201345 + ,28 + ,62853 + ,180424 + ,31 + ,125976 + ,204450 + ,40 + ,79146 + ,197813 + ,32 + ,108461 + ,138731 + ,25 + ,99971 + ,216153 + ,42 + ,77826 + ,73566 + ,23 + ,22618 + ,219392 + ,42 + ,84892 + ,181728 + ,38 + ,92059 + ,150006 + ,34 + ,77993 + ,325723 + ,40 + ,104155 + ,265348 + ,36 + ,109840 + ,202410 + ,37 + ,238712 + ,173420 + ,34 + ,67486 + ,162366 + ,37 + ,68007 + ,136341 + ,25 + ,48194 + ,390163 + ,45 + ,134796 + ,145905 + ,26 + ,38692 + ,248834 + ,40 + ,93587 + ,80953 + ,8 + ,56622 + ,133301 + ,27 + ,15986 + ,138630 + ,32 + ,113402 + ,334082 + ,37 + ,97967 + ,277542 + ,57 + ,74844 + ,170849 + ,41 + ,136051 + ,236398 + ,37 + ,50548 + ,207178 + ,38 + ,112215 + ,157125 + ,28 + ,59591 + ,242395 + ,36 + ,59938 + ,273632 + ,33 + ,137639 + ,178489 + ,32 + ,143372 + ,210247 + ,34 + ,138599 + ,268066 + ,35 + ,174110 + ,351056 + ,58 + ,135062 + ,368833 + ,30 + ,175681 + ,247804 + ,45 + ,130307 + ,268118 + ,37 + ,139141 + ,174311 + ,36 + ,44244 + ,43287 + ,19 + ,43750 + ,182915 + ,23 + ,48029 + ,189021 + ,35 + ,95216 + ,237531 + ,36 + ,92288 + ,279589 + ,36 + ,94588 + ,106655 + ,23 + ,197426 + ,135798 + ,41 + ,151244 + ,292930 + ,40 + ,139206 + ,266805 + ,42 + ,106271 + ,23623 + ,1 + ,1168 + ,174970 + ,36 + ,71764 + ,61857 + ,11 + ,25162 + ,147760 + ,42 + ,45635 + ,358662 + ,34 + ,101817 + ,21054 + ,0 + ,855 + ,230091 + ,27 + ,100174 + ,31414 + ,8 + ,14116 + ,284519 + ,38 + ,85008 + ,209481 + ,44 + ,124254 + ,161691 + ,40 + ,105793 + ,137093 + ,28 + ,117129 + ,38214 + ,8 + ,8773 + ,166059 + ,36 + ,94747 + ,319346 + ,47 + ,107549 + ,186273 + ,48 + ,97392 + ,374269 + ,45 + ,126893 + ,275578 + ,48 + ,118850 + ,371645 + ,50 + ,234853 + ,179928 + ,40 + ,74783 + ,94381 + ,32 + ,66089 + ,269169 + ,37 + ,95684 + ,382564 + ,42 + ,139537 + ,118033 + ,35 + ,144253 + ,370878 + ,42 + ,153824 + ,147989 + ,34 + ,63995 + ,236370 + ,41 + ,84891 + ,193456 + ,36 + ,61263 + ,189020 + ,32 + ,106221 + ,344751 + ,35 + ,113587 + ,224936 + ,35 + ,113864 + ,173260 + ,21 + ,37238 + ,291777 + ,45 + ,119906 + ,130908 + ,49 + ,135096 + ,209639 + ,36 + ,151611 + ,262412 + ,39 + ,144645 + ,1 + ,0 + ,0 + ,14688 + ,0 + ,6023 + ,98 + ,0 + ,0 + ,455 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,195822 + ,33 + ,77457 + ,347930 + ,47 + ,62464 + ,0 + ,0 + ,0 + ,203 + ,0 + ,0 + ,7199 + ,0 + ,1644 + ,46660 + ,5 + ,6179 + ,17547 + ,1 + ,3926 + ,107465 + ,38 + ,42087 + ,969 + ,0 + ,0 + ,179994 + ,28 + ,87656) + ,dim=c(3 + ,164) + ,dimnames=list(c('Tijd' + ,'PR' + ,'Karakters') + ,1:164)) > y <- array(NA,dim=c(3,164),dimnames=list(c('Tijd','PR','Karakters'),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 = '2' > 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] "Tijd" > x[,par1] [1] 264530 135248 207253 202898 145249 65295 439387 33186 183696 190673 [11] 287239 205260 141987 322679 199717 349227 276709 273576 157448 242782 [21] 256814 405942 161189 156389 200181 192645 249893 241171 143182 285266 [31] 243048 176062 305210 87995 343613 264159 394976 192718 114673 310108 [41] 292891 157518 180362 146175 140319 405267 78800 201970 309762 166270 [51] 199186 24188 346142 65029 101097 255082 287314 308944 280943 225816 [61] 348955 283283 199642 232791 212262 201345 180424 204450 197813 138731 [71] 216153 73566 219392 181728 150006 325723 265348 202410 173420 162366 [81] 136341 390163 145905 248834 80953 133301 138630 334082 277542 170849 [91] 236398 207178 157125 242395 273632 178489 210247 268066 351056 368833 [101] 247804 268118 174311 43287 182915 189021 237531 279589 106655 135798 [111] 292930 266805 23623 174970 61857 147760 358662 21054 230091 31414 [121] 284519 209481 161691 137093 38214 166059 319346 186273 374269 275578 [131] 371645 179928 94381 269169 382564 118033 370878 147989 236370 193456 [141] 189020 344751 224936 173260 291777 130908 209639 262412 1 14688 [151] 98 455 0 0 195822 347930 0 203 7199 46660 [161] 17547 107465 969 179994 > 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 1 98 203 455 969 7199 14688 17547 21054 23623 3 1 1 1 1 1 1 1 1 1 1 24188 31414 33186 38214 43287 46660 61857 65029 65295 73566 78800 1 1 1 1 1 1 1 1 1 1 1 80953 87995 94381 101097 106655 107465 114673 118033 130908 133301 135248 1 1 1 1 1 1 1 1 1 1 1 135798 136341 137093 138630 138731 140319 141987 143182 145249 145905 146175 1 1 1 1 1 1 1 1 1 1 1 147760 147989 150006 156389 157125 157448 157518 161189 161691 162366 166059 1 1 1 1 1 1 1 1 1 1 1 166270 170849 173260 173420 174311 174970 176062 178489 179928 179994 180362 1 1 1 1 1 1 1 1 1 1 1 180424 181728 182915 183696 186273 189020 189021 190673 192645 192718 193456 1 1 1 1 1 1 1 1 1 1 1 195822 197813 199186 199642 199717 200181 201345 201970 202410 202898 204450 1 1 1 1 1 1 1 1 1 1 1 205260 207178 207253 209481 209639 210247 212262 216153 219392 224936 225816 1 1 1 1 1 1 1 1 1 1 1 230091 232791 236370 236398 237531 241171 242395 242782 243048 247804 248834 1 1 1 1 1 1 1 1 1 1 1 249893 255082 256814 262412 264159 264530 265348 266805 268066 268118 269169 1 1 1 1 1 1 1 1 1 1 1 273576 273632 275578 276709 277542 279589 280943 283283 284519 285266 287239 1 1 1 1 1 1 1 1 1 1 1 287314 291777 292891 292930 305210 308944 309762 310108 319346 322679 325723 1 1 1 1 1 1 1 1 1 1 1 334082 343613 344751 346142 347930 348955 349227 351056 358662 368833 370878 1 1 1 1 1 1 1 1 1 1 1 371645 374269 382564 390163 394976 405267 405942 439387 1 1 1 1 1 1 1 1 > colnames(x) [1] "Tijd" "PR" "Karakters" > colnames(x)[par1] [1] "Tijd" > x[,par1] [1] 264530 135248 207253 202898 145249 65295 439387 33186 183696 190673 [11] 287239 205260 141987 322679 199717 349227 276709 273576 157448 242782 [21] 256814 405942 161189 156389 200181 192645 249893 241171 143182 285266 [31] 243048 176062 305210 87995 343613 264159 394976 192718 114673 310108 [41] 292891 157518 180362 146175 140319 405267 78800 201970 309762 166270 [51] 199186 24188 346142 65029 101097 255082 287314 308944 280943 225816 [61] 348955 283283 199642 232791 212262 201345 180424 204450 197813 138731 [71] 216153 73566 219392 181728 150006 325723 265348 202410 173420 162366 [81] 136341 390163 145905 248834 80953 133301 138630 334082 277542 170849 [91] 236398 207178 157125 242395 273632 178489 210247 268066 351056 368833 [101] 247804 268118 174311 43287 182915 189021 237531 279589 106655 135798 [111] 292930 266805 23623 174970 61857 147760 358662 21054 230091 31414 [121] 284519 209481 161691 137093 38214 166059 319346 186273 374269 275578 [131] 371645 179928 94381 269169 382564 118033 370878 147989 236370 193456 [141] 189020 344751 224936 173260 291777 130908 209639 262412 1 14688 [151] 98 455 0 0 195822 347930 0 203 7199 46660 [161] 17547 107465 969 179994 > if (par2 == 'none') { + m <- ctree(as.formula(paste(colnames(x)[par1],' ~ .',sep='')),data = x) + } > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/rcomp/createtable") > > if (par2 != 'none') { + m <- ctree(as.formula(paste('as.factor(',colnames(x)[par1],') ~ .',sep='')),data = x) + if (par4=='yes') { + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'10-Fold Cross Validation',3+2*par3,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'',1,TRUE) + a<-table.element(a,'Prediction (training)',par3+1,TRUE) + a<-table.element(a,'Prediction (testing)',par3+1,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Actual',1,TRUE) + for (jjj in 1:par3) a<-table.element(a,paste('C',jjj,sep=''),1,TRUE) + a<-table.element(a,'CV',1,TRUE) + for (jjj in 1:par3) a<-table.element(a,paste('C',jjj,sep=''),1,TRUE) + a<-table.element(a,'CV',1,TRUE) + a<-table.row.end(a) + for (i in 1:10) { + ind <- sample(2, nrow(x), replace=T, prob=c(0.9,0.1)) + m.ct <- ctree(as.formula(paste('as.factor(',colnames(x)[par1],') ~ .',sep='')),data =x[ind==1,]) + if (i==1) { + m.ct.i.pred <- predict(m.ct, newdata=x[ind==1,]) + m.ct.i.actu <- x[ind==1,par1] + m.ct.x.pred <- predict(m.ct, newdata=x[ind==2,]) + m.ct.x.actu <- x[ind==2,par1] + } else { + m.ct.i.pred <- c(m.ct.i.pred,predict(m.ct, newdata=x[ind==1,])) + m.ct.i.actu <- c(m.ct.i.actu,x[ind==1,par1]) + m.ct.x.pred <- c(m.ct.x.pred,predict(m.ct, newdata=x[ind==2,])) + m.ct.x.actu <- c(m.ct.x.actu,x[ind==2,par1]) + } + } + print(m.ct.i.tab <- table(m.ct.i.actu,m.ct.i.pred)) + numer <- 0 + for (i in 1:par3) { + print(m.ct.i.tab[i,i] / sum(m.ct.i.tab[i,])) + numer <- numer + m.ct.i.tab[i,i] + } + print(m.ct.i.cp <- numer / sum(m.ct.i.tab)) + print(m.ct.x.tab <- table(m.ct.x.actu,m.ct.x.pred)) + numer <- 0 + for (i in 1:par3) { + print(m.ct.x.tab[i,i] / sum(m.ct.x.tab[i,])) + numer <- numer + m.ct.x.tab[i,i] + } + print(m.ct.x.cp <- numer / sum(m.ct.x.tab)) + for (i in 1:par3) { + a<-table.row.start(a) + a<-table.element(a,paste('C',i,sep=''),1,TRUE) + for (jjj in 1:par3) a<-table.element(a,m.ct.i.tab[i,jjj]) + a<-table.element(a,round(m.ct.i.tab[i,i]/sum(m.ct.i.tab[i,]),4)) + for (jjj in 1:par3) a<-table.element(a,m.ct.x.tab[i,jjj]) + a<-table.element(a,round(m.ct.x.tab[i,i]/sum(m.ct.x.tab[i,]),4)) + a<-table.row.end(a) + } + a<-table.row.start(a) + a<-table.element(a,'Overall',1,TRUE) + for (jjj in 1:par3) a<-table.element(a,'-') + a<-table.element(a,round(m.ct.i.cp,4)) + for (jjj in 1:par3) a<-table.element(a,'-') + a<-table.element(a,round(m.ct.x.cp,4)) + a<-table.row.end(a) + a<-table.end(a) + table.save(a,file="/var/www/rcomp/tmp/1yfri1323702811.tab") + } + } > m Conditional inference tree with 8 terminal nodes Response: Tijd Inputs: PR, Karakters Number of observations: 164 1) PR <= 26; criterion = 1, statistic = 93.463 2) PR <= 19; criterion = 1, statistic = 26.501 3) Karakters <= 6023; criterion = 1, statistic = 15.271 4)* weights = 14 3) Karakters > 6023 5)* weights = 10 2) PR > 19 6)* weights = 11 1) PR > 26 7) Karakters <= 90586; criterion = 1, statistic = 22.816 8) PR <= 35; criterion = 0.987, statistic = 7.47 9)* weights = 17 8) PR > 35 10)* weights = 31 7) Karakters > 90586 11) PR <= 36; criterion = 0.973, statistic = 6.059 12) Karakters <= 143372; criterion = 0.962, statistic = 5.483 13)* weights = 24 12) Karakters > 143372 14)* weights = 8 11) PR > 36 15)* weights = 49 > postscript(file="/var/www/rcomp/tmp/2l25i1323702811.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(m) > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/3b7311323702811.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 264530 219424.625 45105.3750 2 135248 219424.625 -84176.6250 3 207253 276835.776 -69582.7755 4 202898 219424.625 -16526.6250 5 145249 136369.000 8880.0000 6 65295 152976.118 -87681.1176 7 439387 284111.750 155275.2500 8 33186 61637.000 -28451.0000 9 183696 219424.625 -35728.6250 10 190673 152976.118 37696.8824 11 287239 217675.935 69563.0645 12 205260 217675.935 -12415.9355 13 141987 152976.118 -10989.1176 14 322679 276835.776 45843.2245 15 199717 217675.935 -17958.9355 16 349227 276835.776 72391.2245 17 276709 284111.750 -7402.7500 18 273576 219424.625 54151.3750 19 157448 136369.000 21079.0000 20 242782 276835.776 -34053.7755 21 256814 276835.776 -20021.7755 22 405942 217675.935 188266.0645 23 161189 136369.000 24820.0000 24 156389 276835.776 -120446.7755 25 200181 217675.935 -17494.9355 26 192645 219424.625 -26779.6250 27 249893 276835.776 -26942.7755 28 241171 217675.935 23495.0645 29 143182 152976.118 -9794.1176 30 285266 276835.776 8430.2245 31 243048 276835.776 -33787.7755 32 176062 217675.935 -41613.9355 33 305210 276835.776 28374.2245 34 87995 152976.118 -64981.1176 35 343613 276835.776 66777.2245 36 264159 217675.935 46483.0645 37 394976 276835.776 118140.2245 38 192718 152976.118 39741.8824 39 114673 61637.000 53036.0000 40 310108 276835.776 33272.2245 41 292891 217675.935 75215.0645 42 157518 217675.935 -60157.9355 43 180362 217675.935 -37313.9355 44 146175 152976.118 -6801.1176 45 140319 217675.935 -77356.9355 46 405267 276835.776 128431.2245 47 78800 136369.000 -57569.0000 48 201970 276835.776 -74865.7755 49 309762 276835.776 32926.2245 50 166270 217675.935 -51405.9355 51 199186 152976.118 46209.8824 52 24188 7858.929 16329.0714 53 346142 276835.776 69306.2245 54 65029 61637.000 3392.0000 55 101097 61637.000 39460.0000 56 255082 276835.776 -21753.7755 57 287314 276835.776 10478.2245 58 308944 284111.750 24832.2500 59 280943 276835.776 4107.2245 60 225816 217675.935 8140.0645 61 348955 276835.776 72119.2245 62 283283 284111.750 -828.7500 63 199642 217675.935 -18033.9355 64 232791 276835.776 -44044.7755 65 212262 219424.625 -7162.6250 66 201345 152976.118 48368.8824 67 180424 219424.625 -39000.6250 68 204450 217675.935 -13225.9355 69 197813 219424.625 -21611.6250 70 138731 136369.000 2362.0000 71 216153 217675.935 -1522.9355 72 73566 136369.000 -62803.0000 73 219392 217675.935 1716.0645 74 181728 276835.776 -95107.7755 75 150006 152976.118 -2970.1176 76 325723 276835.776 48887.2245 77 265348 219424.625 45923.3750 78 202410 276835.776 -74425.7755 79 173420 152976.118 20443.8824 80 162366 217675.935 -55309.9355 81 136341 136369.000 -28.0000 82 390163 276835.776 113327.2245 83 145905 136369.000 9536.0000 84 248834 276835.776 -28001.7755 85 80953 61637.000 19316.0000 86 133301 152976.118 -19675.1176 87 138630 219424.625 -80794.6250 88 334082 276835.776 57246.2245 89 277542 217675.935 59866.0645 90 170849 276835.776 -105986.7755 91 236398 217675.935 18722.0645 92 207178 276835.776 -69657.7755 93 157125 152976.118 4148.8824 94 242395 217675.935 24719.0645 95 273632 219424.625 54207.3750 96 178489 219424.625 -40935.6250 97 210247 219424.625 -9177.6250 98 268066 284111.750 -16045.7500 99 351056 276835.776 74220.2245 100 368833 284111.750 84721.2500 101 247804 276835.776 -29031.7755 102 268118 276835.776 -8717.7755 103 174311 217675.935 -43364.9355 104 43287 61637.000 -18350.0000 105 182915 136369.000 46546.0000 106 189021 219424.625 -30403.6250 107 237531 219424.625 18106.3750 108 279589 219424.625 60164.3750 109 106655 136369.000 -29714.0000 110 135798 276835.776 -141037.7755 111 292930 276835.776 16094.2245 112 266805 276835.776 -10030.7755 113 23623 7858.929 15764.0714 114 174970 217675.935 -42705.9355 115 61857 61637.000 220.0000 116 147760 217675.935 -69915.9355 117 358662 219424.625 139237.3750 118 21054 7858.929 13195.0714 119 230091 219424.625 10666.3750 120 31414 61637.000 -30223.0000 121 284519 217675.935 66843.0645 122 209481 276835.776 -67354.7755 123 161691 276835.776 -115144.7755 124 137093 219424.625 -82331.6250 125 38214 61637.000 -23423.0000 126 166059 219424.625 -53365.6250 127 319346 276835.776 42510.2245 128 186273 276835.776 -90562.7755 129 374269 276835.776 97433.2245 130 275578 276835.776 -1257.7755 131 371645 276835.776 94809.2245 132 179928 217675.935 -37747.9355 133 94381 152976.118 -58595.1176 134 269169 276835.776 -7666.7755 135 382564 276835.776 105728.2245 136 118033 284111.750 -166078.7500 137 370878 276835.776 94042.2245 138 147989 152976.118 -4987.1176 139 236370 217675.935 18694.0645 140 193456 217675.935 -24219.9355 141 189020 219424.625 -30404.6250 142 344751 219424.625 125326.3750 143 224936 219424.625 5511.3750 144 173260 136369.000 36891.0000 145 291777 276835.776 14941.2245 146 130908 276835.776 -145927.7755 147 209639 284111.750 -74472.7500 148 262412 276835.776 -14423.7755 149 1 7858.929 -7857.9286 150 14688 7858.929 6829.0714 151 98 7858.929 -7760.9286 152 455 7858.929 -7403.9286 153 0 7858.929 -7858.9286 154 0 7858.929 -7858.9286 155 195822 152976.118 42845.8824 156 347930 217675.935 130254.0645 157 0 7858.929 -7858.9286 158 203 7858.929 -7655.9286 159 7199 7858.929 -659.9286 160 46660 61637.000 -14977.0000 161 17547 7858.929 9688.0714 162 107465 217675.935 -110210.9355 163 969 7858.929 -6889.9286 164 179994 152976.118 27017.8824 > if (par2 != 'none') { + print(cbind(as.factor(x[,par1]),predict(m))) + myt <- table(as.factor(x[,par1]),predict(m)) + print(myt) + } > postscript(file="/var/www/rcomp/tmp/4ll3f1323702811.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > if(par2=='none') { + op <- par(mfrow=c(2,2)) + plot(density(result$Actuals),main='Kernel Density Plot of Actuals') + plot(density(result$Residuals),main='Kernel Density Plot of Residuals') + plot(result$Forecasts,result$Actuals,main='Actuals versus Predictions',xlab='Predictions',ylab='Actuals') + plot(density(result$Forecasts),main='Kernel Density Plot of Predictions') + par(op) + } > if(par2!='none') { + plot(myt,main='Confusion Matrix',xlab='Actual',ylab='Predicted') + } > dev.off() null device 1 > if (par2 == 'none') { + detcoef <- cor(result$Forecasts,result$Actuals) + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Goodness of Fit',2,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Correlation',1,TRUE) + a<-table.element(a,round(detcoef,4)) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'R-squared',1,TRUE) + a<-table.element(a,round(detcoef*detcoef,4)) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'RMSE',1,TRUE) + a<-table.element(a,round(sqrt(mean((result$Residuals)^2)),4)) + a<-table.row.end(a) + a<-table.end(a) + table.save(a,file="/var/www/rcomp/tmp/5jeoy1323702811.tab") + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Actuals, Predictions, and Residuals',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'#',header=TRUE) + a<-table.element(a,'Actuals',header=TRUE) + a<-table.element(a,'Forecasts',header=TRUE) + a<-table.element(a,'Residuals',header=TRUE) + a<-table.row.end(a) + for (i in 1:length(result$Actuals)) { + a<-table.row.start(a) + a<-table.element(a,i,header=TRUE) + a<-table.element(a,result$Actuals[i]) + a<-table.element(a,result$Forecasts[i]) + a<-table.element(a,result$Residuals[i]) + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/www/rcomp/tmp/63e321323702811.tab") + } > if (par2 != 'none') { + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Confusion Matrix (predicted in columns / actuals in rows)',par3+1,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'',1,TRUE) + for (i in 1:par3) { + a<-table.element(a,paste('C',i,sep=''),1,TRUE) + } + a<-table.row.end(a) + for (i in 1:par3) { + a<-table.row.start(a) + a<-table.element(a,paste('C',i,sep=''),1,TRUE) + for (j in 1:par3) { + a<-table.element(a,myt[i,j]) + } + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/www/rcomp/tmp/7dudd1323702811.tab") + } > > try(system("convert tmp/2l25i1323702811.ps tmp/2l25i1323702811.png",intern=TRUE)) character(0) > try(system("convert tmp/3b7311323702811.ps tmp/3b7311323702811.png",intern=TRUE)) character(0) > try(system("convert tmp/4ll3f1323702811.ps tmp/4ll3f1323702811.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.860 0.276 5.604