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 + ,186099 + ,38 + ,165 + ,110459 + ,113854 + ,34 + ,135 + ,105079 + ,99776 + ,42 + ,121 + ,112098 + ,106194 + ,38 + ,148 + ,43929 + ,100792 + ,27 + ,73 + ,76173 + ,47552 + ,35 + ,49 + ,187326 + ,250931 + ,33 + ,185 + ,22807 + ,6853 + ,18 + ,5 + ,144408 + ,115466 + ,34 + ,125 + ,66485 + ,110896 + ,33 + ,93 + ,79089 + ,169351 + ,46 + ,154 + ,81625 + ,94853 + ,55 + ,98 + ,68788 + ,72591 + ,37 + ,70 + ,103297 + ,101345 + ,55 + ,148 + ,69446 + ,113713 + ,44 + ,100 + ,114948 + ,165354 + ,59 + ,150 + ,167949 + ,164263 + ,36 + ,197 + ,125081 + ,135213 + ,39 + ,114 + ,125818 + ,111669 + ,29 + ,169 + ,136588 + ,134163 + ,51 + ,200 + ,112431 + ,140303 + ,49 + ,148 + ,103037 + ,150773 + ,39 + ,140 + ,82317 + ,111848 + ,25 + ,74 + ,118906 + ,102509 + ,52 + ,128 + ,83515 + ,96785 + ,45 + ,140 + ,104581 + ,116136 + ,38 + ,116 + ,103129 + ,158376 + ,41 + ,147 + ,83243 + ,153990 + ,43 + ,132 + ,37110 + ,64057 + ,32 + ,70 + ,113344 + ,230054 + ,41 + ,144 + ,139165 + ,184531 + ,47 + ,155 + ,86652 + ,114198 + ,50 + ,165 + ,112302 + ,198299 + ,48 + ,161 + ,69652 + ,33750 + ,37 + ,31 + ,119442 + ,189723 + ,43 + ,199 + ,69867 + ,100826 + ,42 + ,78 + ,101629 + ,188355 + ,44 + ,121 + ,70168 + ,104470 + ,36 + ,112 + ,31081 + ,58391 + ,17 + ,41 + ,103925 + ,164808 + ,42 + ,158 + ,92622 + ,134097 + ,39 + ,123 + ,79011 + ,80238 + ,41 + ,104 + ,93487 + ,133252 + ,36 + ,94 + ,64520 + ,54518 + ,47 + ,73 + ,93473 + ,121850 + ,45 + ,52 + ,114360 + ,79367 + ,41 + ,71 + ,33032 + ,56968 + ,26 + ,21 + ,96125 + ,106314 + ,52 + ,155 + ,151911 + ,191889 + ,47 + ,174 + ,89256 + ,104864 + ,45 + ,136 + ,95671 + ,160791 + ,40 + ,128 + ,5950 + ,15049 + ,4 + ,7 + ,149695 + ,191179 + ,44 + ,165 + ,32551 + ,25109 + ,18 + ,21 + ,31701 + ,45824 + ,14 + ,35 + ,100087 + ,129711 + ,37 + ,137 + ,169707 + ,210012 + ,61 + ,174 + ,150491 + ,194679 + ,39 + ,257 + ,120192 + ,197680 + ,42 + ,207 + ,95893 + ,81180 + ,36 + ,103 + ,151715 + ,197765 + ,49 + ,171 + ,176225 + ,214738 + ,28 + ,279 + ,59900 + ,96252 + ,43 + ,83 + ,104767 + ,124527 + ,42 + ,130 + ,114799 + ,153242 + ,37 + ,131 + ,72128 + ,145707 + ,30 + ,126 + ,143592 + ,113963 + ,35 + ,158 + ,89626 + ,134904 + ,44 + ,138 + ,131072 + ,114268 + ,36 + ,200 + ,126817 + ,94333 + ,28 + ,104 + ,81351 + ,102204 + ,45 + ,111 + ,22618 + ,23824 + ,23 + ,26 + ,88977 + ,111563 + ,45 + ,115 + ,92059 + ,91313 + ,38 + ,127 + ,81897 + ,89770 + ,38 + ,140 + ,108146 + ,100125 + ,46 + ,121 + ,126372 + ,165278 + ,36 + ,183 + ,249771 + ,181712 + ,41 + ,68 + ,71154 + ,80906 + ,38 + ,112 + ,71571 + ,75881 + ,37 + ,103 + ,55918 + ,83963 + ,28 + ,63 + ,160141 + ,175721 + ,45 + ,166 + ,38692 + ,68580 + ,26 + ,38 + ,102812 + ,136323 + ,44 + ,163 + ,56622 + ,55792 + ,8 + ,59 + ,15986 + ,25157 + ,27 + ,27 + ,123534 + ,100922 + ,38 + ,108 + ,108535 + ,118845 + ,37 + ,88 + ,93879 + ,170492 + ,57 + ,92 + ,144551 + ,81716 + ,45 + ,170 + ,56750 + ,115750 + ,37 + ,98 + ,127654 + ,105590 + ,40 + ,205 + ,65594 + ,92795 + ,31 + ,96 + ,59938 + ,82390 + ,36 + ,107 + ,146975 + ,135599 + ,40 + ,150 + ,143372 + ,111542 + ,36 + ,123 + ,168553 + ,162519 + ,35 + ,176 + ,183500 + ,211381 + ,39 + ,213 + ,165986 + ,189944 + ,65 + ,208 + ,184923 + ,226168 + ,30 + ,307 + ,140358 + ,117495 + ,51 + ,125 + ,149959 + ,195894 + ,41 + ,208 + ,57224 + ,80684 + ,36 + ,73 + ,43750 + ,19630 + ,19 + ,49 + ,48029 + ,88634 + ,23 + ,82 + ,104978 + ,139292 + ,44 + ,206 + ,100046 + ,128602 + ,40 + ,112 + ,101047 + ,135848 + ,40 + ,139 + ,197426 + ,178377 + ,30 + ,60 + ,160902 + ,106330 + ,41 + ,70 + ,147172 + ,178303 + ,40 + ,112 + ,109432 + ,116938 + ,45 + ,142 + ,1168 + ,5841 + ,1 + ,11 + ,83248 + ,106020 + ,40 + ,130 + ,25162 + ,24610 + ,11 + ,31 + ,45724 + ,74151 + ,45 + ,132 + ,110529 + ,232241 + ,38 + ,219 + ,855 + ,6622 + ,0 + ,4 + ,101382 + ,127097 + ,30 + ,102 + ,14116 + ,13155 + ,8 + ,39 + ,89506 + ,160501 + ,39 + ,125 + ,135356 + ,91502 + ,48 + ,121 + ,116066 + ,24469 + ,48 + ,42 + ,144244 + ,88229 + ,29 + ,111 + ,8773 + ,13983 + ,8 + ,16 + ,102153 + ,80716 + ,43 + ,70 + ,117440 + ,157384 + ,52 + ,162 + ,104128 + ,122975 + ,53 + ,173 + ,134238 + ,191469 + ,48 + ,171 + ,134047 + ,231257 + ,48 + ,172 + ,279488 + ,258287 + ,50 + ,254 + ,79756 + ,122531 + ,40 + ,90 + ,66089 + ,61394 + ,36 + ,50 + ,102070 + ,86480 + ,40 + ,113 + ,146760 + ,195791 + ,46 + ,187 + ,154771 + ,18284 + ,42 + ,16 + ,165933 + ,147581 + ,46 + ,175 + ,64593 + ,72558 + ,39 + ,90 + ,92280 + ,147341 + ,41 + ,140 + ,67150 + ,114651 + ,46 + ,145 + ,128692 + ,100187 + ,32 + ,141 + ,124089 + ,130332 + ,39 + ,125 + ,125386 + ,134218 + ,39 + ,241 + ,37238 + ,10901 + ,21 + ,16 + ,140015 + ,145758 + ,45 + ,175 + ,150047 + ,75767 + ,50 + ,132 + ,154451 + ,134969 + ,36 + ,154 + ,156349 + ,169216 + ,44 + ,198 + ,0 + ,0 + ,0 + ,0 + ,6023 + ,7953 + ,0 + ,5 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,84601 + ,105406 + ,37 + ,125 + ,68946 + ,174586 + ,52 + ,174 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1644 + ,4245 + ,0 + ,6 + ,6179 + ,21509 + ,5 + ,13 + ,3926 + ,7670 + ,1 + ,3 + ,52789 + ,15673 + ,43 + ,35 + ,0 + ,0 + ,0 + ,0 + ,100350 + ,75882 + ,34 + ,80) + ,dim=c(4 + ,164) + ,dimnames=list(c('Aantal_Tekens' + ,'Tijd' + ,'Reviews' + ,'Hyperlinks') + ,1:164)) > y <- array(NA,dim=c(4,164),dimnames=list(c('Aantal_Tekens','Tijd','Reviews','Hyperlinks'),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 = '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] "Aantal_Tekens" > 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] 95671 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 143372 168553 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 95671 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 143372 143592 144244 144408 144551 146760 1 1 1 1 1 1 1 1 1 1 1 146975 147172 149695 149959 150047 150491 151715 151911 154451 154771 156349 1 1 1 1 1 1 1 1 1 1 1 160141 160902 165933 165986 167949 168553 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] "Aantal_Tekens" "Tijd" "Reviews" "Hyperlinks" > colnames(x)[par1] [1] "Aantal_Tekens" > 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] 95671 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 143372 168553 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/1bng11324660069.tab") + } + } > m Conditional inference tree with 7 terminal nodes Response: Aantal_Tekens Inputs: Tijd, Reviews, Hyperlinks Number of observations: 164 1) Tijd <= 74151; criterion = 1, statistic = 102.666 2) Reviews <= 32; criterion = 1, statistic = 27.484 3) Hyperlinks <= 13; criterion = 1, statistic = 20.76 4)* weights = 16 3) Hyperlinks > 13 5)* weights = 14 2) Reviews > 32 6)* weights = 10 1) Tijd > 74151 7) Tijd <= 174586; criterion = 1, statistic = 41.371 8) Hyperlinks <= 174; criterion = 1, statistic = 24.251 9) Hyperlinks <= 107; criterion = 0.996, statistic = 10.311 10)* weights = 27 9) Hyperlinks > 107 11)* weights = 59 8) Hyperlinks > 174 12)* weights = 11 7) Tijd > 174586 13)* weights = 27 > postscript(file="/var/wessaorg/rcomp/tmp/2htc01324660069.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/3fs9y1324660069.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 156589.19 -15765.1852 2 110459 106279.59 4179.4068 3 105079 106279.59 -1200.5932 4 112098 106279.59 5818.4068 5 43929 82910.78 -38981.7778 6 76173 77916.50 -1743.5000 7 187326 156589.19 30736.8148 8 22807 3034.50 19772.5000 9 144408 106279.59 38128.4068 10 66485 82910.78 -16425.7778 11 79089 106279.59 -27190.5932 12 81625 82910.78 -1285.7778 13 68788 77916.50 -9128.5000 14 103297 106279.59 -2982.5932 15 69446 82910.78 -13464.7778 16 114948 106279.59 8668.4068 17 167949 140986.27 26962.7273 18 125081 106279.59 18801.4068 19 125818 106279.59 19538.4068 20 136588 140986.27 -4398.2727 21 112431 106279.59 6151.4068 22 103037 106279.59 -3242.5932 23 82317 82910.78 -593.7778 24 118906 106279.59 12626.4068 25 83515 106279.59 -22764.5932 26 104581 106279.59 -1698.5932 27 103129 106279.59 -3150.5932 28 83243 106279.59 -23036.5932 29 37110 30602.29 6507.7143 30 113344 156589.19 -43245.1852 31 139165 156589.19 -17424.1852 32 86652 106279.59 -19627.5932 33 112302 156589.19 -44287.1852 34 69652 77916.50 -8264.5000 35 119442 156589.19 -37147.1852 36 69867 82910.78 -13043.7778 37 101629 156589.19 -54960.1852 38 70168 106279.59 -36111.5932 39 31081 30602.29 478.7143 40 103925 106279.59 -2354.5932 41 92622 106279.59 -13657.5932 42 79011 82910.78 -3899.7778 43 93487 82910.78 10576.2222 44 64520 77916.50 -13396.5000 45 93473 82910.78 10562.2222 46 114360 82910.78 31449.2222 47 33032 30602.29 2429.7143 48 96125 106279.59 -10154.5932 49 151911 156589.19 -4678.1852 50 89256 106279.59 -17023.5932 51 95671 106279.59 -10608.5932 52 5950 3034.50 2915.5000 53 149695 156589.19 -6894.1852 54 32551 30602.29 1948.7143 55 31701 30602.29 1098.7143 56 100087 106279.59 -6192.5932 57 169707 156589.19 13117.8148 58 150491 156589.19 -6098.1852 59 120192 156589.19 -36397.1852 60 95893 82910.78 12982.2222 61 151715 156589.19 -4874.1852 62 176225 156589.19 19635.8148 63 59900 82910.78 -23010.7778 64 104767 106279.59 -1512.5932 65 114799 106279.59 8519.4068 66 72128 106279.59 -34151.5932 67 143592 106279.59 37312.4068 68 89626 106279.59 -16653.5932 69 131072 140986.27 -9914.2727 70 126817 82910.78 43906.2222 71 81351 106279.59 -24928.5932 72 22618 30602.29 -7984.2857 73 88977 106279.59 -17302.5932 74 92059 106279.59 -14220.5932 75 81897 106279.59 -24382.5932 76 108146 106279.59 1866.4068 77 126372 140986.27 -14614.2727 78 249771 156589.19 93181.8148 79 71154 106279.59 -35125.5932 80 71571 82910.78 -11339.7778 81 55918 82910.78 -26992.7778 82 160141 156589.19 3551.8148 83 38692 30602.29 8089.7143 84 102812 106279.59 -3467.5932 85 56622 30602.29 26019.7143 86 15986 30602.29 -14616.2857 87 123534 106279.59 17254.4068 88 108535 82910.78 25624.2222 89 93879 82910.78 10968.2222 90 144551 106279.59 38271.4068 91 56750 82910.78 -26160.7778 92 127654 140986.27 -13332.2727 93 65594 82910.78 -17316.7778 94 59938 82910.78 -22972.7778 95 146975 106279.59 40695.4068 96 143372 106279.59 37092.4068 97 168553 140986.27 27566.7273 98 183500 156589.19 26910.8148 99 165986 156589.19 9396.8148 100 184923 156589.19 28333.8148 101 140358 106279.59 34078.4068 102 149959 156589.19 -6630.1852 103 57224 82910.78 -25686.7778 104 43750 30602.29 13147.7143 105 48029 82910.78 -34881.7778 106 104978 140986.27 -36008.2727 107 100046 106279.59 -6233.5932 108 101047 106279.59 -5232.5932 109 197426 156589.19 40836.8148 110 160902 82910.78 77991.2222 111 147172 156589.19 -9417.1852 112 109432 106279.59 3152.4068 113 1168 3034.50 -1866.5000 114 83248 106279.59 -23031.5932 115 25162 30602.29 -5440.2857 116 45724 77916.50 -32192.5000 117 110529 156589.19 -46060.1852 118 855 3034.50 -2179.5000 119 101382 82910.78 18471.2222 120 14116 30602.29 -16486.2857 121 89506 106279.59 -16773.5932 122 135356 106279.59 29076.4068 123 116066 77916.50 38149.5000 124 144244 106279.59 37964.4068 125 8773 30602.29 -21829.2857 126 102153 82910.78 19242.2222 127 117440 106279.59 11160.4068 128 104128 106279.59 -2151.5932 129 134238 156589.19 -22351.1852 130 134047 156589.19 -22542.1852 131 279488 156589.19 122898.8148 132 79756 82910.78 -3154.7778 133 66089 77916.50 -11827.5000 134 102070 106279.59 -4209.5932 135 146760 156589.19 -9829.1852 136 154771 77916.50 76854.5000 137 165933 140986.27 24946.7273 138 64593 77916.50 -13323.5000 139 92280 106279.59 -13999.5932 140 67150 106279.59 -39129.5932 141 128692 106279.59 22412.4068 142 124089 106279.59 17809.4068 143 125386 140986.27 -15600.2727 144 37238 30602.29 6635.7143 145 140015 140986.27 -971.2727 146 150047 106279.59 43767.4068 147 154451 106279.59 48171.4068 148 156349 140986.27 15362.7273 149 0 3034.50 -3034.5000 150 6023 3034.50 2988.5000 151 0 3034.50 -3034.5000 152 0 3034.50 -3034.5000 153 0 3034.50 -3034.5000 154 0 3034.50 -3034.5000 155 84601 106279.59 -21678.5932 156 68946 106279.59 -37333.5932 157 0 3034.50 -3034.5000 158 0 3034.50 -3034.5000 159 1644 3034.50 -1390.5000 160 6179 3034.50 3144.5000 161 3926 3034.50 891.5000 162 52789 77916.50 -25127.5000 163 0 3034.50 -3034.5000 164 100350 82910.78 17439.2222 > 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/4q2kv1324660069.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/5029z1324660069.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/68vq81324660069.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/7asw51324660069.tab") + } > > try(system("convert tmp/2htc01324660069.ps tmp/2htc01324660069.png",intern=TRUE)) character(0) > try(system("convert tmp/3fs9y1324660069.ps tmp/3fs9y1324660069.png",intern=TRUE)) character(0) > try(system("convert tmp/4q2kv1324660069.ps tmp/4q2kv1324660069.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.208 0.270 3.483