R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-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(0 + ,0 + ,264530 + ,165119 + ,0 + ,0 + ,135248 + ,107269 + ,0 + ,0 + ,207253 + ,93497 + ,0 + ,0 + ,202898 + ,100269 + ,0 + ,0 + ,145249 + ,91627 + ,0 + ,0 + ,65295 + ,47552 + ,0 + ,0 + ,439387 + ,233933 + ,0 + ,0 + ,33186 + ,6853 + ,0 + ,0 + ,183696 + ,104380 + ,0 + ,0 + ,190673 + ,98431 + ,0 + ,0 + ,287239 + ,156949 + ,0 + ,0 + ,205260 + ,81817 + ,0 + ,0 + ,141987 + ,59238 + ,0 + ,0 + ,322679 + ,101138 + ,0 + ,0 + ,199717 + ,107158 + ,0 + ,0 + ,349227 + ,155499 + ,0 + ,0 + ,276709 + ,156274 + ,0 + ,0 + ,273576 + ,121777 + ,0 + ,0 + ,157448 + ,105037 + ,0 + ,0 + ,242782 + ,118661 + ,0 + ,0 + ,256814 + ,131187 + ,0 + ,0 + ,405874 + ,145026 + ,0 + ,0 + ,161189 + ,107016 + ,0 + ,0 + ,156189 + ,87242 + ,0 + ,0 + ,200181 + ,91699 + ,0 + ,0 + ,192645 + ,110087 + ,0 + ,0 + ,249893 + ,145447 + ,0 + ,0 + ,241171 + ,143307 + ,0 + ,0 + ,143182 + ,61678 + ,0 + ,0 + ,285266 + ,210080 + ,0 + ,0 + ,243048 + ,165005 + ,0 + ,0 + ,176062 + ,97806 + ,0 + ,0 + ,305210 + ,184471 + ,0 + ,0 + ,87995 + ,27786 + ,0 + ,0 + ,343613 + ,184458 + ,0 + ,0 + ,264159 + ,98765 + ,0 + ,0 + ,394976 + ,178441 + ,0 + ,0 + ,192718 + ,100619 + ,0 + ,0 + ,114673 + ,58391 + ,0 + ,0 + ,310108 + ,151672 + ,0 + ,0 + ,292891 + ,124437 + ,0 + ,0 + ,157518 + ,79929 + ,0 + ,0 + ,180362 + ,123064 + ,0 + ,0 + ,146175 + ,50466 + ,0 + ,0 + ,140319 + ,100991 + ,0 + ,0 + ,405267 + ,79367 + ,0 + ,0 + ,78800 + ,56968 + ,0 + ,0 + ,201970 + ,106257 + ,0 + ,0 + ,305322 + ,178412 + ,0 + ,0 + ,164733 + ,98520 + ,0 + ,1 + ,199186 + ,153670 + ,0 + ,1 + ,24188 + ,15049 + ,0 + ,1 + ,346142 + ,174478 + ,0 + ,1 + ,65029 + ,25109 + ,0 + ,1 + ,101097 + ,45824 + ,0 + ,1 + ,255082 + ,116772 + ,0 + ,1 + ,287314 + ,189150 + ,1 + ,1 + ,308944 + ,194404 + ,1 + ,1 + ,280943 + ,185881 + ,1 + ,1 + ,225816 + ,67508 + ,1 + ,1 + ,348943 + ,188597 + ,1 + ,1 + ,283283 + ,203618 + ,1 + ,1 + ,199642 + ,87232 + ,1 + ,1 + ,232791 + ,110875 + ,1 + ,1 + ,212262 + ,144756 + ,1 + ,1 + ,201345 + ,129825 + ,1 + ,1 + ,180424 + ,92189 + ,1 + ,1 + ,204450 + ,121158 + ,1 + ,1 + ,197813 + ,96219 + ,1 + ,1 + ,138731 + ,84128 + ,1 + ,1 + ,216153 + ,97960 + ,1 + ,1 + ,73566 + ,23824 + ,1 + ,1 + ,219392 + ,103515 + ,1 + ,1 + ,181728 + ,91313 + ,1 + ,1 + ,150006 + ,85407 + ,1 + ,1 + ,325723 + ,95871 + ,1 + ,1 + ,265348 + ,143846 + ,1 + ,1 + ,202410 + ,155387 + ,1 + ,1 + ,173420 + ,74429 + ,1 + ,1 + ,162366 + ,74004 + ,1 + ,1 + ,136341 + ,71987 + ,1 + ,1 + ,390163 + ,150629 + ,1 + ,1 + ,145905 + ,68580 + ,1 + ,1 + ,238921 + ,119855 + ,1 + ,1 + ,80953 + ,55792 + ,1 + ,1 + ,133301 + ,25157 + ,1 + ,1 + ,138630 + ,90895 + ,1 + ,1 + ,334082 + ,117510 + ,1 + ,1 + ,277542 + ,144774 + ,1 + ,1 + ,170849 + ,77529 + ,1 + ,1 + ,236398 + ,103123 + ,1 + ,1 + ,207178 + ,104669 + ,1 + ,1 + ,157125 + ,82414 + ,1 + ,1 + ,242395 + ,82390 + ,1 + ,1 + ,273632 + ,128446 + ,1 + ,1 + ,178489 + ,111542 + ,1 + ,1 + ,207720 + ,136048 + ,1 + ,1 + ,268066 + ,197257 + ,1 + ,1 + ,349934 + ,162079 + ,1 + ,1 + ,368833 + ,206286 + ,1 + ,1 + ,247804 + ,109858 + ,1 + ,1 + ,265849 + ,182125 + ,1 + ,1 + ,174311 + ,74168 + ,1 + ,1 + ,43287 + ,19630 + ,1 + ,1 + ,176724 + ,88634 + ,1 + ,1 + ,189021 + ,128321 + ,1 + ,1 + ,237531 + ,118936 + ,1 + ,1 + ,279589 + ,127044 + ,1 + ,1 + ,106655 + ,178377 + ,1 + ,1 + ,135798 + ,69581 + ,1 + ,1 + ,290495 + ,168019 + ,1 + ,1 + ,266805 + ,113598 + ,1 + ,1 + ,23623 + ,5841 + ,1 + ,1 + ,174970 + ,93116 + ,1 + ,1 + ,61857 + ,24610 + ,1 + ,1 + ,147760 + ,60611 + ,1 + ,1 + ,358662 + ,226620 + ,1 + ,1 + ,21054 + ,6622 + ,1 + ,1 + ,230091 + ,121996 + ,1 + ,1 + ,31414 + ,13155 + ,1 + ,1 + ,284519 + ,154158 + ,1 + ,1 + ,209481 + ,78489 + ,1 + ,1 + ,161691 + ,22007 + ,1 + ,1 + ,137093 + ,72530 + ,1 + ,1 + ,38214 + ,13983 + ,1 + ,1 + ,166059 + ,73397 + ,1 + ,1 + ,319346 + ,143878 + ,1 + ,1 + ,186273 + ,119956 + ,1 + ,1 + ,374212 + ,181558 + ,1 + ,1 + ,275578 + ,208236 + ,1 + ,1 + ,368863 + ,237085 + ,1 + ,1 + ,179928 + ,110297 + ,1 + ,1 + ,94381 + ,61394 + ,1 + ,1 + ,251253 + ,81420 + ,1 + ,1 + ,382564 + ,191154 + ,1 + ,1 + ,118033 + ,11798 + ,1 + ,1 + ,370878 + ,135724 + ,1 + ,1 + ,147989 + ,68614 + ,1 + ,1 + ,236370 + ,139926 + ,1 + ,1 + ,193220 + ,105203 + ,1 + ,1 + ,189020 + ,80338 + ,1 + ,1 + ,341992 + ,121376 + ,1 + ,1 + ,224936 + ,124922 + ,1 + ,1 + ,173260 + ,10901 + ,1 + ,1 + ,286161 + ,135471 + ,1 + ,1 + ,130908 + ,66395 + ,1 + ,1 + ,209639 + ,134041 + ,1 + ,1 + ,262412 + ,153554 + ,1 + ,1 + ,1 + ,0 + ,1 + ,1 + ,14688 + ,7953 + ,1 + ,1 + ,98 + ,0 + ,1 + ,1 + ,455 + ,0 + ,1 + ,1 + ,0 + ,0 + ,1 + ,1 + ,0 + ,0 + ,1 + ,1 + ,195822 + ,98922 + ,1 + ,1 + ,347930 + ,165395 + ,1 + ,1 + ,0 + ,0 + ,1 + ,1 + ,203 + ,0 + ,1 + ,1 + ,7199 + ,4245 + ,1 + ,1 + ,46660 + ,21509 + ,1 + ,1 + ,17547 + ,7670 + ,1 + ,1 + ,107465 + ,15167 + ,1 + ,1 + ,969 + ,0 + ,1 + ,1 + ,179994 + ,63891) + ,dim=c(4 + ,164) + ,dimnames=list(c('Pop' + ,'Gender' + ,'Time_RFC_sec' + ,'Compendium_writing_time_sec') + ,1:164)) > y <- array(NA,dim=c(4,164),dimnames=list(c('Pop','Gender','Time_RFC_sec','Compendium_writing_time_sec'),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 = '3' > 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 Attaching package: 'zoo' The following object(s) are masked from 'package:base': as.Date, as.Date.numeric Loading required package: sandwich Loading required package: strucchange Loading required package: vcd Loading required package: MASS Loading required package: colorspace > library(Hmisc) Hmisc library by Frank E Harrell Jr Type library(help='Hmisc'), ?Overview, or ?Hmisc.Overview') to see overall documentation. NOTE:Hmisc no longer redefines [.factor to drop unused levels when subsetting. To get the old behavior of Hmisc type dropUnusedLevels(). 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_sec" > 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 405874 161189 156189 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 305322 164733 [51] 199186 24188 346142 65029 101097 255082 287314 308944 280943 225816 [61] 348943 283283 199642 232791 212262 201345 180424 204450 197813 138731 [71] 216153 73566 219392 181728 150006 325723 265348 202410 173420 162366 [81] 136341 390163 145905 238921 80953 133301 138630 334082 277542 170849 [91] 236398 207178 157125 242395 273632 178489 207720 268066 349934 368833 [101] 247804 265849 174311 43287 176724 189021 237531 279589 106655 135798 [111] 290495 266805 23623 174970 61857 147760 358662 21054 230091 31414 [121] 284519 209481 161691 137093 38214 166059 319346 186273 374212 275578 [131] 368863 179928 94381 251253 382564 118033 370878 147989 236370 193220 [141] 189020 341992 224936 173260 286161 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 156189 157125 157448 157518 161189 161691 162366 164733 1 1 1 1 1 1 1 1 1 1 1 166059 170849 173260 173420 174311 174970 176062 176724 178489 179928 179994 1 1 1 1 1 1 1 1 1 1 1 180362 180424 181728 183696 186273 189020 189021 190673 192645 192718 193220 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 207720 209481 209639 212262 216153 219392 224936 225816 1 1 1 1 1 1 1 1 1 1 1 230091 232791 236370 236398 237531 238921 241171 242395 242782 243048 247804 1 1 1 1 1 1 1 1 1 1 1 249893 251253 255082 256814 262412 264159 264530 265348 265849 266805 268066 1 1 1 1 1 1 1 1 1 1 1 273576 273632 275578 276709 277542 279589 280943 283283 284519 285266 286161 1 1 1 1 1 1 1 1 1 1 1 287239 287314 290495 292891 305210 305322 308944 310108 319346 322679 325723 1 1 1 1 1 1 1 1 1 1 1 334082 341992 343613 346142 347930 348943 349227 349934 358662 368833 368863 1 1 1 1 1 1 1 1 1 1 1 370878 374212 382564 390163 394976 405267 405874 439387 1 1 1 1 1 1 1 1 > colnames(x) [1] "Pop" "Gender" [3] "Time_RFC_sec" "Compendium_writing_time_sec" > colnames(x)[par1] [1] "Time_RFC_sec" > 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 405874 161189 156189 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 305322 164733 [51] 199186 24188 346142 65029 101097 255082 287314 308944 280943 225816 [61] 348943 283283 199642 232791 212262 201345 180424 204450 197813 138731 [71] 216153 73566 219392 181728 150006 325723 265348 202410 173420 162366 [81] 136341 390163 145905 238921 80953 133301 138630 334082 277542 170849 [91] 236398 207178 157125 242395 273632 178489 207720 268066 349934 368833 [101] 247804 265849 174311 43287 176724 189021 237531 279589 106655 135798 [111] 290495 266805 23623 174970 61857 147760 358662 21054 230091 31414 [121] 284519 209481 161691 137093 38214 166059 319346 186273 374212 275578 [131] 368863 179928 94381 251253 382564 118033 370878 147989 236370 193220 [141] 189020 341992 224936 173260 286161 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/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/158mx1355073950.tab") + } + } > m Conditional inference tree with 6 terminal nodes Response: Time_RFC_sec Inputs: Pop, Gender, Compendium_writing_time_sec Number of observations: 164 1) Compendium_writing_time_sec <= 72530; criterion = 1, statistic = 120.408 2) Compendium_writing_time_sec <= 7953; criterion = 1, statistic = 28.138 3)* weights = 14 2) Compendium_writing_time_sec > 7953 4) Compendium_writing_time_sec <= 58391; criterion = 0.993, statistic = 9.322 5)* weights = 20 4) Compendium_writing_time_sec > 58391 6)* weights = 12 1) Compendium_writing_time_sec > 72530 7) Compendium_writing_time_sec <= 134041; criterion = 1, statistic = 50.903 8) Compendium_writing_time_sec <= 111542; criterion = 0.986, statistic = 8.05 9)* weights = 52 8) Compendium_writing_time_sec > 111542 10)* weights = 20 7) Compendium_writing_time_sec > 134041 11)* weights = 46 > postscript(file="/var/wessaorg/rcomp/tmp/2z99q1355073950.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/3c3dg1355073950.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 300632.609 -36102.6087 2 135248 196748.385 -61500.3846 3 207253 196748.385 10504.6154 4 202898 196748.385 6149.6154 5 145249 196748.385 -51499.3846 6 65295 87647.650 -22352.6500 7 439387 300632.609 138754.3913 8 33186 8501.643 24684.3571 9 183696 196748.385 -13052.3846 10 190673 196748.385 -6075.3846 11 287239 300632.609 -13393.6087 12 205260 196748.385 8511.6154 13 141987 147262.833 -5275.8333 14 322679 196748.385 125930.6154 15 199717 196748.385 2968.6154 16 349227 300632.609 48594.3913 17 276709 300632.609 -23923.6087 18 273576 245990.700 27585.3000 19 157448 196748.385 -39300.3846 20 242782 245990.700 -3208.7000 21 256814 245990.700 10823.3000 22 405874 300632.609 105241.3913 23 161189 196748.385 -35559.3846 24 156189 196748.385 -40559.3846 25 200181 196748.385 3432.6154 26 192645 196748.385 -4103.3846 27 249893 300632.609 -50739.6087 28 241171 300632.609 -59461.6087 29 143182 147262.833 -4080.8333 30 285266 300632.609 -15366.6087 31 243048 300632.609 -57584.6087 32 176062 196748.385 -20686.3846 33 305210 300632.609 4577.3913 34 87995 87647.650 347.3500 35 343613 300632.609 42980.3913 36 264159 196748.385 67410.6154 37 394976 300632.609 94343.3913 38 192718 196748.385 -4030.3846 39 114673 87647.650 27025.3500 40 310108 300632.609 9475.3913 41 292891 245990.700 46900.3000 42 157518 196748.385 -39230.3846 43 180362 245990.700 -65628.7000 44 146175 87647.650 58527.3500 45 140319 196748.385 -56429.3846 46 405267 196748.385 208518.6154 47 78800 87647.650 -8847.6500 48 201970 196748.385 5221.6154 49 305322 300632.609 4689.3913 50 164733 196748.385 -32015.3846 51 199186 300632.609 -101446.6087 52 24188 87647.650 -63459.6500 53 346142 300632.609 45509.3913 54 65029 87647.650 -22618.6500 55 101097 87647.650 13449.3500 56 255082 245990.700 9091.3000 57 287314 300632.609 -13318.6087 58 308944 300632.609 8311.3913 59 280943 300632.609 -19689.6087 60 225816 147262.833 78553.1667 61 348943 300632.609 48310.3913 62 283283 300632.609 -17349.6087 63 199642 196748.385 2893.6154 64 232791 196748.385 36042.6154 65 212262 300632.609 -88370.6087 66 201345 245990.700 -44645.7000 67 180424 196748.385 -16324.3846 68 204450 245990.700 -41540.7000 69 197813 196748.385 1064.6154 70 138731 196748.385 -58017.3846 71 216153 196748.385 19404.6154 72 73566 87647.650 -14081.6500 73 219392 196748.385 22643.6154 74 181728 196748.385 -15020.3846 75 150006 196748.385 -46742.3846 76 325723 196748.385 128974.6154 77 265348 300632.609 -35284.6087 78 202410 300632.609 -98222.6087 79 173420 196748.385 -23328.3846 80 162366 196748.385 -34382.3846 81 136341 147262.833 -10921.8333 82 390163 300632.609 89530.3913 83 145905 147262.833 -1357.8333 84 238921 245990.700 -7069.7000 85 80953 87647.650 -6694.6500 86 133301 87647.650 45653.3500 87 138630 196748.385 -58118.3846 88 334082 245990.700 88091.3000 89 277542 300632.609 -23090.6087 90 170849 196748.385 -25899.3846 91 236398 196748.385 39649.6154 92 207178 196748.385 10429.6154 93 157125 196748.385 -39623.3846 94 242395 196748.385 45646.6154 95 273632 245990.700 27641.3000 96 178489 196748.385 -18259.3846 97 207720 300632.609 -92912.6087 98 268066 300632.609 -32566.6087 99 349934 300632.609 49301.3913 100 368833 300632.609 68200.3913 101 247804 196748.385 51055.6154 102 265849 300632.609 -34783.6087 103 174311 196748.385 -22437.3846 104 43287 87647.650 -44360.6500 105 176724 196748.385 -20024.3846 106 189021 245990.700 -56969.7000 107 237531 245990.700 -8459.7000 108 279589 245990.700 33598.3000 109 106655 300632.609 -193977.6087 110 135798 147262.833 -11464.8333 111 290495 300632.609 -10137.6087 112 266805 245990.700 20814.3000 113 23623 8501.643 15121.3571 114 174970 196748.385 -21778.3846 115 61857 87647.650 -25790.6500 116 147760 147262.833 497.1667 117 358662 300632.609 58029.3913 118 21054 8501.643 12552.3571 119 230091 245990.700 -15899.7000 120 31414 87647.650 -56233.6500 121 284519 300632.609 -16113.6087 122 209481 196748.385 12732.6154 123 161691 87647.650 74043.3500 124 137093 147262.833 -10169.8333 125 38214 87647.650 -49433.6500 126 166059 196748.385 -30689.3846 127 319346 300632.609 18713.3913 128 186273 245990.700 -59717.7000 129 374212 300632.609 73579.3913 130 275578 300632.609 -25054.6087 131 368863 300632.609 68230.3913 132 179928 196748.385 -16820.3846 133 94381 147262.833 -52881.8333 134 251253 196748.385 54504.6154 135 382564 300632.609 81931.3913 136 118033 87647.650 30385.3500 137 370878 300632.609 70245.3913 138 147989 147262.833 726.1667 139 236370 300632.609 -64262.6087 140 193220 196748.385 -3528.3846 141 189020 196748.385 -7728.3846 142 341992 245990.700 96001.3000 143 224936 245990.700 -21054.7000 144 173260 87647.650 85612.3500 145 286161 300632.609 -14471.6087 146 130908 147262.833 -16354.8333 147 209639 245990.700 -36351.7000 148 262412 300632.609 -38220.6087 149 1 8501.643 -8500.6429 150 14688 8501.643 6186.3571 151 98 8501.643 -8403.6429 152 455 8501.643 -8046.6429 153 0 8501.643 -8501.6429 154 0 8501.643 -8501.6429 155 195822 196748.385 -926.3846 156 347930 300632.609 47297.3913 157 0 8501.643 -8501.6429 158 203 8501.643 -8298.6429 159 7199 8501.643 -1302.6429 160 46660 87647.650 -40987.6500 161 17547 8501.643 9045.3571 162 107465 87647.650 19817.3500 163 969 8501.643 -7532.6429 164 179994 147262.833 32731.1667 > 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/44wgd1355073950.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/5ymd71355073950.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/6mrmc1355073950.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/7r8h71355073950.tab") + } > > try(system("convert tmp/2z99q1355073950.ps tmp/2z99q1355073950.png",intern=TRUE)) character(0) > try(system("convert tmp/3c3dg1355073950.ps tmp/3c3dg1355073950.png",intern=TRUE)) character(0) > try(system("convert tmp/44wgd1355073950.ps tmp/44wgd1355073950.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.787 0.365 5.139