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]) + } + } > par20 = '' > par19 = '' > par18 = '' > par17 = '' > par16 = '' > par15 = '' > par14 = '' > par13 = '' > par12 = '' > par11 = '' > par10 = '' > par9 = '' > par8 = '' > par7 = '' > par6 = '' > par5 = '' > par4 = 'no' > par3 = '2' > par2 = 'quantiles' > 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]) [0e+00,199642) [2e+05,439387] 82 82 > colnames(x) [1] "Pop" "Gender" [3] "Time_RFC_sec" "Compendium_writing_time_sec" > colnames(x)[par1] [1] "Time_RFC_sec" > x[,par1] [1] [2e+05,439387] [0e+00,199642) [2e+05,439387] [2e+05,439387] [0e+00,199642) [6] [0e+00,199642) [2e+05,439387] [0e+00,199642) [0e+00,199642) [0e+00,199642) [11] [2e+05,439387] [2e+05,439387] [0e+00,199642) [2e+05,439387] [2e+05,439387] [16] [2e+05,439387] [2e+05,439387] [2e+05,439387] [0e+00,199642) [2e+05,439387] [21] [2e+05,439387] [2e+05,439387] [0e+00,199642) [0e+00,199642) [2e+05,439387] [26] [0e+00,199642) [2e+05,439387] [2e+05,439387] [0e+00,199642) [2e+05,439387] [31] [2e+05,439387] [0e+00,199642) [2e+05,439387] [0e+00,199642) [2e+05,439387] [36] [2e+05,439387] [2e+05,439387] [0e+00,199642) [0e+00,199642) [2e+05,439387] [41] [2e+05,439387] [0e+00,199642) [0e+00,199642) [0e+00,199642) [0e+00,199642) [46] [2e+05,439387] [0e+00,199642) [2e+05,439387] [2e+05,439387] [0e+00,199642) [51] [0e+00,199642) [0e+00,199642) [2e+05,439387] [0e+00,199642) [0e+00,199642) [56] [2e+05,439387] [2e+05,439387] [2e+05,439387] [2e+05,439387] [2e+05,439387] [61] [2e+05,439387] [2e+05,439387] [2e+05,439387] [2e+05,439387] [2e+05,439387] [66] [2e+05,439387] [0e+00,199642) [2e+05,439387] [0e+00,199642) [0e+00,199642) [71] [2e+05,439387] [0e+00,199642) [2e+05,439387] [0e+00,199642) [0e+00,199642) [76] [2e+05,439387] [2e+05,439387] [2e+05,439387] [0e+00,199642) [0e+00,199642) [81] [0e+00,199642) [2e+05,439387] [0e+00,199642) [2e+05,439387] [0e+00,199642) [86] [0e+00,199642) [0e+00,199642) [2e+05,439387] [2e+05,439387] [0e+00,199642) [91] [2e+05,439387] [2e+05,439387] [0e+00,199642) [2e+05,439387] [2e+05,439387] [96] [0e+00,199642) [2e+05,439387] [2e+05,439387] [2e+05,439387] [2e+05,439387] [101] [2e+05,439387] [2e+05,439387] [0e+00,199642) [0e+00,199642) [0e+00,199642) [106] [0e+00,199642) [2e+05,439387] [2e+05,439387] [0e+00,199642) [0e+00,199642) [111] [2e+05,439387] [2e+05,439387] [0e+00,199642) [0e+00,199642) [0e+00,199642) [116] [0e+00,199642) [2e+05,439387] [0e+00,199642) [2e+05,439387] [0e+00,199642) [121] [2e+05,439387] [2e+05,439387] [0e+00,199642) [0e+00,199642) [0e+00,199642) [126] [0e+00,199642) [2e+05,439387] [0e+00,199642) [2e+05,439387] [2e+05,439387] [131] [2e+05,439387] [0e+00,199642) [0e+00,199642) [2e+05,439387] [2e+05,439387] [136] [0e+00,199642) [2e+05,439387] [0e+00,199642) [2e+05,439387] [0e+00,199642) [141] [0e+00,199642) [2e+05,439387] [2e+05,439387] [0e+00,199642) [2e+05,439387] [146] [0e+00,199642) [2e+05,439387] [2e+05,439387] [0e+00,199642) [0e+00,199642) [151] [0e+00,199642) [0e+00,199642) [0e+00,199642) [0e+00,199642) [0e+00,199642) [156] [2e+05,439387] [0e+00,199642) [0e+00,199642) [0e+00,199642) [0e+00,199642) [161] [0e+00,199642) [0e+00,199642) [0e+00,199642) [0e+00,199642) Levels: [0e+00,199642) [2e+05,439387] > 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/1b4yr1354891270.tab") + } + } > m Conditional inference tree with 3 terminal nodes Response: as.factor(Time_RFC_sec) Inputs: Pop, Gender, Compendium_writing_time_sec Number of observations: 164 1) Compendium_writing_time_sec <= 111542; criterion = 1, statistic = 80.52 2) Compendium_writing_time_sec <= 77529; criterion = 1, statistic = 17.305 3)* weights = 51 2) Compendium_writing_time_sec > 77529 4)* weights = 47 1) Compendium_writing_time_sec > 111542 5)* weights = 66 > postscript(file="/var/wessaorg/rcomp/tmp/2qniu1354891270.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/39yfx1354891270.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) + } > if (par2 != 'none') { + print(cbind(as.factor(x[,par1]),predict(m))) + myt <- table(as.factor(x[,par1]),predict(m)) + print(myt) + } [,1] [,2] [1,] 2 2 [2,] 1 1 [3,] 2 1 [4,] 2 1 [5,] 1 1 [6,] 1 1 [7,] 2 2 [8,] 1 1 [9,] 1 1 [10,] 1 1 [11,] 2 2 [12,] 2 1 [13,] 1 1 [14,] 2 1 [15,] 2 1 [16,] 2 2 [17,] 2 2 [18,] 2 2 [19,] 1 1 [20,] 2 2 [21,] 2 2 [22,] 2 2 [23,] 1 1 [24,] 1 1 [25,] 2 1 [26,] 1 1 [27,] 2 2 [28,] 2 2 [29,] 1 1 [30,] 2 2 [31,] 2 2 [32,] 1 1 [33,] 2 2 [34,] 1 1 [35,] 2 2 [36,] 2 1 [37,] 2 2 [38,] 1 1 [39,] 1 1 [40,] 2 2 [41,] 2 2 [42,] 1 1 [43,] 1 2 [44,] 1 1 [45,] 1 1 [46,] 2 1 [47,] 1 1 [48,] 2 1 [49,] 2 2 [50,] 1 1 [51,] 1 2 [52,] 1 1 [53,] 2 2 [54,] 1 1 [55,] 1 1 [56,] 2 2 [57,] 2 2 [58,] 2 2 [59,] 2 2 [60,] 2 1 [61,] 2 2 [62,] 2 2 [63,] 2 1 [64,] 2 1 [65,] 2 2 [66,] 2 2 [67,] 1 1 [68,] 2 2 [69,] 1 1 [70,] 1 1 [71,] 2 1 [72,] 1 1 [73,] 2 1 [74,] 1 1 [75,] 1 1 [76,] 2 1 [77,] 2 2 [78,] 2 2 [79,] 1 1 [80,] 1 1 [81,] 1 1 [82,] 2 2 [83,] 1 1 [84,] 2 2 [85,] 1 1 [86,] 1 1 [87,] 1 1 [88,] 2 2 [89,] 2 2 [90,] 1 1 [91,] 2 1 [92,] 2 1 [93,] 1 1 [94,] 2 1 [95,] 2 2 [96,] 1 1 [97,] 2 2 [98,] 2 2 [99,] 2 2 [100,] 2 2 [101,] 2 1 [102,] 2 2 [103,] 1 1 [104,] 1 1 [105,] 1 1 [106,] 1 2 [107,] 2 2 [108,] 2 2 [109,] 1 2 [110,] 1 1 [111,] 2 2 [112,] 2 2 [113,] 1 1 [114,] 1 1 [115,] 1 1 [116,] 1 1 [117,] 2 2 [118,] 1 1 [119,] 2 2 [120,] 1 1 [121,] 2 2 [122,] 2 1 [123,] 1 1 [124,] 1 1 [125,] 1 1 [126,] 1 1 [127,] 2 2 [128,] 1 2 [129,] 2 2 [130,] 2 2 [131,] 2 2 [132,] 1 1 [133,] 1 1 [134,] 2 1 [135,] 2 2 [136,] 1 1 [137,] 2 2 [138,] 1 1 [139,] 2 2 [140,] 1 1 [141,] 1 1 [142,] 2 2 [143,] 2 2 [144,] 1 1 [145,] 2 2 [146,] 1 1 [147,] 2 2 [148,] 2 2 [149,] 1 1 [150,] 1 1 [151,] 1 1 [152,] 1 1 [153,] 1 1 [154,] 1 1 [155,] 1 1 [156,] 2 2 [157,] 1 1 [158,] 1 1 [159,] 1 1 [160,] 1 1 [161,] 1 1 [162,] 1 1 [163,] 1 1 [164,] 1 1 [0e+00,199642) [2e+05,439387] [0e+00,199642) 77 5 [2e+05,439387] 21 61 > postscript(file="/var/wessaorg/rcomp/tmp/4mxil1354891270.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/5ebi71354891270.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/6r4bu1354891270.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/731x31354891271.tab") + } > > try(system("convert tmp/2qniu1354891270.ps tmp/2qniu1354891270.png",intern=TRUE)) character(0) > try(system("convert tmp/39yfx1354891270.ps tmp/39yfx1354891270.png",intern=TRUE)) character(0) > try(system("convert tmp/4mxil1354891270.ps tmp/4mxil1354891270.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.882 0.502 4.363