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(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 = '3' > par2 = 'quantiles' > 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, 65490) [65490, 96560) [96560,341570] 45 44 44 > colnames(x) [1] "Total_size" "Time_RFC" "PR_views" "Blogged" "Reviewed" > colnames(x)[par1] [1] "Time_RFC" > x[,par1] [1] [96560,341570] [96560,341570] [ 7176, 65490) [96560,341570] [96560,341570] [6] [96560,341570] [96560,341570] [96560,341570] [65490, 96560) [96560,341570] [11] [65490, 96560) [96560,341570] [ 7176, 65490) [96560,341570] [65490, 96560) [16] [96560,341570] [96560,341570] [ 7176, 65490) [96560,341570] [ 7176, 65490) [21] [ 7176, 65490) [96560,341570] [65490, 96560) [65490, 96560) [96560,341570] [26] [96560,341570] [96560,341570] [96560,341570] [96560,341570] [96560,341570] [31] [65490, 96560) [96560,341570] [65490, 96560) [65490, 96560) [96560,341570] [36] [65490, 96560) [ 7176, 65490) [96560,341570] [96560,341570] [65490, 96560) [41] [ 7176, 65490) [96560,341570] [65490, 96560) [65490, 96560) [ 7176, 65490) [46] [96560,341570] [96560,341570] [65490, 96560) [ 7176, 65490) [65490, 96560) [51] [96560,341570] [96560,341570] [96560,341570] [65490, 96560) [96560,341570] [56] [ 7176, 65490) [65490, 96560) [ 7176, 65490) [ 7176, 65490) [ 7176, 65490) [61] [ 7176, 65490) [65490, 96560) [65490, 96560) [65490, 96560) [96560,341570] [66] [96560,341570] [65490, 96560) [ 7176, 65490) [96560,341570] [65490, 96560) [71] [ 7176, 65490) [ 7176, 65490) [65490, 96560) [ 7176, 65490) [65490, 96560) [76] [65490, 96560) [ 7176, 65490) [65490, 96560) [ 7176, 65490) [96560,341570] [81] [ 7176, 65490) [65490, 96560) [ 7176, 65490) [65490, 96560) [96560,341570] [86] [ 7176, 65490) [ 7176, 65490) [65490, 96560) [65490, 96560) [96560,341570] [91] [65490, 96560) [65490, 96560) [ 7176, 65490) [96560,341570] [96560,341570] [96] [ 7176, 65490) [96560,341570] [65490, 96560) [ 7176, 65490) [ 7176, 65490) [101] [65490, 96560) [ 7176, 65490) [ 7176, 65490) [ 7176, 65490) [65490, 96560) [106] [ 7176, 65490) [ 7176, 65490) [ 7176, 65490) [65490, 96560) [ 7176, 65490) [111] [ 7176, 65490) [96560,341570] [65490, 96560) [96560,341570] [65490, 96560) [116] [ 7176, 65490) [96560,341570] [ 7176, 65490) [65490, 96560) [ 7176, 65490) [121] [ 7176, 65490) [65490, 96560) [65490, 96560) [65490, 96560) [65490, 96560) [126] [65490, 96560) [ 7176, 65490) [ 7176, 65490) [ 7176, 65490) [ 7176, 65490) [131] [ 7176, 65490) [65490, 96560) [96560,341570] Levels: [ 7176, 65490) [65490, 96560) [96560,341570] > 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/1mxja1324135260.tab") + } + } > m Conditional inference tree with 4 terminal nodes Response: as.factor(Time_RFC) Inputs: Total_size, PR_views, Blogged, Reviewed Number of observations: 133 1) Blogged <= 16; criterion = 1, statistic = 50.006 2)* weights = 34 1) Blogged > 16 3) Blogged <= 40; criterion = 1, statistic = 20.203 4) PR_views <= 65; criterion = 0.993, statistic = 12.756 5)* weights = 51 4) PR_views > 65 6)* weights = 24 3) Blogged > 40 7)* weights = 24 > postscript(file="/var/wessaorg/rcomp/tmp/2ax831324135260.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/3me7t1324135260.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) + } > if (par2 != 'none') { + print(cbind(as.factor(x[,par1]),predict(m))) + myt <- table(as.factor(x[,par1]),predict(m)) + print(myt) + } [,1] [,2] [1,] 3 3 [2,] 3 2 [3,] 1 1 [4,] 3 3 [5,] 3 3 [6,] 3 3 [7,] 3 3 [8,] 3 3 [9,] 2 3 [10,] 3 3 [11,] 2 3 [12,] 3 3 [13,] 1 2 [14,] 3 3 [15,] 2 2 [16,] 3 3 [17,] 3 3 [18,] 1 1 [19,] 3 3 [20,] 1 1 [21,] 1 1 [22,] 3 3 [23,] 2 1 [24,] 2 3 [25,] 3 3 [26,] 3 3 [27,] 3 3 [28,] 3 3 [29,] 3 3 [30,] 3 3 [31,] 2 2 [32,] 3 3 [33,] 2 2 [34,] 2 3 [35,] 3 2 [36,] 2 3 [37,] 1 1 [38,] 3 3 [39,] 3 3 [40,] 2 1 [41,] 1 1 [42,] 3 2 [43,] 2 2 [44,] 2 2 [45,] 1 1 [46,] 3 3 [47,] 3 3 [48,] 2 3 [49,] 1 1 [50,] 2 2 [51,] 3 3 [52,] 3 2 [53,] 3 3 [54,] 2 2 [55,] 3 2 [56,] 1 2 [57,] 2 2 [58,] 1 1 [59,] 1 1 [60,] 1 3 [61,] 1 1 [62,] 2 2 [63,] 2 1 [64,] 2 2 [65,] 3 3 [66,] 3 3 [67,] 2 2 [68,] 1 1 [69,] 3 3 [70,] 2 3 [71,] 1 2 [72,] 1 3 [73,] 2 2 [74,] 1 1 [75,] 2 2 [76,] 2 2 [77,] 1 1 [78,] 2 3 [79,] 1 2 [80,] 3 2 [81,] 1 2 [82,] 2 3 [83,] 1 1 [84,] 2 2 [85,] 3 3 [86,] 1 2 [87,] 1 2 [88,] 2 2 [89,] 2 2 [90,] 3 3 [91,] 2 1 [92,] 2 2 [93,] 1 2 [94,] 3 3 [95,] 3 3 [96,] 1 1 [97,] 3 1 [98,] 2 2 [99,] 1 1 [100,] 1 2 [101,] 2 2 [102,] 1 1 [103,] 1 1 [104,] 1 1 [105,] 2 3 [106,] 1 1 [107,] 1 2 [108,] 1 2 [109,] 2 2 [110,] 1 2 [111,] 1 2 [112,] 3 2 [113,] 2 2 [114,] 3 3 [115,] 2 2 [116,] 1 1 [117,] 3 3 [118,] 1 2 [119,] 2 2 [120,] 1 1 [121,] 1 1 [122,] 2 2 [123,] 2 2 [124,] 2 3 [125,] 2 2 [126,] 2 2 [127,] 1 1 [128,] 1 1 [129,] 1 1 [130,] 1 1 [131,] 1 2 [132,] 2 2 [133,] 3 1 [ 7176, 65490) [65490, 96560) [96560,341570] [ 7176, 65490) 28 15 2 [65490, 96560) 4 29 11 [96560,341570] 2 7 35 > postscript(file="/var/wessaorg/rcomp/tmp/4tlyi1324135260.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/5xt991324135260.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/6820x1324135260.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/7qcgq1324135260.tab") + } > > try(system("convert tmp/2ax831324135260.ps tmp/2ax831324135260.png",intern=TRUE)) character(0) > try(system("convert tmp/3me7t1324135260.ps tmp/3me7t1324135260.png",intern=TRUE)) character(0) > try(system("convert tmp/4tlyi1324135260.ps tmp/4tlyi1324135260.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.617 0.255 2.887