R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-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(0 + ,255202 + ,64 + ,92 + ,34 + ,0 + ,135248 + ,59 + ,58 + ,30 + ,0 + ,207223 + ,64 + ,62 + ,42 + ,1 + ,189326 + ,95 + ,108 + ,34 + ,1 + ,141365 + ,46 + ,55 + ,25 + ,0 + ,65295 + ,27 + ,8 + ,31 + ,0 + ,439387 + ,103 + ,134 + ,29 + ,0 + ,33186 + ,19 + ,1 + ,18 + ,0 + ,183696 + ,51 + ,64 + ,30 + ,0 + ,186657 + ,38 + ,77 + ,29 + ,1 + ,276696 + ,99 + ,86 + ,42 + ,1 + ,194414 + ,98 + ,96 + ,50 + ,0 + ,141409 + ,59 + ,44 + ,33 + ,1 + ,306730 + ,68 + ,108 + ,46 + ,1 + ,192691 + ,74 + ,63 + ,38 + ,1 + ,333497 + ,164 + ,160 + ,52 + ,0 + ,261835 + ,59 + ,109 + ,32 + ,1 + ,263451 + ,130 + ,86 + ,35 + ,1 + ,157448 + ,49 + ,93 + ,25 + ,1 + ,232190 + ,73 + ,126 + ,42 + ,0 + ,245725 + ,64 + ,110 + ,40 + ,0 + ,388603 + ,92 + ,86 + ,35 + ,0 + ,156540 + ,34 + ,50 + ,25 + ,0 + ,156189 + ,47 + ,92 + ,46 + ,0 + ,189726 + ,106 + ,123 + ,39 + ,0 + ,192167 + ,106 + ,81 + ,35 + ,1 + ,249893 + ,122 + ,93 + ,38 + ,1 + ,236812 + ,76 + ,113 + ,35 + ,1 + ,143160 + ,47 + ,52 + ,28 + ,0 + ,259667 + ,54 + ,113 + ,37 + ,0 + ,243020 + ,68 + ,113 + ,40 + ,0 + ,176062 + ,67 + ,44 + ,42 + ,0 + ,286683 + ,79 + ,123 + ,44 + ,1 + ,87485 + ,33 + ,38 + ,33 + ,0 + ,329737 + ,88 + ,111 + ,38 + ,1 + ,247082 + ,51 + ,77 + ,37 + ,0 + ,378463 + ,108 + ,102 + ,41 + ,1 + ,191653 + ,75 + ,74 + ,32 + ,0 + ,114673 + ,31 + ,33 + ,17 + ,0 + ,301596 + ,167 + ,107 + ,39 + ,0 + ,284195 + ,73 + ,108 + ,33 + ,1 + ,155568 + ,60 + ,66 + ,35 + ,1 + ,177306 + ,67 + ,69 + ,32 + ,1 + ,144595 + ,51 + ,62 + ,35 + ,0 + ,140319 + ,73 + ,50 + ,45 + ,1 + ,405267 + ,135 + ,91 + ,38 + ,1 + ,78800 + ,42 + ,20 + ,26 + ,1 + ,201970 + ,69 + ,101 + ,45 + ,1 + ,302705 + ,101 + ,129 + ,44 + ,1 + ,164733 + ,50 + ,93 + ,40 + ,1 + ,194221 + ,68 + ,89 + ,33 + ,0 + ,24188 + ,24 + ,8 + ,4 + ,0 + ,346142 + ,288 + ,80 + ,41 + ,0 + ,65029 + ,17 + ,21 + ,18 + ,0 + ,101097 + ,64 + ,30 + ,14 + ,1 + ,253745 + ,51 + ,86 + ,36 + ,0 + ,273513 + ,77 + ,116 + ,49 + ,1 + ,282220 + ,160 + ,106 + ,32 + ,1 + ,280928 + ,120 + ,132 + ,37 + ,1 + ,214872 + ,74 + ,75 + ,32 + ,0 + ,342048 + ,127 + ,139 + ,43 + ,0 + ,273924 + ,108 + ,121 + ,25 + ,1 + ,195726 + ,92 + ,57 + ,42 + ,1 + ,231162 + ,80 + ,67 + ,37 + ,0 + ,209798 + ,61 + ,45 + ,33 + ,1 + ,201345 + ,60 + ,88 + ,28 + ,0 + ,180231 + ,118 + ,79 + ,31 + ,1 + ,204441 + ,129 + ,75 + ,40 + ,0 + ,197813 + ,67 + ,114 + ,32 + ,1 + ,136421 + ,60 + ,127 + ,25 + ,1 + ,216092 + ,59 + ,86 + ,42 + ,1 + ,73566 + ,32 + ,22 + ,23 + ,0 + ,213998 + ,70 + ,67 + ,42 + ,1 + ,181728 + ,50 + ,77 + ,38 + ,0 + ,148758 + ,51 + ,105 + ,34 + ,0 + ,308343 + ,71 + ,121 + ,39 + ,1 + ,251437 + ,78 + ,88 + ,32 + ,0 + ,202388 + ,102 + ,78 + ,37 + ,0 + ,173286 + ,56 + ,122 + ,34 + ,0 + ,155529 + ,58 + ,66 + ,33 + ,0 + ,132672 + ,41 + ,58 + ,25 + ,1 + ,390163 + ,102 + ,134 + ,45 + ,0 + ,145905 + ,66 + ,30 + ,26 + ,0 + ,228012 + ,88 + ,103 + ,40 + ,1 + ,80953 + ,25 + ,49 + ,8 + ,0 + ,130805 + ,47 + ,26 + ,27 + ,1 + ,135163 + ,49 + ,67 + ,32 + ,1 + ,333790 + ,168 + ,59 + ,37 + ,1 + ,271806 + ,95 + ,95 + ,50 + ,1 + ,164235 + ,99 + ,156 + ,41 + ,1 + ,234092 + ,80 + ,74 + ,37 + ,0 + ,207158 + ,69 + ,137 + ,38 + ,0 + ,156583 + ,57 + ,37 + ,28 + ,0 + ,242395 + ,68 + ,111 + ,36 + ,1 + ,261601 + ,70 + ,58 + ,32 + ,1 + ,178489 + ,35 + ,78 + ,32 + ,0 + ,204221 + ,44 + ,88 + ,33 + ,1 + ,268066 + ,69 + ,152 + ,35 + ,1 + ,327622 + ,133 + ,130 + ,58 + ,1 + ,361799 + ,101 + ,145 + ,27 + ,0 + ,247131 + ,107 + ,108 + ,45 + ,1 + ,265849 + ,58 + ,138 + ,37 + ,0 + ,162336 + ,162 + ,62 + ,32 + ,1 + ,43287 + ,14 + ,13 + ,19 + ,0 + ,172244 + ,68 + ,89 + ,22 + ,0 + ,189021 + ,121 + ,86 + ,35 + ,0 + ,227681 + ,43 + ,116 + ,36 + ,0 + ,269329 + ,81 + ,157 + ,36 + ,0 + ,106503 + ,56 + ,28 + ,23 + ,1 + ,117891 + ,77 + ,83 + ,40 + ,1 + ,287201 + ,59 + ,72 + ,40 + ,0 + ,266805 + ,78 + ,134 + ,42 + ,0 + ,23623 + ,11 + ,12 + ,1 + ,1 + ,174954 + ,69 + ,120 + ,36 + ,0 + ,61857 + ,25 + ,23 + ,11 + ,1 + ,144889 + ,43 + ,83 + ,40 + ,1 + ,347988 + ,103 + ,126 + ,34 + ,0 + ,21054 + ,16 + ,4 + ,0 + ,1 + ,224051 + ,46 + ,71 + ,27 + ,1 + ,31414 + ,19 + ,18 + ,8 + ,1 + ,278660 + ,107 + ,98 + ,35 + ,0 + ,209481 + ,58 + ,68 + ,44 + ,0 + ,156870 + ,75 + ,44 + ,40 + ,1 + ,112933 + ,46 + ,29 + ,28 + ,0 + ,38214 + ,34 + ,16 + ,8 + ,0 + ,166011 + ,35 + ,61 + ,36 + ,1 + ,316044 + ,73 + ,117 + ,47 + ,1 + ,181578 + ,56 + ,46 + ,48 + ,1 + ,358903 + ,72 + ,129 + ,45 + ,1 + ,275578 + ,91 + ,139 + ,48 + ,1 + ,368796 + ,106 + ,136 + ,49 + ,1 + ,172464 + ,31 + ,66 + ,35 + ,1 + ,94381 + ,35 + ,42 + ,32 + ,1 + ,250563 + ,290 + ,75 + ,36 + ,1 + ,382499 + ,154 + ,97 + ,42 + ,1 + ,118010 + ,42 + ,49 + ,35 + ,1 + ,365575 + ,122 + ,127 + ,42 + ,1 + ,147989 + ,72 + ,55 + ,34 + ,1 + ,231681 + ,46 + ,101 + ,41 + ,0 + ,193119 + ,77 + ,80 + ,36 + ,0 + ,189020 + ,108 + ,29 + ,32 + ,0 + ,341958 + ,106 + ,95 + ,33 + ,1 + ,222060 + ,79 + ,120 + ,35 + ,0 + ,173260 + ,63 + ,41 + ,21 + ,0 + ,274787 + ,91 + ,128 + ,42 + ,1 + ,130908 + ,52 + ,142 + ,49 + ,0 + ,204009 + ,75 + ,88 + ,33 + ,0 + ,262412 + ,94 + ,170 + ,39 + ,0 + ,1 + ,0 + ,0 + ,0 + ,0 + ,14688 + ,10 + ,4 + ,0 + ,0 + ,98 + ,1 + ,0 + ,0 + ,0 + ,455 + ,2 + ,0 + ,0 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1 + ,195765 + ,75 + ,56 + ,33 + ,0 + ,334258 + ,129 + ,121 + ,47 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,203 + ,4 + ,0 + ,0 + ,0 + ,7199 + ,5 + ,7 + ,0 + ,1 + ,46660 + ,20 + ,12 + ,5 + ,1 + ,17547 + ,5 + ,0 + ,1 + ,0 + ,107465 + ,38 + ,37 + ,38 + ,1 + ,969 + ,2 + ,0 + ,0 + ,1 + ,179994 + ,58 + ,47 + ,28) + ,dim=c(5 + ,164) + ,dimnames=list(c('Geslacht' + ,'Time_in_RFC' + ,'Logins' + ,'Blogged_computations' + ,'Reviewed_compendiums') + ,1:164)) > y <- array(NA,dim=c(5,164),dimnames=list(c('Geslacht','Time_in_RFC','Logins','Blogged_computations','Reviewed_compendiums'),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 = '' > par2 = 'none' > par1 = '2' > 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 Attaching package: 'zoo' The following object(s) are masked from 'package:base': as.Date, as.Date.numeric Loading required package: sandwich Loading required package: strucchange Loading required package: vcd Loading required package: MASS Loading required package: colorspace > library(Hmisc) Hmisc library by Frank E Harrell Jr Type library(help='Hmisc'), ?Overview, or ?Hmisc.Overview') to see overall documentation. NOTE:Hmisc no longer redefines [.factor to drop unused levels when subsetting. To get the old behavior of Hmisc type dropUnusedLevels(). 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] "Time_in_RFC" > x[,par1] [1] 255202 135248 207223 189326 141365 65295 439387 33186 183696 186657 [11] 276696 194414 141409 306730 192691 333497 261835 263451 157448 232190 [21] 245725 388603 156540 156189 189726 192167 249893 236812 143160 259667 [31] 243020 176062 286683 87485 329737 247082 378463 191653 114673 301596 [41] 284195 155568 177306 144595 140319 405267 78800 201970 302705 164733 [51] 194221 24188 346142 65029 101097 253745 273513 282220 280928 214872 [61] 342048 273924 195726 231162 209798 201345 180231 204441 197813 136421 [71] 216092 73566 213998 181728 148758 308343 251437 202388 173286 155529 [81] 132672 390163 145905 228012 80953 130805 135163 333790 271806 164235 [91] 234092 207158 156583 242395 261601 178489 204221 268066 327622 361799 [101] 247131 265849 162336 43287 172244 189021 227681 269329 106503 117891 [111] 287201 266805 23623 174954 61857 144889 347988 21054 224051 31414 [121] 278660 209481 156870 112933 38214 166011 316044 181578 358903 275578 [131] 368796 172464 94381 250563 382499 118010 365575 147989 231681 193119 [141] 189020 341958 222060 173260 274787 130908 204009 262412 1 14688 [151] 98 455 0 0 195765 334258 0 203 7199 46660 [161] 17547 107465 969 179994 > 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 1 98 203 455 969 7199 14688 17547 21054 23623 3 1 1 1 1 1 1 1 1 1 1 24188 31414 33186 38214 43287 46660 61857 65029 65295 73566 78800 1 1 1 1 1 1 1 1 1 1 1 80953 87485 94381 101097 106503 107465 112933 114673 117891 118010 130805 1 1 1 1 1 1 1 1 1 1 1 130908 132672 135163 135248 136421 140319 141365 141409 143160 144595 144889 1 1 1 1 1 1 1 1 1 1 1 145905 147989 148758 155529 155568 156189 156540 156583 156870 157448 162336 1 1 1 1 1 1 1 1 1 1 1 164235 164733 166011 172244 172464 173260 173286 174954 176062 177306 178489 1 1 1 1 1 1 1 1 1 1 1 179994 180231 181578 181728 183696 186657 189020 189021 189326 189726 191653 1 1 1 1 1 1 1 1 1 1 1 192167 192691 193119 194221 194414 195726 195765 197813 201345 201970 202388 1 1 1 1 1 1 1 1 1 1 1 204009 204221 204441 207158 207223 209481 209798 213998 214872 216092 222060 1 1 1 1 1 1 1 1 1 1 1 224051 227681 228012 231162 231681 232190 234092 236812 242395 243020 245725 1 1 1 1 1 1 1 1 1 1 1 247082 247131 249893 250563 251437 253745 255202 259667 261601 261835 262412 1 1 1 1 1 1 1 1 1 1 1 263451 265849 266805 268066 269329 271806 273513 273924 274787 275578 276696 1 1 1 1 1 1 1 1 1 1 1 278660 280928 282220 284195 286683 287201 301596 302705 306730 308343 316044 1 1 1 1 1 1 1 1 1 1 1 327622 329737 333497 333790 334258 341958 342048 346142 347988 358903 361799 1 1 1 1 1 1 1 1 1 1 1 365575 368796 378463 382499 388603 390163 405267 439387 1 1 1 1 1 1 1 1 > colnames(x) [1] "Geslacht" "Time_in_RFC" "Logins" [4] "Blogged_computations" "Reviewed_compendiums" > colnames(x)[par1] [1] "Time_in_RFC" > x[,par1] [1] 255202 135248 207223 189326 141365 65295 439387 33186 183696 186657 [11] 276696 194414 141409 306730 192691 333497 261835 263451 157448 232190 [21] 245725 388603 156540 156189 189726 192167 249893 236812 143160 259667 [31] 243020 176062 286683 87485 329737 247082 378463 191653 114673 301596 [41] 284195 155568 177306 144595 140319 405267 78800 201970 302705 164733 [51] 194221 24188 346142 65029 101097 253745 273513 282220 280928 214872 [61] 342048 273924 195726 231162 209798 201345 180231 204441 197813 136421 [71] 216092 73566 213998 181728 148758 308343 251437 202388 173286 155529 [81] 132672 390163 145905 228012 80953 130805 135163 333790 271806 164235 [91] 234092 207158 156583 242395 261601 178489 204221 268066 327622 361799 [101] 247131 265849 162336 43287 172244 189021 227681 269329 106503 117891 [111] 287201 266805 23623 174954 61857 144889 347988 21054 224051 31414 [121] 278660 209481 156870 112933 38214 166011 316044 181578 358903 275578 [131] 368796 172464 94381 250563 382499 118010 365575 147989 231681 193119 [141] 189020 341958 222060 173260 274787 130908 204009 262412 1 14688 [151] 98 455 0 0 195765 334258 0 203 7199 46660 [161] 17547 107465 969 179994 > if (par2 == 'none') { + m <- ctree(as.formula(paste(colnames(x)[par1],' ~ .',sep='')),data = x) + } > > #Note: the /var/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/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/fisher/rcomp/tmp/1ddpf1355164223.tab") + } + } > m Conditional inference tree with 7 terminal nodes Response: Time_in_RFC Inputs: Geslacht, Logins, Blogged_computations, Reviewed_compendiums Number of observations: 164 1) Blogged_computations <= 55; criterion = 1, statistic = 103.88 2) Logins <= 27; criterion = 1, statistic = 39.562 3) Logins <= 11; criterion = 1, statistic = 16.443 4)* weights = 12 3) Logins > 11 5)* weights = 10 2) Logins > 27 6) Logins <= 42; criterion = 0.996, statistic = 10.625 7)* weights = 9 6) Logins > 42 8)* weights = 18 1) Blogged_computations > 55 9) Logins <= 77; criterion = 1, statistic = 25.312 10) Blogged_computations <= 105; criterion = 0.995, statistic = 10.258 11)* weights = 41 10) Blogged_computations > 105 12)* weights = 22 9) Logins > 77 13)* weights = 52 > postscript(file="/var/fisher/rcomp/tmp/2y1pj1355164223.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/fisher/rcomp/tmp/3t7gk1355164223.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 255202 189475.634 65726.3659 2 135248 189475.634 -54227.6341 3 207223 189475.634 17747.3659 4 189326 281991.019 -92665.0192 5 141365 151925.000 -10560.0000 6 65295 47292.300 18002.7000 7 439387 281991.019 157395.9808 8 33186 47292.300 -14106.3000 9 183696 189475.634 -5779.6341 10 186657 189475.634 -2818.6341 11 276696 281991.019 -5295.0192 12 194414 281991.019 -87577.0192 13 141409 151925.000 -10516.0000 14 306730 243250.364 63479.6364 15 192691 189475.634 3215.3659 16 333497 281991.019 51505.9808 17 261835 243250.364 18584.6364 18 263451 281991.019 -18540.0192 19 157448 189475.634 -32027.6341 20 232190 243250.364 -11060.3636 21 245725 243250.364 2474.6364 22 388603 281991.019 106611.9808 23 156540 96570.444 59969.5556 24 156189 189475.634 -33286.6341 25 189726 281991.019 -92265.0192 26 192167 281991.019 -89824.0192 27 249893 281991.019 -32098.0192 28 236812 243250.364 -6438.3636 29 143160 151925.000 -8765.0000 30 259667 243250.364 16416.6364 31 243020 243250.364 -230.3636 32 176062 151925.000 24137.0000 33 286683 281991.019 4691.9808 34 87485 96570.444 -9085.4444 35 329737 281991.019 47745.9808 36 247082 189475.634 57606.3659 37 378463 281991.019 96471.9808 38 191653 189475.634 2177.3659 39 114673 96570.444 18102.5556 40 301596 281991.019 19604.9808 41 284195 243250.364 40944.6364 42 155568 189475.634 -33907.6341 43 177306 189475.634 -12169.6341 44 144595 189475.634 -44880.6341 45 140319 151925.000 -11606.0000 46 405267 281991.019 123275.9808 47 78800 96570.444 -17770.4444 48 201970 189475.634 12494.3659 49 302705 281991.019 20713.9808 50 164733 189475.634 -24742.6341 51 194221 189475.634 4745.3659 52 24188 47292.300 -23104.3000 53 346142 281991.019 64150.9808 54 65029 47292.300 17736.7000 55 101097 151925.000 -50828.0000 56 253745 189475.634 64269.3659 57 273513 243250.364 30262.6364 58 282220 281991.019 228.9808 59 280928 281991.019 -1063.0192 60 214872 189475.634 25396.3659 61 342048 281991.019 60056.9808 62 273924 281991.019 -8067.0192 63 195726 281991.019 -86265.0192 64 231162 281991.019 -50829.0192 65 209798 151925.000 57873.0000 66 201345 189475.634 11869.3659 67 180231 281991.019 -101760.0192 68 204441 281991.019 -77550.0192 69 197813 243250.364 -45437.3636 70 136421 243250.364 -106829.3636 71 216092 189475.634 26616.3659 72 73566 96570.444 -23004.4444 73 213998 189475.634 24522.3659 74 181728 189475.634 -7747.6341 75 148758 189475.634 -40717.6341 76 308343 243250.364 65092.6364 77 251437 281991.019 -30554.0192 78 202388 281991.019 -79603.0192 79 173286 243250.364 -69964.3636 80 155529 189475.634 -33946.6341 81 132672 189475.634 -56803.6341 82 390163 281991.019 108171.9808 83 145905 151925.000 -6020.0000 84 228012 281991.019 -53979.0192 85 80953 47292.300 33660.7000 86 130805 151925.000 -21120.0000 87 135163 189475.634 -54312.6341 88 333790 281991.019 51798.9808 89 271806 281991.019 -10185.0192 90 164235 281991.019 -117756.0192 91 234092 281991.019 -47899.0192 92 207158 243250.364 -36092.3636 93 156583 151925.000 4658.0000 94 242395 243250.364 -855.3636 95 261601 189475.634 72125.3659 96 178489 189475.634 -10986.6341 97 204221 189475.634 14745.3659 98 268066 243250.364 24815.6364 99 327622 281991.019 45630.9808 100 361799 281991.019 79807.9808 101 247131 281991.019 -34860.0192 102 265849 243250.364 22598.6364 103 162336 281991.019 -119655.0192 104 43287 47292.300 -4005.3000 105 172244 189475.634 -17231.6341 106 189021 281991.019 -92970.0192 107 227681 243250.364 -15569.3636 108 269329 281991.019 -12662.0192 109 106503 151925.000 -45422.0000 110 117891 189475.634 -71584.6341 111 287201 189475.634 97725.3659 112 266805 281991.019 -15186.0192 113 23623 5398.583 18224.4167 114 174954 243250.364 -68296.3636 115 61857 47292.300 14564.7000 116 144889 189475.634 -44586.6341 117 347988 281991.019 65996.9808 118 21054 47292.300 -26238.3000 119 224051 189475.634 34575.3659 120 31414 47292.300 -15878.3000 121 278660 281991.019 -3331.0192 122 209481 189475.634 20005.3659 123 156870 151925.000 4945.0000 124 112933 151925.000 -38992.0000 125 38214 96570.444 -58356.4444 126 166011 189475.634 -23464.6341 127 316044 243250.364 72793.6364 128 181578 151925.000 29653.0000 129 358903 243250.364 115652.6364 130 275578 281991.019 -6413.0192 131 368796 281991.019 86804.9808 132 172464 189475.634 -17011.6341 133 94381 96570.444 -2189.4444 134 250563 281991.019 -31428.0192 135 382499 281991.019 100507.9808 136 118010 96570.444 21439.5556 137 365575 281991.019 83583.9808 138 147989 151925.000 -3936.0000 139 231681 189475.634 42205.3659 140 193119 189475.634 3643.3659 141 189020 151925.000 37095.0000 142 341958 281991.019 59966.9808 143 222060 281991.019 -59931.0192 144 173260 151925.000 21335.0000 145 274787 281991.019 -7204.0192 146 130908 243250.364 -112342.3636 147 204009 189475.634 14533.3659 148 262412 281991.019 -19579.0192 149 1 5398.583 -5397.5833 150 14688 5398.583 9289.4167 151 98 5398.583 -5300.5833 152 455 5398.583 -4943.5833 153 0 5398.583 -5398.5833 154 0 5398.583 -5398.5833 155 195765 189475.634 6289.3659 156 334258 281991.019 52266.9808 157 0 5398.583 -5398.5833 158 203 5398.583 -5195.5833 159 7199 5398.583 1800.4167 160 46660 47292.300 -632.3000 161 17547 5398.583 12148.4167 162 107465 96570.444 10894.5556 163 969 5398.583 -4429.5833 164 179994 151925.000 28069.0000 > if (par2 != 'none') { + print(cbind(as.factor(x[,par1]),predict(m))) + myt <- table(as.factor(x[,par1]),predict(m)) + print(myt) + } > postscript(file="/var/fisher/rcomp/tmp/43wq91355164223.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/fisher/rcomp/tmp/51eva1355164223.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/fisher/rcomp/tmp/6o7qx1355164223.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/fisher/rcomp/tmp/7216f1355164223.tab") + } > > try(system("convert tmp/2y1pj1355164223.ps tmp/2y1pj1355164223.png",intern=TRUE)) character(0) > try(system("convert tmp/3t7gk1355164223.ps tmp/3t7gk1355164223.png",intern=TRUE)) character(0) > try(system("convert tmp/43wq91355164223.ps tmp/43wq91355164223.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.242 0.595 5.834