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(279055 + ,73 + ,96 + ,130 + ,140824 + ,212408 + ,75 + ,75 + ,143 + ,110459 + ,233939 + ,83 + ,70 + ,118 + ,105079 + ,222117 + ,106 + ,134 + ,146 + ,112098 + ,189911 + ,56 + ,83 + ,73 + ,43929 + ,70849 + ,28 + ,8 + ,89 + ,76173 + ,605767 + ,135 + ,173 + ,146 + ,187326 + ,33186 + ,19 + ,1 + ,22 + ,22807 + ,227332 + ,62 + ,88 + ,132 + ,144408 + ,258874 + ,48 + ,98 + ,92 + ,66485 + ,369815 + ,121 + ,114 + ,147 + ,79089 + ,264989 + ,131 + ,125 + ,203 + ,81625 + ,212638 + ,87 + ,57 + ,113 + ,68788 + ,368577 + ,85 + ,139 + ,171 + ,103297 + ,269455 + ,88 + ,87 + ,87 + ,69446 + ,398124 + ,191 + ,176 + ,208 + ,114948 + ,335567 + ,77 + ,114 + ,153 + ,167949 + ,428322 + ,172 + ,121 + ,97 + ,125081 + ,182016 + ,58 + ,103 + ,95 + ,125818 + ,267365 + ,89 + ,135 + ,197 + ,136588 + ,279428 + ,73 + ,123 + ,160 + ,112431 + ,508849 + ,111 + ,99 + ,148 + ,103037 + ,206722 + ,47 + ,74 + ,84 + ,82317 + ,200004 + ,58 + ,103 + ,227 + ,118906 + ,257139 + ,133 + ,158 + ,154 + ,83515 + ,270941 + ,138 + ,116 + ,151 + ,104581 + ,324969 + ,134 + ,114 + ,142 + ,103129 + ,329962 + ,92 + ,150 + ,148 + ,83243 + ,190867 + ,60 + ,64 + ,110 + ,37110 + ,393860 + ,79 + ,150 + ,149 + ,113344 + ,327660 + ,89 + ,143 + ,179 + ,139165 + ,269239 + ,83 + ,50 + ,149 + ,86652 + ,396136 + ,106 + ,145 + ,187 + ,112302 + ,130446 + ,49 + ,56 + ,153 + ,69652 + ,430118 + ,104 + ,141 + ,163 + ,119442 + ,273950 + ,56 + ,83 + ,127 + ,69867 + ,428077 + ,128 + ,112 + ,151 + ,101629 + ,254312 + ,93 + ,79 + ,100 + ,70168 + ,120351 + ,35 + ,33 + ,46 + ,31081 + ,395658 + ,212 + ,152 + ,156 + ,103925 + ,345875 + ,86 + ,126 + ,128 + ,92622 + ,216827 + ,82 + ,97 + ,111 + ,79011 + ,224524 + ,83 + ,84 + ,119 + ,93487 + ,182485 + ,69 + ,68 + ,148 + ,64520 + ,157164 + ,85 + ,50 + ,65 + ,93473 + ,459455 + ,157 + ,101 + ,134 + ,114360 + ,78800 + ,42 + ,20 + ,66 + ,33032 + ,255072 + ,85 + ,107 + ,201 + ,96125 + ,368086 + ,123 + ,150 + ,177 + ,151911 + ,230299 + ,70 + ,129 + ,156 + ,89256 + ,244782 + ,81 + ,99 + ,158 + ,95676 + ,24188 + ,24 + ,8 + ,7 + ,5950 + ,400109 + ,334 + ,88 + ,175 + ,149695 + ,65029 + ,17 + ,21 + ,61 + ,32551 + ,101097 + ,64 + ,30 + ,41 + ,31701 + ,309810 + ,67 + ,102 + ,133 + ,100087 + ,375638 + ,91 + ,166 + ,228 + ,169707 + ,367127 + ,204 + ,132 + ,140 + ,150491 + ,381998 + ,155 + ,161 + ,155 + ,120192 + ,280106 + ,90 + ,90 + ,141 + ,95893 + ,400971 + ,153 + ,160 + ,181 + ,151715 + ,315924 + ,122 + ,139 + ,75 + ,176225 + ,291391 + ,124 + ,104 + ,97 + ,59900 + ,295075 + ,93 + ,103 + ,142 + ,104767 + ,280018 + ,81 + ,66 + ,136 + ,114799 + ,267432 + ,71 + ,163 + ,87 + ,72128 + ,217181 + ,141 + ,93 + ,140 + ,143592 + ,258166 + ,159 + ,85 + ,169 + ,89626 + ,260919 + ,87 + ,150 + ,129 + ,131072 + ,182961 + ,73 + ,143 + ,92 + ,126817 + ,256967 + ,74 + ,107 + ,160 + ,81351 + ,73566 + ,32 + ,22 + ,67 + ,22618 + ,272362 + ,93 + ,85 + ,179 + ,88977 + ,229056 + ,62 + ,101 + ,90 + ,92059 + ,229851 + ,70 + ,131 + ,144 + ,81897 + ,371391 + ,91 + ,140 + ,144 + ,108146 + ,398210 + ,104 + ,156 + ,144 + ,126372 + ,220419 + ,111 + ,81 + ,134 + ,249771 + ,231884 + ,72 + ,137 + ,146 + ,71154 + ,217714 + ,72 + ,102 + ,121 + ,71571 + ,206169 + ,54 + ,74 + ,112 + ,55918 + ,483074 + ,131 + ,161 + ,145 + ,160141 + ,146100 + ,72 + ,30 + ,99 + ,38692 + ,295224 + ,109 + ,120 + ,96 + ,102812 + ,80953 + ,25 + ,49 + ,27 + ,56622 + ,217384 + ,63 + ,121 + ,77 + ,15986 + ,179344 + ,62 + ,76 + ,137 + ,123534 + ,415550 + ,222 + ,85 + ,151 + ,108535 + ,389059 + ,129 + ,151 + ,126 + ,93879 + ,180679 + ,106 + ,165 + ,159 + ,144551 + ,299505 + ,104 + ,89 + ,101 + ,56750 + ,292260 + ,84 + ,168 + ,144 + ,127654 + ,199481 + ,68 + ,48 + ,102 + ,65594 + ,282361 + ,78 + ,149 + ,135 + ,59938 + ,329281 + ,89 + ,75 + ,147 + ,146975 + ,234577 + ,48 + ,107 + ,155 + ,165904 + ,297995 + ,67 + ,116 + ,138 + ,169265 + ,342490 + ,90 + ,181 + ,113 + ,183500 + ,416463 + ,163 + ,155 + ,248 + ,165986 + ,415683 + ,119 + ,165 + ,116 + ,184923 + ,297080 + ,142 + ,121 + ,176 + ,140358 + ,331792 + ,71 + ,176 + ,140 + ,149959 + ,229772 + ,202 + ,86 + ,59 + ,57224 + ,43287 + ,14 + ,13 + ,64 + ,43750 + ,238089 + ,87 + ,120 + ,40 + ,48029 + ,263322 + ,160 + ,117 + ,98 + ,104978 + ,302082 + ,61 + ,133 + ,139 + ,100046 + ,321797 + ,95 + ,169 + ,135 + ,101047 + ,193926 + ,96 + ,39 + ,97 + ,197426 + ,175138 + ,105 + ,125 + ,142 + ,160902 + ,354041 + ,78 + ,82 + ,155 + ,147172 + ,303273 + ,91 + ,148 + ,115 + ,109432 + ,23668 + ,13 + ,12 + ,0 + ,1168 + ,196743 + ,79 + ,146 + ,103 + ,83248 + ,61857 + ,25 + ,23 + ,30 + ,25162 + ,217543 + ,54 + ,87 + ,130 + ,45724 + ,440711 + ,128 + ,164 + ,102 + ,110529 + ,21054 + ,16 + ,4 + ,0 + ,855 + ,252805 + ,52 + ,81 + ,77 + ,101382 + ,31961 + ,22 + ,18 + ,9 + ,14116 + ,360436 + ,125 + ,118 + ,150 + ,89506 + ,251948 + ,77 + ,76 + ,163 + ,135356 + ,187320 + ,97 + ,55 + ,148 + ,116066 + ,180842 + ,58 + ,62 + ,94 + ,144244 + ,38214 + ,34 + ,16 + ,21 + ,8773 + ,280392 + ,56 + ,98 + ,151 + ,102153 + ,358276 + ,84 + ,137 + ,187 + ,117440 + ,211775 + ,67 + ,50 + ,171 + ,104128 + ,447335 + ,90 + ,152 + ,170 + ,134238 + ,348017 + ,99 + ,163 + ,145 + ,134047 + ,441946 + ,133 + ,142 + ,198 + ,279488 + ,215177 + ,43 + ,80 + ,152 + ,79756 + ,130177 + ,47 + ,59 + ,112 + ,66089 + ,318037 + ,365 + ,94 + ,173 + ,102070 + ,466139 + ,198 + ,128 + ,177 + ,146760 + ,162279 + ,62 + ,63 + ,153 + ,154771 + ,416643 + ,140 + ,127 + ,161 + ,165933 + ,178322 + ,86 + ,60 + ,115 + ,64593 + ,292443 + ,54 + ,118 + ,147 + ,92280 + ,283913 + ,100 + ,110 + ,124 + ,67150 + ,244802 + ,126 + ,45 + ,57 + ,128692 + ,387072 + ,125 + ,96 + ,144 + ,124089 + ,246963 + ,92 + ,128 + ,126 + ,125386 + ,173260 + ,63 + ,41 + ,78 + ,37238 + ,346748 + ,108 + ,146 + ,153 + ,140015 + ,178402 + ,60 + ,147 + ,196 + ,150047 + ,268750 + ,96 + ,121 + ,130 + ,154451 + ,314070 + ,112 + ,185 + ,159 + ,156349 + ,1 + ,0 + ,0 + ,0 + ,0 + ,14688 + ,10 + ,4 + ,0 + ,6023 + ,98 + ,1 + ,0 + ,0 + ,0 + ,455 + ,2 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,291650 + ,94 + ,85 + ,94 + ,84601 + ,415421 + ,168 + ,164 + ,129 + ,68946 + ,0 + ,0 + ,0 + ,0 + ,0 + ,203 + ,4 + ,0 + ,0 + ,0 + ,7199 + ,5 + ,7 + ,0 + ,1644 + ,46660 + ,20 + ,12 + ,13 + ,6179 + ,17547 + ,5 + ,0 + ,4 + ,3926 + ,121550 + ,46 + ,37 + ,89 + ,52789 + ,969 + ,2 + ,0 + ,0 + ,0 + ,242774 + ,75 + ,62 + ,71 + ,100350) + ,dim=c(5 + ,164) + ,dimnames=list(c('TotalTime' + ,'Logins' + ,'NumberOfComputations' + ,'LongFeedback' + ,'TotalCharacters') + ,1:164)) > y <- array(NA,dim=c(5,164),dimnames=list(c('TotalTime','Logins','NumberOfComputations','LongFeedback','TotalCharacters'),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 = '5' > 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] "TotalCharacters" > 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]) 0 855 1168 1644 3926 5950 6023 6179 8773 14116 15986 8 1 1 1 1 1 1 1 1 1 1 22618 22807 25162 31081 31701 32551 33032 37110 37238 38692 43750 1 1 1 1 1 1 1 1 1 1 1 43929 45724 48029 52789 55918 56622 56750 57224 59900 59938 64520 1 1 1 1 1 1 1 1 1 1 1 64593 65594 66089 66485 67150 68788 68946 69446 69652 69867 70168 1 1 1 1 1 1 1 1 1 1 1 71154 71571 72128 76173 79011 79089 79756 81351 81625 81897 82317 1 1 1 1 1 1 1 1 1 1 1 83243 83248 83515 84601 86652 88977 89256 89506 89626 92059 92280 1 1 1 1 1 1 1 1 1 1 1 92622 93473 93487 93879 95676 95893 96125 100046 100087 100350 101047 1 1 1 1 1 1 1 1 1 1 1 101382 101629 102070 102153 102812 103037 103129 103297 103925 104128 104581 1 1 1 1 1 1 1 1 1 1 1 104767 104978 105079 108146 108535 109432 110459 110529 112098 112302 112431 1 1 1 1 1 1 1 1 1 1 1 113344 114360 114799 114948 116066 117440 118906 119442 120192 123534 124089 1 1 1 1 1 1 1 1 1 1 1 125081 125386 125818 126372 126817 127654 128692 131072 134047 134238 135356 1 1 1 1 1 1 1 1 1 1 1 136588 139165 140015 140358 140824 143592 144244 144408 144551 146760 146975 1 1 1 1 1 1 1 1 1 1 1 147172 149695 149959 150047 150491 151715 151911 154451 154771 156349 160141 1 1 1 1 1 1 1 1 1 1 1 160902 165904 165933 165986 167949 169265 169707 176225 183500 184923 187326 1 1 1 1 1 1 1 1 1 1 1 197426 249771 279488 1 1 1 > colnames(x) [1] "TotalTime" "Logins" "NumberOfComputations" [4] "LongFeedback" "TotalCharacters" > colnames(x)[par1] [1] "TotalCharacters" > 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 == '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/1yk8t1324649634.tab") + } + } > m Conditional inference tree with 6 terminal nodes Response: TotalCharacters Inputs: TotalTime, Logins, NumberOfComputations, LongFeedback Number of observations: 164 1) LongFeedback <= 67; criterion = 1, statistic = 84.466 2) TotalTime <= 78800; criterion = 1, statistic = 21.222 3) LongFeedback <= 13; criterion = 1, statistic = 18.839 4)* weights = 16 3) LongFeedback > 13 5)* weights = 7 2) TotalTime > 78800 6)* weights = 7 1) LongFeedback > 67 7) TotalTime <= 309810; criterion = 1, statistic = 19.952 8) LongFeedback <= 124; criterion = 0.991, statistic = 9.229 9)* weights = 36 8) LongFeedback > 124 10)* weights = 49 7) TotalTime > 309810 11)* weights = 49 > postscript(file="/var/wessaorg/rcomp/tmp/2dz491324649634.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/31eb51324649634.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 140824 112702.837 28121.1633 2 110459 112702.837 -2243.8367 3 105079 80265.500 24813.5000 4 112098 112702.837 -604.8367 5 43929 80265.500 -36336.5000 6 76173 80265.500 -4092.5000 7 187326 132242.224 55083.7755 8 22807 26956.143 -4149.1429 9 144408 112702.837 31705.1633 10 66485 80265.500 -13780.5000 11 79089 132242.224 -53153.2245 12 81625 112702.837 -31077.8367 13 68788 80265.500 -11477.5000 14 103297 132242.224 -28945.2245 15 69446 80265.500 -10819.5000 16 114948 132242.224 -17294.2245 17 167949 132242.224 35706.7755 18 125081 132242.224 -7161.2245 19 125818 80265.500 45552.5000 20 136588 112702.837 23885.1633 21 112431 112702.837 -271.8367 22 103037 132242.224 -29205.2245 23 82317 80265.500 2051.5000 24 118906 112702.837 6203.1633 25 83515 112702.837 -29187.8367 26 104581 112702.837 -8121.8367 27 103129 132242.224 -29113.2245 28 83243 132242.224 -48999.2245 29 37110 80265.500 -43155.5000 30 113344 132242.224 -18898.2245 31 139165 132242.224 6922.7755 32 86652 112702.837 -26050.8367 33 112302 132242.224 -19940.2245 34 69652 112702.837 -43050.8367 35 119442 132242.224 -12800.2245 36 69867 112702.837 -42835.8367 37 101629 132242.224 -30613.2245 38 70168 80265.500 -10097.5000 39 31081 63831.714 -32750.7143 40 103925 132242.224 -28317.2245 41 92622 132242.224 -39620.2245 42 79011 80265.500 -1254.5000 43 93487 80265.500 13221.5000 44 64520 112702.837 -48182.8367 45 93473 63831.714 29641.2857 46 114360 132242.224 -17882.2245 47 33032 26956.143 6075.8571 48 96125 112702.837 -16577.8367 49 151911 132242.224 19668.7755 50 89256 112702.837 -23446.8367 51 95676 112702.837 -17026.8367 52 5950 2491.312 3458.6875 53 149695 132242.224 17452.7755 54 32551 26956.143 5594.8571 55 31701 63831.714 -32130.7143 56 100087 112702.837 -12615.8367 57 169707 132242.224 37464.7755 58 150491 132242.224 18248.7755 59 120192 132242.224 -12050.2245 60 95893 112702.837 -16809.8367 61 151715 132242.224 19472.7755 62 176225 132242.224 43982.7755 63 59900 80265.500 -20365.5000 64 104767 112702.837 -7935.8367 65 114799 112702.837 2096.1633 66 72128 80265.500 -8137.5000 67 143592 112702.837 30889.1633 68 89626 112702.837 -23076.8367 69 131072 112702.837 18369.1633 70 126817 80265.500 46551.5000 71 81351 112702.837 -31351.8367 72 22618 26956.143 -4338.1429 73 88977 112702.837 -23725.8367 74 92059 80265.500 11793.5000 75 81897 112702.837 -30805.8367 76 108146 132242.224 -24096.2245 77 126372 132242.224 -5870.2245 78 249771 112702.837 137068.1633 79 71154 112702.837 -41548.8367 80 71571 80265.500 -8694.5000 81 55918 80265.500 -24347.5000 82 160141 132242.224 27898.7755 83 38692 80265.500 -41573.5000 84 102812 80265.500 22546.5000 85 56622 63831.714 -7209.7143 86 15986 80265.500 -64279.5000 87 123534 112702.837 10831.1633 88 108535 132242.224 -23707.2245 89 93879 132242.224 -38363.2245 90 144551 112702.837 31848.1633 91 56750 80265.500 -23515.5000 92 127654 112702.837 14951.1633 93 65594 80265.500 -14671.5000 94 59938 112702.837 -52764.8367 95 146975 132242.224 14732.7755 96 165904 112702.837 53201.1633 97 169265 112702.837 56562.1633 98 183500 132242.224 51257.7755 99 165986 132242.224 33743.7755 100 184923 132242.224 52680.7755 101 140358 112702.837 27655.1633 102 149959 132242.224 17716.7755 103 57224 63831.714 -6607.7143 104 43750 26956.143 16793.8571 105 48029 63831.714 -15802.7143 106 104978 80265.500 24712.5000 107 100046 112702.837 -12656.8367 108 101047 132242.224 -31195.2245 109 197426 80265.500 117160.5000 110 160902 112702.837 48199.1633 111 147172 132242.224 14929.7755 112 109432 80265.500 29166.5000 113 1168 2491.312 -1323.3125 114 83248 80265.500 2982.5000 115 25162 26956.143 -1794.1429 116 45724 112702.837 -66978.8367 117 110529 132242.224 -21713.2245 118 855 2491.312 -1636.3125 119 101382 80265.500 21116.5000 120 14116 2491.312 11624.6875 121 89506 132242.224 -42736.2245 122 135356 112702.837 22653.1633 123 116066 112702.837 3363.1633 124 144244 80265.500 63978.5000 125 8773 26956.143 -18183.1429 126 102153 112702.837 -10549.8367 127 117440 132242.224 -14802.2245 128 104128 112702.837 -8574.8367 129 134238 132242.224 1995.7755 130 134047 132242.224 1804.7755 131 279488 132242.224 147245.7755 132 79756 112702.837 -32946.8367 133 66089 80265.500 -14176.5000 134 102070 132242.224 -30172.2245 135 146760 132242.224 14517.7755 136 154771 112702.837 42068.1633 137 165933 132242.224 33690.7755 138 64593 80265.500 -15672.5000 139 92280 112702.837 -20422.8367 140 67150 80265.500 -13115.5000 141 128692 63831.714 64860.2857 142 124089 132242.224 -8153.2245 143 125386 112702.837 12683.1633 144 37238 80265.500 -43027.5000 145 140015 132242.224 7772.7755 146 150047 112702.837 37344.1633 147 154451 112702.837 41748.1633 148 156349 132242.224 24106.7755 149 0 2491.312 -2491.3125 150 6023 2491.312 3531.6875 151 0 2491.312 -2491.3125 152 0 2491.312 -2491.3125 153 0 2491.312 -2491.3125 154 0 2491.312 -2491.3125 155 84601 80265.500 4335.5000 156 68946 132242.224 -63296.2245 157 0 2491.312 -2491.3125 158 0 2491.312 -2491.3125 159 1644 2491.312 -847.3125 160 6179 2491.312 3687.6875 161 3926 2491.312 1434.6875 162 52789 80265.500 -27476.5000 163 0 2491.312 -2491.3125 164 100350 80265.500 20084.5000 > 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/4kc011324649634.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/5cdjf1324649634.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/6o0bp1324649634.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/7midq1324649634.tab") + } > > try(system("convert tmp/2dz491324649634.ps tmp/2dz491324649634.png",intern=TRUE)) character(0) > try(system("convert tmp/31eb51324649634.ps tmp/31eb51324649634.png",intern=TRUE)) character(0) > try(system("convert tmp/4kc011324649634.ps tmp/4kc011324649634.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.318 0.230 3.549