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(140824 + ,73 + ,279055 + ,95 + ,96 + ,110459 + ,74 + ,212083 + ,68 + ,75 + ,105079 + ,83 + ,233939 + ,64 + ,70 + ,112098 + ,106 + ,222117 + ,139 + ,134 + ,43929 + ,54 + ,179751 + ,51 + ,72 + ,76173 + ,28 + ,70849 + ,46 + ,8 + ,187326 + ,131 + ,568125 + ,118 + ,169 + ,22807 + ,19 + ,33186 + ,46 + ,1 + ,144408 + ,62 + ,227332 + ,79 + ,88 + ,66485 + ,48 + ,258874 + ,76 + ,98 + ,79089 + ,119 + ,357366 + ,82 + ,112 + ,81625 + ,130 + ,263934 + ,66 + ,125 + ,68788 + ,83 + ,204003 + ,60 + ,57 + ,103297 + ,85 + ,368577 + ,117 + ,139 + ,69446 + ,88 + ,269455 + ,50 + ,87 + ,114948 + ,187 + ,395936 + ,133 + ,176 + ,167949 + ,76 + ,335567 + ,63 + ,114 + ,125081 + ,171 + ,423110 + ,100 + ,121 + ,125818 + ,58 + ,182016 + ,44 + ,103 + ,136588 + ,88 + ,267365 + ,65 + ,135 + ,112431 + ,73 + ,279428 + ,103 + ,123 + ,103037 + ,111 + ,508849 + ,103 + ,99 + ,82317 + ,47 + ,206722 + ,62 + ,74 + ,118906 + ,58 + ,200004 + ,70 + ,103 + ,83515 + ,133 + ,257139 + ,159 + ,158 + ,104581 + ,137 + ,270815 + ,78 + ,116 + ,103129 + ,133 + ,296850 + ,101 + ,102 + ,83243 + ,90 + ,307100 + ,73 + ,132 + ,37110 + ,58 + ,184160 + ,58 + ,62 + ,113344 + ,79 + ,393860 + ,147 + ,150 + ,139165 + ,89 + ,327660 + ,54 + ,143 + ,86652 + ,82 + ,252512 + ,84 + ,50 + ,112302 + ,102 + ,373013 + ,56 + ,141 + ,69652 + ,47 + ,115602 + ,45 + ,48 + ,119442 + ,103 + ,430118 + ,87 + ,141 + ,69867 + ,56 + ,273950 + ,87 + ,83 + ,101629 + ,128 + ,428077 + ,77 + ,112 + ,70168 + ,91 + ,251349 + ,72 + ,79 + ,31081 + ,34 + ,115658 + ,36 + ,33 + ,103925 + ,209 + ,395417 + ,51 + ,152 + ,92622 + ,85 + ,343783 + ,44 + ,126 + ,79011 + ,77 + ,207083 + ,75 + ,85 + ,93487 + ,82 + ,214456 + ,87 + ,84 + ,64520 + ,67 + ,182398 + ,97 + ,68 + ,93473 + ,84 + ,157164 + ,90 + ,50 + ,114360 + ,157 + ,459455 + ,860 + ,101 + ,33032 + ,42 + ,78800 + ,57 + ,20 + ,96125 + ,84 + ,217932 + ,99 + ,101 + ,151911 + ,123 + ,368086 + ,120 + ,150 + ,89256 + ,67 + ,215843 + ,76 + ,118 + ,95676 + ,80 + ,244765 + ,56 + ,99 + ,5950 + ,24 + ,24188 + ,20 + ,8 + ,149695 + ,333 + ,399093 + ,94 + ,88 + ,32551 + ,17 + ,65029 + ,21 + ,21 + ,31701 + ,64 + ,101097 + ,70 + ,30 + ,100087 + ,65 + ,305640 + ,133 + ,98 + ,169707 + ,90 + ,369627 + ,86 + ,163 + ,150491 + ,204 + ,367127 + ,224 + ,132 + ,120192 + ,152 + ,374193 + ,65 + ,161 + ,95893 + ,89 + ,270099 + ,86 + ,89 + ,151715 + ,151 + ,391871 + ,70 + ,160 + ,176225 + ,121 + ,315924 + ,148 + ,139 + ,59900 + ,124 + ,291391 + ,72 + ,104 + ,104767 + ,93 + ,295075 + ,59 + ,103 + ,114799 + ,81 + ,280018 + ,67 + ,66 + ,72128 + ,71 + ,267432 + ,58 + ,163 + ,143592 + ,140 + ,215924 + ,60 + ,93 + ,89626 + ,157 + ,256641 + ,105 + ,85 + ,131072 + ,87 + ,260919 + ,84 + ,150 + ,126817 + ,73 + ,182961 + ,63 + ,143 + ,81351 + ,74 + ,256967 + ,67 + ,107 + ,22618 + ,32 + ,73566 + ,39 + ,22 + ,88977 + ,93 + ,272362 + ,60 + ,85 + ,92059 + ,61 + ,220707 + ,94 + ,91 + ,81897 + ,68 + ,228835 + ,67 + ,131 + ,108146 + ,91 + ,371391 + ,96 + ,140 + ,126372 + ,104 + ,398210 + ,54 + ,156 + ,249771 + ,110 + ,220401 + ,54 + ,81 + ,71154 + ,70 + ,229333 + ,62 + ,137 + ,71571 + ,71 + ,217623 + ,71 + ,102 + ,55918 + ,53 + ,200046 + ,50 + ,72 + ,160141 + ,131 + ,483074 + ,117 + ,161 + ,38692 + ,71 + ,145943 + ,45 + ,30 + ,102812 + ,108 + ,295224 + ,61 + ,120 + ,56622 + ,25 + ,80953 + ,31 + ,49 + ,15986 + ,61 + ,180759 + ,175 + ,71 + ,123534 + ,61 + ,179344 + ,70 + ,76 + ,108535 + ,221 + ,415550 + ,284 + ,85 + ,93879 + ,128 + ,369093 + ,95 + ,146 + ,144551 + ,106 + ,180679 + ,72 + ,165 + ,56750 + ,104 + ,299505 + ,63 + ,89 + ,127654 + ,84 + ,292260 + ,75 + ,168 + ,65594 + ,67 + ,199481 + ,90 + ,48 + ,59938 + ,78 + ,282361 + ,89 + ,149 + ,146975 + ,89 + ,329281 + ,138 + ,75 + ,165904 + ,48 + ,234577 + ,68 + ,107 + ,169265 + ,67 + ,297995 + ,80 + ,116 + ,183500 + ,88 + ,305984 + ,65 + ,165 + ,165986 + ,163 + ,416463 + ,130 + ,155 + ,184923 + ,118 + ,414359 + ,85 + ,165 + ,140358 + ,142 + ,297080 + ,83 + ,121 + ,149959 + ,70 + ,318283 + ,89 + ,156 + ,57224 + ,197 + ,222281 + ,116 + ,86 + ,43750 + ,14 + ,43287 + ,43 + ,13 + ,48029 + ,86 + ,223456 + ,87 + ,113 + ,104978 + ,159 + ,261598 + ,80 + ,114 + ,100046 + ,60 + ,299566 + ,132 + ,133 + ,101047 + ,95 + ,321797 + ,59 + ,169 + ,197426 + ,89 + ,174736 + ,50 + ,30 + ,160902 + ,102 + ,169579 + ,87 + ,121 + ,147172 + ,77 + ,354041 + ,62 + ,82 + ,109432 + ,90 + ,303273 + ,70 + ,148 + ,1168 + ,13 + ,23668 + ,9 + ,12 + ,83248 + ,79 + ,196743 + ,54 + ,146 + ,25162 + ,25 + ,61857 + ,25 + ,23 + ,45724 + ,53 + ,207339 + ,113 + ,84 + ,110529 + ,123 + ,431443 + ,63 + ,163 + ,855 + ,16 + ,21054 + ,2 + ,4 + ,101382 + ,52 + ,252805 + ,67 + ,81 + ,14116 + ,22 + ,31961 + ,22 + ,18 + ,89506 + ,124 + ,360401 + ,157 + ,118 + ,135356 + ,76 + ,251240 + ,79 + ,76 + ,116066 + ,96 + ,187003 + ,113 + ,55 + ,144244 + ,58 + ,180842 + ,50 + ,62 + ,8773 + ,34 + ,38214 + ,52 + ,16 + ,102153 + ,55 + ,278173 + ,113 + ,98 + ,117440 + ,84 + ,358276 + ,115 + ,137 + ,104128 + ,66 + ,211775 + ,78 + ,50 + ,134238 + ,89 + ,445926 + ,135 + ,152 + ,134047 + ,99 + ,348017 + ,120 + ,163 + ,279488 + ,133 + ,441946 + ,122 + ,142 + ,79756 + ,42 + ,210700 + ,54 + ,77 + ,66089 + ,46 + ,126320 + ,63 + ,59 + ,102070 + ,361 + ,316128 + ,162 + ,94 + ,146760 + ,198 + ,466139 + ,162 + ,128 + ,154771 + ,62 + ,162279 + ,107 + ,63 + ,165933 + ,139 + ,412099 + ,146 + ,127 + ,64593 + ,83 + ,173802 + ,77 + ,59 + ,92280 + ,54 + ,292443 + ,87 + ,118 + ,67150 + ,100 + ,283913 + ,192 + ,110 + ,128692 + ,126 + ,244802 + ,75 + ,45 + ,124089 + ,125 + ,387072 + ,131 + ,96 + ,125386 + ,92 + ,246963 + ,67 + ,128 + ,37238 + ,63 + ,173260 + ,37 + ,41 + ,140015 + ,108 + ,346748 + ,61 + ,146 + ,150047 + ,58 + ,176654 + ,127 + ,147 + ,154451 + ,92 + ,264767 + ,58 + ,121 + ,156349 + ,112 + ,314070 + ,71 + ,185 + ,0 + ,0 + ,1 + ,0 + ,0 + ,6023 + ,10 + ,14688 + ,0 + ,4 + ,0 + ,1 + ,98 + ,0 + ,0 + ,0 + ,2 + ,455 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,84601 + ,92 + ,284420 + ,72 + ,85 + ,68946 + ,164 + ,410509 + ,123 + ,157 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,4 + ,203 + ,0 + ,0 + ,1644 + ,5 + ,7199 + ,0 + ,7 + ,6179 + ,20 + ,46660 + ,7 + ,12 + ,3926 + ,5 + ,17547 + ,3 + ,0 + ,52789 + ,46 + ,121550 + ,106 + ,37 + ,0 + ,2 + ,969 + ,0 + ,0 + ,100350 + ,74 + ,242258 + ,53 + ,62) + ,dim=c(5 + ,164) + ,dimnames=list(c('Characters' + ,'Logins' + ,'Time' + ,'PR' + ,'Computations') + ,1:164)) > y <- array(NA,dim=c(5,164),dimnames=list(c('Characters','Logins','Time','PR','Computations'),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 = 'quantiles' > 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] "Characters" > x[,par1] [1] 140824 110459 105079 112098 43929 76173 187326 22807 144408 66485 [11] 79089 81625 68788 103297 69446 114948 167949 125081 125818 136588 [21] 112431 103037 82317 118906 83515 104581 103129 83243 37110 113344 [31] 139165 86652 112302 69652 119442 69867 101629 70168 31081 103925 [41] 92622 79011 93487 64520 93473 114360 33032 96125 151911 89256 [51] 95676 5950 149695 32551 31701 100087 169707 150491 120192 95893 [61] 151715 176225 59900 104767 114799 72128 143592 89626 131072 126817 [71] 81351 22618 88977 92059 81897 108146 126372 249771 71154 71571 [81] 55918 160141 38692 102812 56622 15986 123534 108535 93879 144551 [91] 56750 127654 65594 59938 146975 165904 169265 183500 165986 184923 [101] 140358 149959 57224 43750 48029 104978 100046 101047 197426 160902 [111] 147172 109432 1168 83248 25162 45724 110529 855 101382 14116 [121] 89506 135356 116066 144244 8773 102153 117440 104128 134238 134047 [131] 279488 79756 66089 102070 146760 154771 165933 64593 92280 67150 [141] 128692 124089 125386 37238 140015 150047 154451 156349 0 6023 [151] 0 0 0 0 84601 68946 0 0 1644 6179 [161] 3926 52789 0 100350 > 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,100350) [1e+05,279488] 82 82 > colnames(x) [1] "Characters" "Logins" "Time" "PR" "Computations" > colnames(x)[par1] [1] "Characters" > x[,par1] [1] [1e+05,279488] [1e+05,279488] [1e+05,279488] [1e+05,279488] [0e+00,100350) [6] [0e+00,100350) [1e+05,279488] [0e+00,100350) [1e+05,279488] [0e+00,100350) [11] [0e+00,100350) [0e+00,100350) [0e+00,100350) [1e+05,279488] [0e+00,100350) [16] [1e+05,279488] [1e+05,279488] [1e+05,279488] [1e+05,279488] [1e+05,279488] [21] [1e+05,279488] [1e+05,279488] [0e+00,100350) [1e+05,279488] [0e+00,100350) [26] [1e+05,279488] [1e+05,279488] [0e+00,100350) [0e+00,100350) [1e+05,279488] [31] [1e+05,279488] [0e+00,100350) [1e+05,279488] [0e+00,100350) [1e+05,279488] [36] [0e+00,100350) [1e+05,279488] [0e+00,100350) [0e+00,100350) [1e+05,279488] [41] [0e+00,100350) [0e+00,100350) [0e+00,100350) [0e+00,100350) [0e+00,100350) [46] [1e+05,279488] [0e+00,100350) [0e+00,100350) [1e+05,279488] [0e+00,100350) [51] [0e+00,100350) [0e+00,100350) [1e+05,279488] [0e+00,100350) [0e+00,100350) [56] [0e+00,100350) [1e+05,279488] [1e+05,279488] [1e+05,279488] [0e+00,100350) [61] [1e+05,279488] [1e+05,279488] [0e+00,100350) [1e+05,279488] [1e+05,279488] [66] [0e+00,100350) [1e+05,279488] [0e+00,100350) [1e+05,279488] [1e+05,279488] [71] [0e+00,100350) [0e+00,100350) [0e+00,100350) [0e+00,100350) [0e+00,100350) [76] [1e+05,279488] [1e+05,279488] [1e+05,279488] [0e+00,100350) [0e+00,100350) [81] [0e+00,100350) [1e+05,279488] [0e+00,100350) [1e+05,279488] [0e+00,100350) [86] [0e+00,100350) [1e+05,279488] [1e+05,279488] [0e+00,100350) [1e+05,279488] [91] [0e+00,100350) [1e+05,279488] [0e+00,100350) [0e+00,100350) [1e+05,279488] [96] [1e+05,279488] [1e+05,279488] [1e+05,279488] [1e+05,279488] [1e+05,279488] [101] [1e+05,279488] [1e+05,279488] [0e+00,100350) [0e+00,100350) [0e+00,100350) [106] [1e+05,279488] [0e+00,100350) [1e+05,279488] [1e+05,279488] [1e+05,279488] [111] [1e+05,279488] [1e+05,279488] [0e+00,100350) [0e+00,100350) [0e+00,100350) [116] [0e+00,100350) [1e+05,279488] [0e+00,100350) [1e+05,279488] [0e+00,100350) [121] [0e+00,100350) [1e+05,279488] [1e+05,279488] [1e+05,279488] [0e+00,100350) [126] [1e+05,279488] [1e+05,279488] [1e+05,279488] [1e+05,279488] [1e+05,279488] [131] [1e+05,279488] [0e+00,100350) [0e+00,100350) [1e+05,279488] [1e+05,279488] [136] [1e+05,279488] [1e+05,279488] [0e+00,100350) [0e+00,100350) [0e+00,100350) [141] [1e+05,279488] [1e+05,279488] [1e+05,279488] [0e+00,100350) [1e+05,279488] [146] [1e+05,279488] [1e+05,279488] [1e+05,279488] [0e+00,100350) [0e+00,100350) [151] [0e+00,100350) [0e+00,100350) [0e+00,100350) [0e+00,100350) [0e+00,100350) [156] [0e+00,100350) [0e+00,100350) [0e+00,100350) [0e+00,100350) [0e+00,100350) [161] [0e+00,100350) [0e+00,100350) [0e+00,100350) [1e+05,279488] Levels: [0e+00,100350) [1e+05,279488] > 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/1elvs1324626591.tab") + } + } > m Conditional inference tree with 4 terminal nodes Response: as.factor(Characters) Inputs: Logins, Time, PR, Computations Number of observations: 164 1) Time <= 292443; criterion = 1, statistic = 53.825 2) Computations <= 41; criterion = 1, statistic = 15.841 3) Logins <= 32; criterion = 0.981, statistic = 8.003 4)* weights = 22 3) Logins > 32 5)* weights = 8 2) Computations > 41 6)* weights = 77 1) Time > 292443 7)* weights = 57 > postscript(file="/var/wessaorg/rcomp/tmp/2otwk1324626591.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/3423b1324626591.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 1 [2,] 2 1 [3,] 2 1 [4,] 2 1 [5,] 1 1 [6,] 1 1 [7,] 2 2 [8,] 1 1 [9,] 2 1 [10,] 1 1 [11,] 1 2 [12,] 1 1 [13,] 1 1 [14,] 2 2 [15,] 1 1 [16,] 2 2 [17,] 2 2 [18,] 2 2 [19,] 2 1 [20,] 2 1 [21,] 2 1 [22,] 2 2 [23,] 1 1 [24,] 2 1 [25,] 1 1 [26,] 2 1 [27,] 2 2 [28,] 1 2 [29,] 1 1 [30,] 2 2 [31,] 2 2 [32,] 1 1 [33,] 2 2 [34,] 1 1 [35,] 2 2 [36,] 1 1 [37,] 2 2 [38,] 1 1 [39,] 1 1 [40,] 2 2 [41,] 1 2 [42,] 1 1 [43,] 1 1 [44,] 1 1 [45,] 1 1 [46,] 2 2 [47,] 1 1 [48,] 1 1 [49,] 2 2 [50,] 1 1 [51,] 1 1 [52,] 1 1 [53,] 2 2 [54,] 1 1 [55,] 1 1 [56,] 1 2 [57,] 2 2 [58,] 2 2 [59,] 2 2 [60,] 1 1 [61,] 2 2 [62,] 2 2 [63,] 1 1 [64,] 2 2 [65,] 2 1 [66,] 1 1 [67,] 2 1 [68,] 1 1 [69,] 2 1 [70,] 2 1 [71,] 1 1 [72,] 1 1 [73,] 1 1 [74,] 1 1 [75,] 1 1 [76,] 2 2 [77,] 2 2 [78,] 2 1 [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,] 2 1 [88,] 2 2 [89,] 1 2 [90,] 2 1 [91,] 1 2 [92,] 2 1 [93,] 1 1 [94,] 1 1 [95,] 2 2 [96,] 2 1 [97,] 2 2 [98,] 2 2 [99,] 2 2 [100,] 2 2 [101,] 2 2 [102,] 2 2 [103,] 1 1 [104,] 1 1 [105,] 1 1 [106,] 2 1 [107,] 1 2 [108,] 2 2 [109,] 2 1 [110,] 2 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 1 [120,] 1 1 [121,] 1 2 [122,] 2 1 [123,] 2 1 [124,] 2 1 [125,] 1 1 [126,] 2 1 [127,] 2 2 [128,] 2 1 [129,] 2 2 [130,] 2 2 [131,] 2 2 [132,] 1 1 [133,] 1 1 [134,] 2 2 [135,] 2 2 [136,] 2 1 [137,] 2 2 [138,] 1 1 [139,] 1 1 [140,] 1 1 [141,] 2 1 [142,] 2 2 [143,] 2 1 [144,] 1 1 [145,] 2 2 [146,] 2 1 [147,] 2 1 [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,] 1 2 [157,] 1 1 [158,] 1 1 [159,] 1 1 [160,] 1 1 [161,] 1 1 [162,] 1 1 [163,] 1 1 [164,] 2 1 [0e+00,100350) [1e+05,279488] [0e+00,100350) 73 9 [1e+05,279488] 34 48 > postscript(file="/var/wessaorg/rcomp/tmp/4iecl1324626591.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/5dtht1324626591.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/69c0v1324626591.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/77t9j1324626591.tab") + } > > try(system("convert tmp/2otwk1324626591.ps tmp/2otwk1324626591.png",intern=TRUE)) character(0) > try(system("convert tmp/3423b1324626591.ps tmp/3423b1324626591.png",intern=TRUE)) character(0) > try(system("convert tmp/4iecl1324626591.ps tmp/4iecl1324626591.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.599 0.316 3.092