R version 2.12.0 (2010-10-15) 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 + ,219074 + ,43 + ,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 + ,247842 + ,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' + ,'characters') + ,1:164)) > y <- array(NA,dim=c(3,164),dimnames=list(c('Tijd','PR','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' > 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] 219074 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] 247842 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 219074 219392 224936 225816 1 1 1 1 1 1 1 1 1 1 1 230091 232791 236370 236398 237531 241171 242395 242782 243048 247842 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" "characters" > 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] 219074 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] 247842 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/1hm5z1323809052.tab") + } + } > m Conditional inference tree with 8 terminal nodes Response: Tijd Inputs: PR, characters Number of observations: 164 1) PR <= 26; criterion = 1, statistic = 93.445 2) PR <= 19; criterion = 1, statistic = 26.501 3) characters <= 6023; criterion = 1, statistic = 15.271 4)* weights = 14 3) characters > 6023 5)* weights = 10 2) PR > 19 6)* weights = 11 1) PR > 26 7) characters <= 90586; criterion = 1, statistic = 22.798 8) PR <= 35; criterion = 0.988, statistic = 7.497 9)* weights = 17 8) PR > 35 10)* weights = 31 7) characters > 90586 11) PR <= 36; criterion = 0.973, statistic = 6.059 12) characters <= 143372; criterion = 0.962, statistic = 5.483 13)* weights = 24 12) characters > 143372 14)* weights = 8 11) PR > 36 15)* weights = 49 > postscript(file="/var/www/rcomp/tmp/2o9811323809052.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/3gqsw1323809052.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 276836.551 -69583.5510 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 217770.161 69468.8387 12 205260 217770.161 -12510.1613 13 141987 152976.118 -10989.1176 14 322679 276836.551 45842.4490 15 199717 217770.161 -18053.1613 16 349227 276836.551 72390.4490 17 276709 284111.750 -7402.7500 18 273576 219424.625 54151.3750 19 157448 136369.000 21079.0000 20 242782 276836.551 -34054.5510 21 256814 276836.551 -20022.5510 22 405942 217770.161 188171.8387 23 161189 136369.000 24820.0000 24 156389 276836.551 -120447.5510 25 200181 217770.161 -17589.1613 26 192645 219424.625 -26779.6250 27 249893 276836.551 -26943.5510 28 241171 217770.161 23400.8387 29 143182 152976.118 -9794.1176 30 285266 276836.551 8429.4490 31 243048 276836.551 -33788.5510 32 176062 217770.161 -41708.1613 33 305210 276836.551 28373.4490 34 87995 152976.118 -64981.1176 35 343613 276836.551 66776.4490 36 264159 217770.161 46388.8387 37 394976 276836.551 118139.4490 38 192718 152976.118 39741.8824 39 114673 61637.000 53036.0000 40 310108 276836.551 33271.4490 41 292891 217770.161 75120.8387 42 157518 217770.161 -60252.1613 43 180362 217770.161 -37408.1613 44 146175 152976.118 -6801.1176 45 140319 217770.161 -77451.1613 46 405267 276836.551 128430.4490 47 78800 136369.000 -57569.0000 48 201970 276836.551 -74866.5510 49 309762 276836.551 32925.4490 50 166270 217770.161 -51500.1613 51 199186 152976.118 46209.8824 52 24188 7858.929 16329.0714 53 346142 276836.551 69305.4490 54 65029 61637.000 3392.0000 55 101097 61637.000 39460.0000 56 255082 276836.551 -21754.5510 57 287314 276836.551 10477.4490 58 308944 284111.750 24832.2500 59 280943 276836.551 4106.4490 60 225816 217770.161 8045.8387 61 348955 276836.551 72118.4490 62 283283 284111.750 -828.7500 63 199642 217770.161 -18128.1613 64 232791 276836.551 -44045.5510 65 212262 219424.625 -7162.6250 66 201345 152976.118 48368.8824 67 180424 219424.625 -39000.6250 68 204450 217770.161 -13320.1613 69 197813 219424.625 -21611.6250 70 138731 136369.000 2362.0000 71 219074 217770.161 1303.8387 72 73566 136369.000 -62803.0000 73 219392 217770.161 1621.8387 74 181728 276836.551 -95108.5510 75 150006 152976.118 -2970.1176 76 325723 276836.551 48886.4490 77 265348 219424.625 45923.3750 78 202410 276836.551 -74426.5510 79 173420 152976.118 20443.8824 80 162366 217770.161 -55404.1613 81 136341 136369.000 -28.0000 82 390163 276836.551 113326.4490 83 145905 136369.000 9536.0000 84 248834 276836.551 -28002.5510 85 80953 61637.000 19316.0000 86 133301 152976.118 -19675.1176 87 138630 219424.625 -80794.6250 88 334082 276836.551 57245.4490 89 277542 217770.161 59771.8387 90 170849 276836.551 -105987.5510 91 236398 217770.161 18627.8387 92 207178 276836.551 -69658.5510 93 157125 152976.118 4148.8824 94 242395 217770.161 24624.8387 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 276836.551 74219.4490 100 368833 284111.750 84721.2500 101 247842 276836.551 -28994.5510 102 268118 276836.551 -8718.5510 103 174311 217770.161 -43459.1613 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 276836.551 -141038.5510 111 292930 276836.551 16093.4490 112 266805 276836.551 -10031.5510 113 23623 7858.929 15764.0714 114 174970 217770.161 -42800.1613 115 61857 61637.000 220.0000 116 147760 217770.161 -70010.1613 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 217770.161 66748.8387 122 209481 276836.551 -67355.5510 123 161691 276836.551 -115145.5510 124 137093 219424.625 -82331.6250 125 38214 61637.000 -23423.0000 126 166059 219424.625 -53365.6250 127 319346 276836.551 42509.4490 128 186273 276836.551 -90563.5510 129 374269 276836.551 97432.4490 130 275578 276836.551 -1258.5510 131 371645 276836.551 94808.4490 132 179928 217770.161 -37842.1613 133 94381 152976.118 -58595.1176 134 269169 276836.551 -7667.5510 135 382564 276836.551 105727.4490 136 118033 284111.750 -166078.7500 137 370878 276836.551 94041.4490 138 147989 152976.118 -4987.1176 139 236370 217770.161 18599.8387 140 193456 217770.161 -24314.1613 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 276836.551 14940.4490 146 130908 276836.551 -145928.5510 147 209639 284111.750 -74472.7500 148 262412 276836.551 -14424.5510 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 217770.161 130159.8387 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 217770.161 -110305.1613 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/4hc0r1323809052.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/5lie71323809052.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/6m6fo1323809052.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/7855n1323809052.tab") + } > > try(system("convert tmp/2o9811323809052.ps tmp/2o9811323809052.png",intern=TRUE)) character(0) > try(system("convert tmp/3gqsw1323809052.ps tmp/3gqsw1323809052.png",intern=TRUE)) character(0) > try(system("convert tmp/4hc0r1323809052.ps tmp/4hc0r1323809052.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.890 0.100 2.986