R version 2.12.0 (2010-10-15) Copyright (C) 2010 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(17140 + ,101645 + ,88 + ,20 + ,11 + ,27570 + ,101011 + ,41 + ,30 + ,13 + ,1423 + ,7176 + ,1 + ,0 + ,0 + ,22996 + ,96560 + ,129 + ,42 + ,17 + ,39992 + ,175824 + ,107 + ,57 + ,20 + ,117105 + ,341570 + ,190 + ,94 + ,21 + ,23789 + ,103597 + ,66 + ,27 + ,16 + ,26706 + ,112611 + ,36 + ,46 + ,20 + ,24266 + ,85574 + ,71 + ,37 + ,21 + ,44418 + ,220801 + ,105 + ,51 + ,18 + ,35232 + ,92661 + ,133 + ,40 + ,17 + ,40909 + ,133328 + ,79 + ,56 + ,20 + ,13294 + ,61361 + ,51 + ,27 + ,12 + ,32387 + ,125930 + ,207 + ,37 + ,17 + ,21233 + ,82316 + ,34 + ,27 + ,10 + ,44332 + ,102010 + ,66 + ,28 + ,13 + ,61056 + ,101523 + ,76 + ,59 + ,22 + ,13497 + ,41566 + ,42 + ,0 + ,9 + ,32334 + ,99923 + ,115 + ,44 + ,25 + ,44339 + ,22648 + ,44 + ,12 + ,13 + ,10288 + ,46698 + ,35 + ,14 + ,13 + ,65622 + ,131698 + ,74 + ,60 + ,19 + ,16563 + ,91735 + ,103 + ,7 + ,18 + ,29011 + ,79863 + ,134 + ,29 + ,22 + ,34553 + ,108043 + ,29 + ,45 + ,14 + ,23517 + ,98866 + ,140 + ,25 + ,13 + ,51009 + ,120445 + ,72 + ,36 + ,16 + ,33416 + ,116048 + ,45 + ,50 + ,20 + ,83305 + ,250047 + ,58 + ,41 + ,18 + ,27142 + ,136084 + ,69 + ,27 + ,13 + ,21399 + ,92499 + ,57 + ,25 + ,18 + ,24874 + ,135781 + ,98 + ,45 + ,14 + ,34988 + ,74408 + ,61 + ,29 + ,7 + ,45549 + ,81240 + ,89 + ,58 + ,17 + ,32755 + ,133368 + ,54 + ,37 + ,16 + ,20760 + ,79619 + ,123 + ,42 + ,11 + ,37636 + ,59194 + ,247 + ,7 + ,24 + ,65461 + ,139942 + ,46 + ,54 + ,22 + ,30080 + ,118612 + ,72 + ,54 + ,12 + ,24094 + ,72880 + ,41 + ,14 + ,19 + ,69008 + ,65475 + ,24 + ,16 + ,13 + ,54968 + ,99643 + ,45 + ,33 + ,17 + ,46090 + ,71965 + ,33 + ,32 + ,15 + ,27507 + ,77272 + ,27 + ,21 + ,16 + ,10672 + ,49289 + ,36 + ,15 + ,24 + ,34029 + ,135131 + ,87 + ,38 + ,15 + ,46300 + ,108446 + ,90 + ,22 + ,17 + ,24760 + ,89746 + ,114 + ,28 + ,18 + ,18779 + ,44296 + ,31 + ,10 + ,20 + ,21280 + ,77648 + ,45 + ,31 + ,16 + ,40662 + ,181528 + ,69 + ,32 + ,16 + ,28987 + ,134019 + ,51 + ,32 + ,18 + ,22827 + ,124064 + ,34 + ,43 + ,22 + ,18513 + ,92630 + ,60 + ,27 + ,8 + ,30594 + ,121848 + ,45 + ,37 + ,17 + ,24006 + ,52915 + ,54 + ,20 + ,18 + ,27913 + ,81872 + ,25 + ,32 + ,16 + ,42744 + ,58981 + ,38 + ,0 + ,23 + ,12934 + ,53515 + ,52 + ,5 + ,22 + ,22574 + ,60812 + ,67 + ,26 + ,13 + ,41385 + ,56375 + ,74 + ,10 + ,13 + ,18653 + ,65490 + ,38 + ,27 + ,16 + ,18472 + ,80949 + ,30 + ,11 + ,16 + ,30976 + ,76302 + ,26 + ,29 + ,20 + ,63339 + ,104011 + ,67 + ,25 + ,22 + ,25568 + ,98104 + ,132 + ,55 + ,17 + ,33747 + ,67989 + ,42 + ,23 + ,18 + ,4154 + ,30989 + ,35 + ,5 + ,17 + ,19474 + ,135458 + ,118 + ,43 + ,12 + ,35130 + ,73504 + ,68 + ,23 + ,7 + ,39067 + ,63123 + ,43 + ,34 + ,17 + ,13310 + ,61254 + ,76 + ,36 + ,14 + ,65892 + ,74914 + ,64 + ,35 + ,23 + ,4143 + ,31774 + ,48 + ,0 + ,17 + ,28579 + ,81437 + ,64 + ,37 + ,14 + ,51776 + ,87186 + ,56 + ,28 + ,15 + ,21152 + ,50090 + ,71 + ,16 + ,17 + ,38084 + ,65745 + ,75 + ,26 + ,21 + ,27717 + ,56653 + ,39 + ,38 + ,18 + ,32928 + ,158399 + ,42 + ,23 + ,18 + ,11342 + ,46455 + ,39 + ,22 + ,17 + ,19499 + ,73624 + ,93 + ,30 + ,17 + ,16380 + ,38395 + ,38 + ,16 + ,16 + ,36874 + ,91899 + ,60 + ,18 + ,15 + ,48259 + ,139526 + ,71 + ,28 + ,21 + ,16734 + ,52164 + ,52 + ,32 + ,16 + ,28207 + ,51567 + ,27 + ,21 + ,14 + ,30143 + ,70551 + ,59 + ,23 + ,15 + ,41369 + ,84856 + ,40 + ,29 + ,17 + ,45833 + ,102538 + ,79 + ,50 + ,15 + ,29156 + ,86678 + ,44 + ,12 + ,15 + ,35944 + ,85709 + ,65 + ,21 + ,10 + ,36278 + ,34662 + ,10 + ,18 + ,6 + ,45588 + ,150580 + ,124 + ,27 + ,22 + ,45097 + ,99611 + ,81 + ,41 + ,21 + ,3895 + ,19349 + ,15 + ,13 + ,1 + ,28394 + ,99373 + ,92 + ,12 + ,18 + ,18632 + ,86230 + ,42 + ,21 + ,17 + ,2325 + ,30837 + ,10 + ,8 + ,4 + ,25139 + ,31706 + ,24 + ,26 + ,10 + ,27975 + ,89806 + ,64 + ,27 + ,16 + ,14483 + ,62088 + ,45 + ,13 + ,16 + ,13127 + ,40151 + ,22 + ,16 + ,9 + ,5839 + ,27634 + ,56 + ,2 + ,16 + ,24069 + ,76990 + ,94 + ,42 + ,17 + ,3738 + ,37460 + ,19 + ,5 + ,7 + ,18625 + ,54157 + ,35 + ,37 + ,15 + ,36341 + ,49862 + ,32 + ,17 + ,14 + ,24548 + ,84337 + ,35 + ,38 + ,14 + ,21792 + ,64175 + ,48 + ,37 + ,18 + ,26263 + ,59382 + ,49 + ,29 + ,12 + ,23686 + ,119308 + ,48 + ,32 + ,16 + ,49303 + ,76702 + ,62 + ,35 + ,21 + ,25659 + ,103425 + ,96 + ,17 + ,19 + ,28904 + ,70344 + ,45 + ,20 + ,16 + ,2781 + ,43410 + ,63 + ,7 + ,1 + ,29236 + ,104838 + ,71 + ,46 + ,16 + ,19546 + ,62215 + ,26 + ,24 + ,10 + ,22818 + ,69304 + ,48 + ,40 + ,19 + ,32689 + ,53117 + ,29 + ,3 + ,12 + ,5752 + ,19764 + ,19 + ,10 + ,2 + ,22197 + ,86680 + ,45 + ,37 + ,14 + ,20055 + ,84105 + ,45 + ,17 + ,17 + ,25272 + ,77945 + ,67 + ,28 + ,19 + ,82206 + ,89113 + ,30 + ,19 + ,14 + ,32073 + ,91005 + ,36 + ,29 + ,11 + ,5444 + ,40248 + ,34 + ,8 + ,4 + ,20154 + ,64187 + ,36 + ,10 + ,16 + ,36944 + ,50857 + ,34 + ,15 + ,20 + ,8019 + ,56613 + ,37 + ,15 + ,12 + ,30884 + ,62792 + ,46 + ,28 + ,15 + ,19540 + ,72535 + ,44 + ,17 + ,16 + ,27114 + ,98146 + ,37 + ,15 + ,17) + ,dim=c(5 + ,133) + ,dimnames=list(c('Total_size' + ,'Time_RFC' + ,'PR_views' + ,'Blogged' + ,'Reviewed') + ,1:133)) > y <- array(NA,dim=c(5,133),dimnames=list(c('Total_size','Time_RFC','PR_views','Blogged','Reviewed'),1:133)) > 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 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] "Time_RFC" > x[,par1] [1] 101645 101011 7176 96560 175824 341570 103597 112611 85574 220801 [11] 92661 133328 61361 125930 82316 102010 101523 41566 99923 22648 [21] 46698 131698 91735 79863 108043 98866 120445 116048 250047 136084 [31] 92499 135781 74408 81240 133368 79619 59194 139942 118612 72880 [41] 65475 99643 71965 77272 49289 135131 108446 89746 44296 77648 [51] 181528 134019 124064 92630 121848 52915 81872 58981 53515 60812 [61] 56375 65490 80949 76302 104011 98104 67989 30989 135458 73504 [71] 63123 61254 74914 31774 81437 87186 50090 65745 56653 158399 [81] 46455 73624 38395 91899 139526 52164 51567 70551 84856 102538 [91] 86678 85709 34662 150580 99611 19349 99373 86230 30837 31706 [101] 89806 62088 40151 27634 76990 37460 54157 49862 84337 64175 [111] 59382 119308 76702 103425 70344 43410 104838 62215 69304 53117 [121] 19764 86680 84105 77945 89113 91005 40248 64187 50857 56613 [131] 62792 72535 98146 > 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]) 7176 19349 19764 22648 27634 30837 30989 31706 31774 34662 37460 1 1 1 1 1 1 1 1 1 1 1 38395 40151 40248 41566 43410 44296 46455 46698 49289 49862 50090 1 1 1 1 1 1 1 1 1 1 1 50857 51567 52164 52915 53117 53515 54157 56375 56613 56653 58981 1 1 1 1 1 1 1 1 1 1 1 59194 59382 60812 61254 61361 62088 62215 62792 63123 64175 64187 1 1 1 1 1 1 1 1 1 1 1 65475 65490 65745 67989 69304 70344 70551 71965 72535 72880 73504 1 1 1 1 1 1 1 1 1 1 1 73624 74408 74914 76302 76702 76990 77272 77648 77945 79619 79863 1 1 1 1 1 1 1 1 1 1 1 80949 81240 81437 81872 82316 84105 84337 84856 85574 85709 86230 1 1 1 1 1 1 1 1 1 1 1 86678 86680 87186 89113 89746 89806 91005 91735 91899 92499 92630 1 1 1 1 1 1 1 1 1 1 1 92661 96560 98104 98146 98866 99373 99611 99643 99923 101011 101523 1 1 1 1 1 1 1 1 1 1 1 101645 102010 102538 103425 103597 104011 104838 108043 108446 112611 116048 1 1 1 1 1 1 1 1 1 1 1 118612 119308 120445 121848 124064 125930 131698 133328 133368 134019 135131 1 1 1 1 1 1 1 1 1 1 1 135458 135781 136084 139526 139942 150580 158399 175824 181528 220801 250047 1 1 1 1 1 1 1 1 1 1 1 341570 1 > colnames(x) [1] "Total_size" "Time_RFC" "PR_views" "Blogged" "Reviewed" > colnames(x)[par1] [1] "Time_RFC" > x[,par1] [1] 101645 101011 7176 96560 175824 341570 103597 112611 85574 220801 [11] 92661 133328 61361 125930 82316 102010 101523 41566 99923 22648 [21] 46698 131698 91735 79863 108043 98866 120445 116048 250047 136084 [31] 92499 135781 74408 81240 133368 79619 59194 139942 118612 72880 [41] 65475 99643 71965 77272 49289 135131 108446 89746 44296 77648 [51] 181528 134019 124064 92630 121848 52915 81872 58981 53515 60812 [61] 56375 65490 80949 76302 104011 98104 67989 30989 135458 73504 [71] 63123 61254 74914 31774 81437 87186 50090 65745 56653 158399 [81] 46455 73624 38395 91899 139526 52164 51567 70551 84856 102538 [91] 86678 85709 34662 150580 99611 19349 99373 86230 30837 31706 [101] 89806 62088 40151 27634 76990 37460 54157 49862 84337 64175 [111] 59382 119308 76702 103425 70344 43410 104838 62215 69304 53117 [121] 19764 86680 84105 77945 89113 91005 40248 64187 50857 56613 [131] 62792 72535 98146 > if (par2 == 'none') { + m <- ctree(as.formula(paste(colnames(x)[par1],' ~ .',sep='')),data = x) + } > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/www/rcomp/tmp/15c5s1324132722.tab") + } + } > m Conditional inference tree with 6 terminal nodes Response: Time_RFC Inputs: Total_size, PR_views, Blogged, Reviewed Number of observations: 133 1) Blogged <= 40; criterion = 1, statistic = 61.707 2) Blogged <= 16; criterion = 1, statistic = 30.567 3) Reviewed <= 9; criterion = 0.991, statistic = 9.278 4)* weights = 9 3) Reviewed > 9 5)* weights = 25 2) Blogged > 16 6) PR_views <= 68; criterion = 0.997, statistic = 11.696 7)* weights = 57 6) PR_views > 68 8)* weights = 18 1) Blogged > 40 9) Total_size <= 34553; criterion = 0.999, statistic = 13.625 10)* weights = 13 9) Total_size > 34553 11)* weights = 11 > postscript(file="/var/www/rcomp/tmp/26jkv1324132722.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/www/rcomp/tmp/3h8531324132722.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 101645 108337.39 -6692.3889 2 101011 79469.61 21541.3860 3 7176 31106.78 -23930.7778 4 96560 108203.92 -11643.9231 5 175824 161647.45 14176.5455 6 341570 161647.45 179922.5455 7 103597 79469.61 24127.3860 8 112611 108203.92 4407.0769 9 85574 108337.39 -22763.3889 10 220801 161647.45 59153.5455 11 92661 108337.39 -15676.3889 12 133328 161647.45 -28319.4545 13 61361 79469.61 -18108.6140 14 125930 108337.39 17592.6111 15 82316 79469.61 2846.3860 16 102010 79469.61 22540.3860 17 101523 161647.45 -60124.4545 18 41566 31106.78 10459.2222 19 99923 108203.92 -8280.9231 20 22648 58079.04 -35431.0400 21 46698 58079.04 -11381.0400 22 131698 161647.45 -29949.4545 23 91735 58079.04 33655.9600 24 79863 108337.39 -28474.3889 25 108043 108203.92 -160.9231 26 98866 108337.39 -9471.3889 27 120445 108337.39 12107.6111 28 116048 108203.92 7844.0769 29 250047 161647.45 88399.5455 30 136084 108337.39 27746.6111 31 92499 79469.61 13029.3860 32 135781 108203.92 27577.0769 33 74408 79469.61 -5061.6140 34 81240 161647.45 -80407.4545 35 133368 79469.61 53898.3860 36 79619 108203.92 -28584.9231 37 59194 58079.04 1114.9600 38 139942 161647.45 -21705.4545 39 118612 108203.92 10408.0769 40 72880 58079.04 14800.9600 41 65475 58079.04 7395.9600 42 99643 79469.61 20173.3860 43 71965 79469.61 -7504.6140 44 77272 79469.61 -2197.6140 45 49289 58079.04 -8790.0400 46 135131 108337.39 26793.6111 47 108446 108337.39 108.6111 48 89746 108337.39 -18591.3889 49 44296 58079.04 -13783.0400 50 77648 79469.61 -1821.6140 51 181528 108337.39 73190.6111 52 134019 79469.61 54549.3860 53 124064 108203.92 15860.0769 54 92630 79469.61 13160.3860 55 121848 79469.61 42378.3860 56 52915 79469.61 -26554.6140 57 81872 79469.61 2402.3860 58 58981 58079.04 901.9600 59 53515 58079.04 -4564.0400 60 60812 79469.61 -18657.6140 61 56375 58079.04 -1704.0400 62 65490 79469.61 -13979.6140 63 80949 58079.04 22869.9600 64 76302 79469.61 -3167.6140 65 104011 79469.61 24541.3860 66 98104 108203.92 -10099.9231 67 67989 79469.61 -11480.6140 68 30989 58079.04 -27090.0400 69 135458 108203.92 27254.0769 70 73504 79469.61 -5965.6140 71 63123 79469.61 -16346.6140 72 61254 108337.39 -47083.3889 73 74914 79469.61 -4555.6140 74 31774 58079.04 -26305.0400 75 81437 79469.61 1967.3860 76 87186 79469.61 7716.3860 77 50090 58079.04 -7989.0400 78 65745 108337.39 -42592.3889 79 56653 79469.61 -22816.6140 80 158399 79469.61 78929.3860 81 46455 79469.61 -33014.6140 82 73624 108337.39 -34713.3889 83 38395 58079.04 -19684.0400 84 91899 79469.61 12429.3860 85 139526 108337.39 31188.6111 86 52164 79469.61 -27305.6140 87 51567 79469.61 -27902.6140 88 70551 79469.61 -8918.6140 89 84856 79469.61 5386.3860 90 102538 161647.45 -59109.4545 91 86678 58079.04 28598.9600 92 85709 79469.61 6239.3860 93 34662 79469.61 -44807.6140 94 150580 108337.39 42242.6111 95 99611 161647.45 -62036.4545 96 19349 31106.78 -11757.7778 97 99373 58079.04 41293.9600 98 86230 79469.61 6760.3860 99 30837 31106.78 -269.7778 100 31706 79469.61 -47763.6140 101 89806 79469.61 10336.3860 102 62088 58079.04 4008.9600 103 40151 31106.78 9044.2222 104 27634 58079.04 -30445.0400 105 76990 108203.92 -31213.9231 106 37460 31106.78 6353.2222 107 54157 79469.61 -25312.6140 108 49862 79469.61 -29607.6140 109 84337 79469.61 4867.3860 110 64175 79469.61 -15294.6140 111 59382 79469.61 -20087.6140 112 119308 79469.61 39838.3860 113 76702 79469.61 -2767.6140 114 103425 108337.39 -4912.3889 115 70344 79469.61 -9125.6140 116 43410 31106.78 12303.2222 117 104838 108203.92 -3365.9231 118 62215 79469.61 -17254.6140 119 69304 79469.61 -10165.6140 120 53117 58079.04 -4962.0400 121 19764 31106.78 -11342.7778 122 86680 79469.61 7210.3860 123 84105 79469.61 4635.3860 124 77945 79469.61 -1524.6140 125 89113 79469.61 9643.3860 126 91005 79469.61 11535.3860 127 40248 31106.78 9141.2222 128 64187 58079.04 6107.9600 129 50857 58079.04 -7222.0400 130 56613 58079.04 -1466.0400 131 62792 79469.61 -16677.6140 132 72535 79469.61 -6934.6140 133 98146 58079.04 40066.9600 > if (par2 != 'none') { + print(cbind(as.factor(x[,par1]),predict(m))) + myt <- table(as.factor(x[,par1]),predict(m)) + print(myt) + } > postscript(file="/var/www/rcomp/tmp/4aso61324132722.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/www/rcomp/tmp/5opcc1324132722.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/www/rcomp/tmp/689sv1324132722.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/www/rcomp/tmp/77z7u1324132722.tab") + } > > try(system("convert tmp/26jkv1324132722.ps tmp/26jkv1324132722.png",intern=TRUE)) character(0) > try(system("convert tmp/3h8531324132722.ps tmp/3h8531324132722.png",intern=TRUE)) character(0) > try(system("convert tmp/4aso61324132722.ps tmp/4aso61324132722.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.520 0.090 2.603