R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list(162687 + ,0 + ,48 + ,21 + ,20465 + ,23975 + ,39 + ,201906 + ,1 + ,58 + ,20 + ,33629 + ,85634 + ,46 + ,7215 + ,0 + ,0 + ,0 + ,1423 + ,1929 + ,0 + ,146367 + ,0 + ,67 + ,27 + ,25629 + ,36294 + ,54 + ,257045 + ,0 + ,83 + ,31 + ,54002 + ,72255 + ,93 + ,524450 + ,1 + ,136 + ,36 + ,151036 + ,189748 + ,198 + ,188294 + ,1 + ,65 + ,23 + ,33287 + ,61834 + ,42 + ,195674 + ,0 + ,86 + ,30 + ,31172 + ,68167 + ,59 + ,177020 + ,0 + ,62 + ,30 + ,28113 + ,38462 + ,49 + ,325899 + ,1 + ,71 + ,27 + ,57803 + ,101219 + ,83 + ,121844 + ,2 + ,50 + ,24 + ,49830 + ,43270 + ,49 + ,203938 + ,0 + ,88 + ,30 + ,52143 + ,76183 + ,83 + ,113213 + ,0 + ,61 + ,22 + ,21055 + ,31476 + ,39 + ,220751 + ,4 + ,79 + ,28 + ,47007 + ,62157 + ,93 + ,172905 + ,4 + ,56 + ,18 + ,28735 + ,46261 + ,31 + ,156326 + ,3 + ,54 + ,22 + ,59147 + ,50063 + ,29 + ,145178 + ,0 + ,81 + ,37 + ,78950 + ,64483 + ,104 + ,89171 + ,5 + ,13 + ,15 + ,13497 + ,2341 + ,2 + ,172624 + ,0 + ,74 + ,34 + ,46154 + ,48149 + ,46 + ,39790 + ,0 + ,18 + ,18 + ,53249 + ,12743 + ,27 + ,87927 + ,0 + ,31 + ,15 + ,10726 + ,18743 + ,16 + ,241285 + ,0 + ,99 + ,30 + ,83700 + ,97057 + ,108 + ,195820 + ,1 + ,38 + ,25 + ,40400 + ,17675 + ,36 + ,146946 + ,1 + ,59 + ,34 + ,33797 + ,33106 + ,33 + ,159763 + ,1 + ,54 + ,21 + ,36205 + ,53311 + ,46 + ,207078 + ,0 + ,63 + ,21 + ,30165 + ,42754 + ,65 + ,212394 + ,0 + ,66 + ,25 + ,58534 + ,59056 + ,80 + ,201536 + ,0 + ,90 + ,31 + ,44663 + ,101621 + ,81 + ,394662 + ,0 + ,72 + ,31 + ,92556 + ,118120 + ,69 + ,217892 + ,0 + ,61 + ,20 + ,40078 + ,79572 + ,69 + ,182286 + ,0 + ,61 + ,28 + ,34711 + ,42744 + ,37 + ,181740 + ,2 + ,61 + ,22 + ,31076 + ,65931 + ,45 + ,137978 + ,4 + ,53 + ,17 + ,74608 + ,38575 + ,62 + ,255929 + ,0 + ,118 + ,25 + ,58092 + ,28795 + ,33 + ,236489 + ,1 + ,73 + ,25 + ,42009 + ,94440 + ,77 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,230761 + ,0 + ,54 + ,31 + ,36022 + ,38229 + ,34 + ,132807 + ,3 + ,54 + ,14 + ,23333 + ,31972 + ,44 + ,157118 + ,9 + ,46 + ,35 + ,53349 + ,40071 + ,43 + ,253254 + ,0 + ,83 + ,34 + ,92596 + ,132480 + ,117 + ,269329 + ,2 + ,106 + ,22 + ,49598 + ,62797 + ,125 + ,161273 + ,0 + ,44 + ,34 + ,44093 + ,40429 + ,49 + ,107181 + ,2 + ,27 + ,23 + ,84205 + ,45545 + ,76 + ,195891 + ,1 + ,64 + ,24 + ,63369 + ,57568 + ,81 + ,139667 + ,2 + ,71 + ,26 + ,60132 + ,39019 + ,111 + ,171101 + ,2 + ,44 + ,23 + ,37403 + ,53866 + ,61 + ,81407 + ,1 + ,23 + ,35 + ,24460 + ,38345 + ,56 + ,247563 + ,0 + ,78 + ,24 + ,46456 + ,50210 + ,54 + ,239807 + ,1 + ,60 + ,31 + ,66616 + ,80947 + ,47 + ,172743 + ,8 + ,73 + ,30 + ,41554 + ,43461 + ,55 + ,48188 + ,0 + ,12 + ,22 + ,22346 + ,14812 + ,14 + ,169355 + ,0 + ,104 + ,23 + ,30874 + ,37819 + ,44 + ,315622 + ,0 + ,83 + ,27 + ,68701 + ,102738 + ,115 + ,241518 + ,0 + ,57 + ,30 + ,35728 + ,54509 + ,57 + ,195583 + ,1 + ,67 + ,33 + ,29010 + ,62956 + ,48 + ,159913 + ,8 + ,44 + ,12 + ,23110 + ,55411 + ,40 + ,220241 + ,0 + ,53 + ,26 + ,38844 + ,50611 + ,51 + ,101694 + ,1 + ,26 + ,26 + ,27084 + ,26692 + ,32 + ,157258 + ,0 + ,67 + ,23 + ,35139 + ,60056 + ,36 + ,202536 + ,10 + ,36 + ,38 + ,57476 + ,25155 + ,47 + ,173505 + ,6 + ,56 + ,32 + ,33277 + ,42840 + ,51 + ,150518 + ,0 + ,52 + ,21 + ,31141 + ,39358 + ,37 + ,141491 + ,11 + ,54 + ,22 + ,61281 + ,47241 + ,52 + ,125612 + ,3 + ,57 + ,26 + ,25820 + ,49611 + ,42 + ,166049 + ,0 + ,27 + ,28 + ,23284 + ,41833 + ,11 + ,124197 + ,0 + ,58 + ,33 + ,35378 + ,48930 + ,47 + ,195043 + ,8 + ,76 + ,36 + ,74990 + ,110600 + ,59 + ,138708 + ,2 + ,93 + ,25 + ,29653 + ,52235 + ,82 + ,116552 + ,0 + ,59 + ,25 + ,64622 + ,53986 + ,49 + ,31970 + ,0 + ,5 + ,21 + ,4157 + ,4105 + ,6 + ,258158 + ,3 + ,57 + ,19 + ,29245 + ,59331 + ,83 + ,151184 + ,1 + ,42 + ,12 + ,50008 + ,47796 + ,56 + ,135926 + ,2 + ,88 + ,30 + ,52338 + ,38302 + ,114 + ,119629 + ,1 + ,53 + ,21 + ,13310 + ,14063 + ,46 + ,171518 + ,0 + ,81 + ,39 + ,92901 + ,54414 + ,46 + ,108949 + ,2 + ,35 + ,32 + ,10956 + ,9903 + ,2 + ,183471 + ,1 + ,102 + ,28 + ,34241 + ,53987 + ,51 + ,159966 + ,0 + ,71 + ,29 + ,75043 + ,88937 + ,96 + ,93786 + ,0 + ,28 + ,21 + ,21152 + ,21928 + ,20 + ,84971 + ,0 + ,34 + ,31 + ,42249 + ,29487 + ,57 + ,88882 + ,0 + ,54 + ,26 + ,42005 + ,35334 + ,49 + ,304603 + ,0 + ,49 + ,29 + ,41152 + ,57596 + ,51 + ,75101 + ,1 + ,30 + ,23 + ,14399 + ,29750 + ,40 + ,145043 + ,0 + ,57 + ,25 + ,28263 + ,41029 + ,40 + ,95827 + ,0 + ,54 + ,22 + ,17215 + ,12416 + ,36 + ,173924 + ,0 + ,38 + ,26 + ,48140 + ,51158 + ,64 + ,241957 + ,0 + ,63 + ,33 + ,62897 + ,79935 + ,117 + ,115367 + ,0 + ,58 + ,24 + ,22883 + ,26552 + ,40 + ,118408 + ,7 + ,46 + ,24 + ,41622 + ,25807 + ,46 + ,164078 + ,0 + ,46 + ,21 + ,40715 + ,50620 + ,61 + ,158931 + ,5 + ,51 + ,28 + ,65897 + ,61467 + ,59 + ,184139 + ,1 + ,87 + ,28 + ,76542 + ,65292 + ,94 + ,152856 + ,0 + ,39 + ,25 + ,37477 + ,55516 + ,36 + ,144014 + ,0 + ,28 + ,15 + ,53216 + ,42006 + ,51 + ,62535 + ,0 + ,26 + ,13 + ,40911 + ,26273 + ,39 + ,245196 + ,0 + ,52 + ,36 + ,57021 + ,90248 + ,62 + ,199841 + ,0 + ,96 + ,27 + ,73116 + ,61476 + ,79 + ,19349 + ,0 + ,13 + ,1 + ,3895 + ,9604 + ,14 + ,247280 + ,3 + ,43 + ,24 + ,46609 + ,45108 + ,45 + ,159408 + ,0 + ,42 + ,31 + ,29351 + ,47232 + ,43 + ,72128 + ,0 + ,30 + ,4 + ,2325 + ,3439 + ,8 + ,104253 + ,0 + ,59 + ,21 + ,31747 + ,30553 + ,41 + ,151090 + ,0 + ,73 + ,27 + ,32665 + ,24751 + ,25 + ,137382 + ,1 + ,39 + ,23 + ,19249 + ,34458 + ,22 + ,87448 + ,1 + ,36 + ,12 + ,15292 + ,24649 + ,18 + ,27676 + ,0 + ,2 + ,16 + ,5842 + ,2342 + ,3 + ,165507 + ,0 + ,102 + ,29 + ,33994 + ,52739 + ,54 + ,132148 + ,1 + ,30 + ,26 + ,13018 + ,6245 + ,6 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,95778 + ,0 + ,46 + ,25 + ,98177 + ,35381 + ,50 + ,109001 + ,0 + ,25 + ,21 + ,37941 + ,19595 + ,33 + ,158833 + ,0 + ,59 + ,24 + ,31032 + ,50848 + ,54 + ,147690 + ,1 + ,60 + ,21 + ,32683 + ,39443 + ,63 + ,89887 + ,0 + ,36 + ,21 + ,34545 + ,27023 + ,56 + ,3616 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,199005 + ,0 + ,45 + ,23 + ,27525 + ,61022 + ,49 + ,160930 + ,0 + ,79 + ,33 + ,66856 + ,63528 + ,90 + ,177948 + ,2 + ,30 + ,32 + ,28549 + ,34835 + ,51 + ,136061 + ,0 + ,43 + ,23 + ,38610 + ,37172 + ,29 + ,43410 + ,0 + ,7 + ,1 + ,2781 + ,13 + ,1 + ,184277 + ,1 + ,80 + ,29 + ,41211 + ,62548 + ,68 + ,108858 + ,0 + ,32 + ,20 + ,22698 + ,31334 + ,29 + ,141744 + ,8 + ,81 + ,33 + ,41194 + ,20839 + ,27 + ,60493 + ,3 + ,3 + ,12 + ,32689 + ,5084 + ,4 + ,19764 + ,1 + ,10 + ,2 + ,5752 + ,9927 + ,10 + ,177559 + ,3 + ,47 + ,21 + ,26757 + ,53229 + ,47 + ,140281 + ,0 + ,35 + ,28 + ,22527 + ,29877 + ,44 + ,164249 + ,0 + ,54 + ,35 + ,44810 + ,37310 + ,53 + ,11796 + ,0 + ,1 + ,2 + ,0 + ,0 + ,0 + ,10674 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,151322 + ,0 + ,46 + ,18 + ,100674 + ,50067 + ,40 + ,6836 + ,0 + ,0 + ,1 + ,0 + ,0 + ,0 + ,174712 + ,6 + ,51 + ,21 + ,57786 + ,47708 + ,57 + ,5118 + ,0 + ,5 + ,0 + ,0 + ,0 + ,0 + ,40248 + ,1 + ,8 + ,4 + ,5444 + ,6012 + ,6 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,127628 + ,0 + ,38 + ,29 + ,28470 + ,27749 + ,24 + ,88837 + ,0 + ,21 + ,26 + ,61849 + ,47555 + ,34 + ,7131 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,9056 + ,0 + ,0 + ,4 + ,2179 + ,1336 + ,10 + ,87957 + ,1 + ,18 + ,19 + ,8019 + ,11017 + ,16 + ,144470 + ,0 + ,53 + ,22 + ,39644 + ,55184 + ,93 + ,111408 + ,1 + ,17 + ,22 + ,23494 + ,43485 + ,28) + ,dim=c(7 + ,144) + ,dimnames=list(c('timeRFC' + ,'compshared' + ,'blogged' + ,'reviewedcomp' + ,'characters' + ,'seconds' + ,'inclhyperlinks') + ,1:144)) > y <- array(NA,dim=c(7,144),dimnames=list(c('timeRFC','compshared','blogged','reviewedcomp','characters','seconds','inclhyperlinks'),1:144)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par4 = 'yes' > par3 = '2' > par2 = 'equal' > 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] "timeRFC" > x[,par1] [1] 162687 201906 7215 146367 257045 524450 188294 195674 177020 325899 [11] 121844 203938 113213 220751 172905 156326 145178 89171 172624 39790 [21] 87927 241285 195820 146946 159763 207078 212394 201536 394662 217892 [31] 182286 181740 137978 255929 236489 0 230761 132807 157118 253254 [41] 269329 161273 107181 195891 139667 171101 81407 247563 239807 172743 [51] 48188 169355 315622 241518 195583 159913 220241 101694 157258 202536 [61] 173505 150518 141491 125612 166049 124197 195043 138708 116552 31970 [71] 258158 151184 135926 119629 171518 108949 183471 159966 93786 84971 [81] 88882 304603 75101 145043 95827 173924 241957 115367 118408 164078 [91] 158931 184139 152856 144014 62535 245196 199841 19349 247280 159408 [101] 72128 104253 151090 137382 87448 27676 165507 132148 0 95778 [111] 109001 158833 147690 89887 3616 0 199005 160930 177948 136061 [121] 43410 184277 108858 141744 60493 19764 177559 140281 164249 11796 [131] 10674 151322 6836 174712 5118 40248 0 127628 88837 7131 [141] 9056 87957 144470 111408 > 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]) C1 C2 138 6 > colnames(x) [1] "timeRFC" "compshared" "blogged" "reviewedcomp" [5] "characters" "seconds" "inclhyperlinks" > colnames(x)[par1] [1] "timeRFC" > x[,par1] [1] C1 C1 C1 C1 C1 C2 C1 C1 C1 C2 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 [26] C1 C1 C1 C2 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C2 C1 C1 C1 C1 C1 C1 C1 C1 C1 [51] C1 C1 C2 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 [76] C1 C1 C1 C1 C1 C1 C2 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 [101] C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 [126] C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 Levels: C1 C2 > 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/1mskg1324658898.tab") + } + } m.ct.i.pred m.ct.i.actu 1 2 1 1215 18 2 25 24 [1] 0.9854015 [1] 0.4897959 [1] 0.9664587 m.ct.x.pred m.ct.x.actu 1 2 1 143 4 2 11 0 [1] 0.9727891 [1] 0 [1] 0.9050633 > m Conditional inference tree with 2 terminal nodes Response: as.factor(timeRFC) Inputs: compshared, blogged, reviewedcomp, characters, seconds, inclhyperlinks Number of observations: 144 1) seconds <= 97057; criterion = 1, statistic = 27.702 2)* weights = 137 1) seconds > 97057 3)* weights = 7 > postscript(file="/var/wessaorg/rcomp/tmp/2xizz1324658898.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/3f2f31324658898.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,] 1 1 [2,] 1 1 [3,] 1 1 [4,] 1 1 [5,] 1 1 [6,] 2 2 [7,] 1 1 [8,] 1 1 [9,] 1 1 [10,] 2 2 [11,] 1 1 [12,] 1 1 [13,] 1 1 [14,] 1 1 [15,] 1 1 [16,] 1 1 [17,] 1 1 [18,] 1 1 [19,] 1 1 [20,] 1 1 [21,] 1 1 [22,] 1 1 [23,] 1 1 [24,] 1 1 [25,] 1 1 [26,] 1 1 [27,] 1 1 [28,] 1 2 [29,] 2 2 [30,] 1 1 [31,] 1 1 [32,] 1 1 [33,] 1 1 [34,] 1 1 [35,] 1 1 [36,] 1 1 [37,] 1 1 [38,] 1 1 [39,] 1 1 [40,] 1 2 [41,] 2 1 [42,] 1 1 [43,] 1 1 [44,] 1 1 [45,] 1 1 [46,] 1 1 [47,] 1 1 [48,] 1 1 [49,] 1 1 [50,] 1 1 [51,] 1 1 [52,] 1 1 [53,] 2 2 [54,] 1 1 [55,] 1 1 [56,] 1 1 [57,] 1 1 [58,] 1 1 [59,] 1 1 [60,] 1 1 [61,] 1 1 [62,] 1 1 [63,] 1 1 [64,] 1 1 [65,] 1 1 [66,] 1 1 [67,] 1 2 [68,] 1 1 [69,] 1 1 [70,] 1 1 [71,] 1 1 [72,] 1 1 [73,] 1 1 [74,] 1 1 [75,] 1 1 [76,] 1 1 [77,] 1 1 [78,] 1 1 [79,] 1 1 [80,] 1 1 [81,] 1 1 [82,] 2 1 [83,] 1 1 [84,] 1 1 [85,] 1 1 [86,] 1 1 [87,] 1 1 [88,] 1 1 [89,] 1 1 [90,] 1 1 [91,] 1 1 [92,] 1 1 [93,] 1 1 [94,] 1 1 [95,] 1 1 [96,] 1 1 [97,] 1 1 [98,] 1 1 [99,] 1 1 [100,] 1 1 [101,] 1 1 [102,] 1 1 [103,] 1 1 [104,] 1 1 [105,] 1 1 [106,] 1 1 [107,] 1 1 [108,] 1 1 [109,] 1 1 [110,] 1 1 [111,] 1 1 [112,] 1 1 [113,] 1 1 [114,] 1 1 [115,] 1 1 [116,] 1 1 [117,] 1 1 [118,] 1 1 [119,] 1 1 [120,] 1 1 [121,] 1 1 [122,] 1 1 [123,] 1 1 [124,] 1 1 [125,] 1 1 [126,] 1 1 [127,] 1 1 [128,] 1 1 [129,] 1 1 [130,] 1 1 [131,] 1 1 [132,] 1 1 [133,] 1 1 [134,] 1 1 [135,] 1 1 [136,] 1 1 [137,] 1 1 [138,] 1 1 [139,] 1 1 [140,] 1 1 [141,] 1 1 [142,] 1 1 [143,] 1 1 [144,] 1 1 C1 C2 C1 135 3 C2 2 4 > postscript(file="/var/wessaorg/rcomp/tmp/4ici91324658898.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/5uhii1324658898.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/6imr51324658898.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/7zux71324658898.tab") + } > > try(system("convert tmp/2xizz1324658898.ps tmp/2xizz1324658898.png",intern=TRUE)) character(0) > try(system("convert tmp/3f2f31324658898.ps tmp/3f2f31324658898.png",intern=TRUE)) character(0) > try(system("convert tmp/4ici91324658898.ps tmp/4ici91324658898.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.229 0.281 3.508