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 + ,272545 + ,96 + ,32033 + ,110459 + ,179444 + ,71 + ,20654 + ,105079 + ,222373 + ,70 + ,16346 + ,112098 + ,218443 + ,134 + ,35926 + ,43929 + ,171533 + ,67 + ,10621 + ,76173 + ,70849 + ,8 + ,10024 + ,187326 + ,517243 + ,149 + ,43068 + ,22807 + ,33186 + ,1 + ,1271 + ,144408 + ,217320 + ,83 + ,34416 + ,66485 + ,213274 + ,82 + ,20318 + ,79089 + ,307153 + ,92 + ,24409 + ,81625 + ,239766 + ,117 + ,20648 + ,68788 + ,185384 + ,53 + ,12347 + ,103297 + ,364569 + ,139 + ,21857 + ,69446 + ,251622 + ,80 + ,11034 + ,114948 + ,384524 + ,175 + ,33433 + ,167949 + ,325587 + ,114 + ,35902 + ,125081 + ,343085 + ,100 + ,22355 + ,125818 + ,176082 + ,103 + ,31219 + ,136588 + ,266736 + ,135 + ,21983 + ,112431 + ,278265 + ,123 + ,40085 + ,103037 + ,442703 + ,87 + ,18507 + ,82317 + ,180393 + ,66 + ,16278 + ,118906 + ,189897 + ,103 + ,24662 + ,83515 + ,238434 + ,144 + ,31452 + ,104581 + ,238006 + ,113 + ,32580 + ,103129 + ,267268 + ,99 + ,22883 + ,83243 + ,270787 + ,117 + ,27652 + ,37110 + ,155915 + ,57 + ,9845 + ,113344 + ,359764 + ,138 + ,20190 + ,139165 + ,283441 + ,123 + ,46201 + ,86652 + ,216853 + ,44 + ,10971 + ,112302 + ,336277 + ,140 + ,34811 + ,69652 + ,101014 + ,43 + ,3029 + ,119442 + ,396684 + ,138 + ,38941 + ,69867 + ,273950 + ,83 + ,4958 + ,101629 + ,425253 + ,112 + ,32344 + ,70168 + ,227636 + ,79 + ,19433 + ,31081 + ,115658 + ,33 + ,12558 + ,103925 + ,369702 + ,135 + ,36524 + ,92622 + ,329639 + ,123 + ,26041 + ,79011 + ,186409 + ,76 + ,16637 + ,93487 + ,206196 + ,78 + ,28395 + ,64520 + ,182286 + ,68 + ,16747 + ,93473 + ,153778 + ,50 + ,9105 + ,114360 + ,455401 + ,101 + ,11941 + ,33032 + ,78800 + ,20 + ,7935 + ,96125 + ,208277 + ,101 + ,19499 + ,151911 + ,358127 + ,149 + ,22938 + ,89256 + ,176357 + ,99 + ,25314 + ,95676 + ,224649 + ,95 + ,28527 + ,5950 + ,24188 + ,8 + ,2694 + ,149695 + ,380576 + ,88 + ,20867 + ,32551 + ,65029 + ,21 + ,3597 + ,31701 + ,101097 + ,30 + ,5296 + ,100087 + ,279128 + ,97 + ,32982 + ,169707 + ,328024 + ,130 + ,38975 + ,150491 + ,345663 + ,132 + ,42721 + ,120192 + ,367112 + ,161 + ,41455 + ,95893 + ,261528 + ,89 + ,23923 + ,151715 + ,385286 + ,159 + ,26719 + ,176225 + ,304468 + ,139 + ,53405 + ,59900 + ,272297 + ,102 + ,12526 + ,104767 + ,264889 + ,92 + ,26584 + ,114799 + ,229585 + ,52 + ,37062 + ,72128 + ,225460 + ,107 + ,25696 + ,143592 + ,203663 + ,93 + ,24634 + ,89626 + ,239986 + ,85 + ,27269 + ,131072 + ,238482 + ,137 + ,25270 + ,126817 + ,175816 + ,143 + ,24634 + ,81351 + ,239337 + ,99 + ,17828 + ,22618 + ,73566 + ,22 + ,3007 + ,88977 + ,242622 + ,78 + ,20065 + ,92059 + ,194855 + ,83 + ,24648 + ,81897 + ,209049 + ,131 + ,21588 + ,108146 + ,363250 + ,140 + ,25217 + ,126372 + ,350641 + ,142 + ,30927 + ,249771 + ,217036 + ,80 + ,18487 + ,71154 + ,208804 + ,133 + ,18050 + ,71571 + ,195793 + ,95 + ,17696 + ,55918 + ,153613 + ,62 + ,17326 + ,160141 + ,475859 + ,161 + ,39361 + ,38692 + ,145943 + ,30 + ,9648 + ,102812 + ,287359 + ,118 + ,26759 + ,56622 + ,80953 + ,49 + ,7905 + ,15986 + ,150216 + ,52 + ,4527 + ,123534 + ,179317 + ,76 + ,41517 + ,108535 + ,384720 + ,81 + ,21261 + ,93879 + ,342522 + ,146 + ,36099 + ,144551 + ,179811 + ,165 + ,39039 + ,56750 + ,273486 + ,83 + ,13841 + ,127654 + ,262811 + ,161 + ,23841 + ,65594 + ,190312 + ,48 + ,8589 + ,59938 + ,276134 + ,149 + ,15049 + ,146975 + ,328875 + ,75 + ,39038 + ,161100 + ,189654 + ,83 + ,34974 + ,168553 + ,259191 + ,110 + ,39932 + ,183500 + ,297464 + ,164 + ,43840 + ,165986 + ,393266 + ,152 + ,43146 + ,184923 + ,399801 + ,165 + ,50099 + ,140358 + ,291970 + ,121 + ,40312 + ,149959 + ,296670 + ,150 + ,32616 + ,57224 + ,186856 + ,73 + ,11338 + ,43750 + ,43287 + ,13 + ,7409 + ,48029 + ,185468 + ,89 + ,18213 + ,104978 + ,250254 + ,105 + ,45873 + ,100046 + ,268391 + ,129 + ,39844 + ,101047 + ,314131 + ,169 + ,28317 + ,197426 + ,153059 + ,28 + ,24797 + ,160902 + ,158511 + ,118 + ,7471 + ,147172 + ,316505 + ,76 + ,27259 + ,109432 + ,300526 + ,147 + ,23201 + ,1168 + ,23623 + ,12 + ,238 + ,83248 + ,195817 + ,146 + ,28830 + ,25162 + ,61857 + ,23 + ,3913 + ,45724 + ,163871 + ,83 + ,9935 + ,110529 + ,428191 + ,163 + ,27738 + ,855 + ,21054 + ,4 + ,338 + ,101382 + ,252805 + ,81 + ,13326 + ,14116 + ,31961 + ,18 + ,3988 + ,89506 + ,329583 + ,114 + ,24347 + ,135356 + ,243164 + ,76 + ,27111 + ,116066 + ,175582 + ,55 + ,3938 + ,144244 + ,152043 + ,44 + ,17416 + ,8773 + ,38214 + ,16 + ,1888 + ,102153 + ,224597 + ,81 + ,18700 + ,117440 + ,357602 + ,137 + ,36809 + ,104128 + ,198104 + ,50 + ,24959 + ,134238 + ,417399 + ,142 + ,37343 + ,134047 + ,338606 + ,157 + ,21849 + ,279488 + ,410575 + ,141 + ,49809 + ,79756 + ,187992 + ,71 + ,21654 + ,66089 + ,102424 + ,42 + ,8728 + ,102070 + ,301282 + ,94 + ,20920 + ,146760 + ,425430 + ,115 + ,27195 + ,154771 + ,143860 + ,63 + ,1037 + ,165933 + ,395382 + ,127 + ,42570 + ,64593 + ,162422 + ,55 + ,17672 + ,92280 + ,278077 + ,117 + ,34245 + ,67150 + ,282410 + ,110 + ,16786 + ,128692 + ,217665 + ,38 + ,20954 + ,124089 + ,384177 + ,95 + ,16378 + ,125386 + ,246963 + ,128 + ,31852 + ,37238 + ,173260 + ,41 + ,2805 + ,140015 + ,325961 + ,145 + ,38086 + ,150047 + ,168994 + ,147 + ,21166 + ,154451 + ,253330 + ,119 + ,34672 + ,156349 + ,305217 + ,185 + ,36171 + ,6023 + ,14688 + ,4 + ,2065 + ,84601 + ,251752 + ,72 + ,19354 + ,68946 + ,409163 + ,157 + ,22124 + ,1644 + ,7199 + ,7 + ,556 + ,6179 + ,46660 + ,12 + ,2089 + ,3926 + ,17547 + ,0 + ,2658 + ,52789 + ,116969 + ,37 + ,1813 + ,100350 + ,206501 + ,52 + ,17372) + ,dim=c(4 + ,156) + ,dimnames=list(c('characters' + ,'TijdInRFC' + ,'Blogs' + ,'Revisions') + ,1:156)) > y <- array(NA,dim=c(4,156),dimnames=list(c('characters','TijdInRFC','Blogs','Revisions'),1:156)) > 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 = '' > 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] "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 161100 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 6023 84601 [151] 68946 1644 6179 3926 52789 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]) 855 1168 1644 3926 5950 6023 6179 8773 14116 15986 22618 1 1 1 1 1 1 1 1 1 1 1 22807 25162 31081 31701 32551 33032 37110 37238 38692 43750 43929 1 1 1 1 1 1 1 1 1 1 1 45724 48029 52789 55918 56622 56750 57224 59900 59938 64520 64593 1 1 1 1 1 1 1 1 1 1 1 65594 66089 66485 67150 68788 68946 69446 69652 69867 70168 71154 1 1 1 1 1 1 1 1 1 1 1 71571 72128 76173 79011 79089 79756 81351 81625 81897 82317 83243 1 1 1 1 1 1 1 1 1 1 1 83248 83515 84601 86652 88977 89256 89506 89626 92059 92280 92622 1 1 1 1 1 1 1 1 1 1 1 93473 93487 93879 95676 95893 96125 100046 100087 100350 101047 101382 1 1 1 1 1 1 1 1 1 1 1 101629 102070 102153 102812 103037 103129 103297 103925 104128 104581 104767 1 1 1 1 1 1 1 1 1 1 1 104978 105079 108146 108535 109432 110459 110529 112098 112302 112431 113344 1 1 1 1 1 1 1 1 1 1 1 114360 114799 114948 116066 117440 118906 119442 120192 123534 124089 125081 1 1 1 1 1 1 1 1 1 1 1 125386 125818 126372 126817 127654 128692 131072 134047 134238 135356 136588 1 1 1 1 1 1 1 1 1 1 1 139165 140015 140358 140824 143592 144244 144408 144551 146760 146975 147172 1 1 1 1 1 1 1 1 1 1 1 149695 149959 150047 150491 151715 151911 154451 154771 156349 160141 160902 1 1 1 1 1 1 1 1 1 1 1 161100 165933 165986 167949 168553 169707 176225 183500 184923 187326 197426 1 1 1 1 1 1 1 1 1 1 1 249771 279488 1 1 > colnames(x) [1] "characters" "TijdInRFC" "Blogs" "Revisions" > 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 161100 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 6023 84601 [151] 68946 1644 6179 3926 52789 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/1ksyt1324373990.tab") + } + } > m Conditional inference tree with 5 terminal nodes Response: characters Inputs: TijdInRFC, Blogs, Revisions Number of observations: 156 1) Revisions <= 18213; criterion = 1, statistic = 83.367 2) TijdInRFC <= 78800; criterion = 1, statistic = 22.61 3)* weights = 16 2) TijdInRFC > 78800 4)* weights = 41 1) Revisions > 18213 5) Revisions <= 41517; criterion = 1, statistic = 21.755 6) Revisions <= 34245; criterion = 0.958, statistic = 6.026 7)* weights = 65 6) Revisions > 34245 8)* weights = 24 5) Revisions > 41517 9)* weights = 10 > postscript(file="/var/wessaorg/rcomp/tmp/2my031324373990.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/3nbs21324373990.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 111984.60 28839.400 2 110459 111984.60 -1525.600 3 105079 73685.41 31393.585 4 112098 134120.12 -22022.125 5 43929 73685.41 -29756.415 6 76173 19045.44 57127.562 7 187326 173801.50 13524.500 8 22807 19045.44 3761.562 9 144408 134120.12 10287.875 10 66485 111984.60 -45499.600 11 79089 111984.60 -32895.600 12 81625 111984.60 -30359.600 13 68788 73685.41 -4897.415 14 103297 111984.60 -8687.600 15 69446 73685.41 -4239.415 16 114948 111984.60 2963.400 17 167949 134120.12 33828.875 18 125081 111984.60 13096.400 19 125818 111984.60 13833.400 20 136588 111984.60 24603.400 21 112431 134120.12 -21689.125 22 103037 111984.60 -8947.600 23 82317 73685.41 8631.585 24 118906 111984.60 6921.400 25 83515 111984.60 -28469.600 26 104581 111984.60 -7403.600 27 103129 111984.60 -8855.600 28 83243 111984.60 -28741.600 29 37110 73685.41 -36575.415 30 113344 111984.60 1359.400 31 139165 173801.50 -34636.500 32 86652 73685.41 12966.585 33 112302 134120.12 -21818.125 34 69652 73685.41 -4033.415 35 119442 134120.12 -14678.125 36 69867 73685.41 -3818.415 37 101629 111984.60 -10355.600 38 70168 111984.60 -41816.600 39 31081 73685.41 -42604.415 40 103925 134120.12 -30195.125 41 92622 111984.60 -19362.600 42 79011 73685.41 5325.585 43 93487 111984.60 -18497.600 44 64520 73685.41 -9165.415 45 93473 73685.41 19787.585 46 114360 73685.41 40674.585 47 33032 19045.44 13986.562 48 96125 111984.60 -15859.600 49 151911 111984.60 39926.400 50 89256 111984.60 -22728.600 51 95676 111984.60 -16308.600 52 5950 19045.44 -13095.438 53 149695 111984.60 37710.400 54 32551 19045.44 13505.562 55 31701 73685.41 -41984.415 56 100087 111984.60 -11897.600 57 169707 134120.12 35586.875 58 150491 173801.50 -23310.500 59 120192 134120.12 -13928.125 60 95893 111984.60 -16091.600 61 151715 111984.60 39730.400 62 176225 173801.50 2423.500 63 59900 73685.41 -13785.415 64 104767 111984.60 -7217.600 65 114799 134120.12 -19321.125 66 72128 111984.60 -39856.600 67 143592 111984.60 31607.400 68 89626 111984.60 -22358.600 69 131072 111984.60 19087.400 70 126817 111984.60 14832.400 71 81351 73685.41 7665.585 72 22618 19045.44 3572.562 73 88977 111984.60 -23007.600 74 92059 111984.60 -19925.600 75 81897 111984.60 -30087.600 76 108146 111984.60 -3838.600 77 126372 111984.60 14387.400 78 249771 111984.60 137786.400 79 71154 73685.41 -2531.415 80 71571 73685.41 -2114.415 81 55918 73685.41 -17767.415 82 160141 134120.12 26020.875 83 38692 73685.41 -34993.415 84 102812 111984.60 -9172.600 85 56622 73685.41 -17063.415 86 15986 73685.41 -57699.415 87 123534 134120.12 -10586.125 88 108535 111984.60 -3449.600 89 93879 134120.12 -40241.125 90 144551 134120.12 10430.875 91 56750 73685.41 -16935.415 92 127654 111984.60 15669.400 93 65594 73685.41 -8091.415 94 59938 73685.41 -13747.415 95 146975 134120.12 12854.875 96 161100 134120.12 26979.875 97 168553 134120.12 34432.875 98 183500 173801.50 9698.500 99 165986 173801.50 -7815.500 100 184923 173801.50 11121.500 101 140358 134120.12 6237.875 102 149959 111984.60 37974.400 103 57224 73685.41 -16461.415 104 43750 19045.44 24704.562 105 48029 73685.41 -25656.415 106 104978 173801.50 -68823.500 107 100046 134120.12 -34074.125 108 101047 111984.60 -10937.600 109 197426 111984.60 85441.400 110 160902 73685.41 87216.585 111 147172 111984.60 35187.400 112 109432 111984.60 -2552.600 113 1168 19045.44 -17877.438 114 83248 111984.60 -28736.600 115 25162 19045.44 6116.562 116 45724 73685.41 -27961.415 117 110529 111984.60 -1455.600 118 855 19045.44 -18190.438 119 101382 73685.41 27696.585 120 14116 19045.44 -4929.438 121 89506 111984.60 -22478.600 122 135356 111984.60 23371.400 123 116066 73685.41 42380.585 124 144244 73685.41 70558.585 125 8773 19045.44 -10272.438 126 102153 111984.60 -9831.600 127 117440 134120.12 -16680.125 128 104128 111984.60 -7856.600 129 134238 134120.12 117.875 130 134047 111984.60 22062.400 131 279488 173801.50 105686.500 132 79756 111984.60 -32228.600 133 66089 73685.41 -7596.415 134 102070 111984.60 -9914.600 135 146760 111984.60 34775.400 136 154771 73685.41 81085.585 137 165933 173801.50 -7868.500 138 64593 73685.41 -9092.415 139 92280 111984.60 -19704.600 140 67150 73685.41 -6535.415 141 128692 111984.60 16707.400 142 124089 73685.41 50403.585 143 125386 111984.60 13401.400 144 37238 73685.41 -36447.415 145 140015 134120.12 5894.875 146 150047 111984.60 38062.400 147 154451 134120.12 20330.875 148 156349 134120.12 22228.875 149 6023 19045.44 -13022.438 150 84601 111984.60 -27383.600 151 68946 111984.60 -43038.600 152 1644 19045.44 -17401.438 153 6179 19045.44 -12866.438 154 3926 19045.44 -15119.438 155 52789 73685.41 -20896.415 156 100350 73685.41 26664.585 > 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/4eoui1324373990.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/5o0h71324373990.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/6l00d1324373990.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/7nup91324373990.tab") + } > > try(system("convert tmp/2my031324373990.ps tmp/2my031324373990.png",intern=TRUE)) character(0) > try(system("convert tmp/3nbs21324373990.ps tmp/3nbs21324373990.png",intern=TRUE)) character(0) > try(system("convert tmp/4eoui1324373990.ps tmp/4eoui1324373990.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.451 0.289 3.737