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(48 + ,21 + ,20465 + ,162687 + ,75 + ,24 + ,33629 + ,233285 + ,0 + ,0 + ,1423 + ,7215 + ,79 + ,32 + ,25629 + ,178420 + ,92 + ,33 + ,54002 + ,284907 + ,137 + ,36 + ,151036 + ,547440 + ,65 + ,26 + ,33287 + ,192501 + ,97 + ,35 + ,31172 + ,213538 + ,62 + ,34 + ,28113 + ,182371 + ,72 + ,27 + ,57803 + ,336547 + ,50 + ,28 + ,49830 + ,130487 + ,88 + ,30 + ,52143 + ,203938 + ,83 + ,22 + ,21055 + ,124103 + ,79 + ,28 + ,47007 + ,220796 + ,56 + ,18 + ,28735 + ,174005 + ,54 + ,22 + ,59147 + ,156326 + ,101 + ,37 + ,78950 + ,164063 + ,13 + ,15 + ,13497 + ,90025 + ,80 + ,34 + ,46154 + ,179987 + ,19 + ,18 + ,53249 + ,47066 + ,34 + ,15 + ,10726 + ,111065 + ,99 + ,30 + ,83700 + ,241285 + ,38 + ,25 + ,40400 + ,208339 + ,68 + ,35 + ,33797 + ,164166 + ,54 + ,21 + ,36205 + ,159763 + ,63 + ,21 + ,30165 + ,207078 + ,66 + ,25 + ,58534 + ,220200 + ,90 + ,31 + ,44663 + ,201536 + ,75 + ,31 + ,92556 + ,408960 + ,68 + ,25 + ,40078 + ,250260 + ,69 + ,33 + ,34711 + ,216536 + ,80 + ,22 + ,31076 + ,212949 + ,59 + ,20 + ,74608 + ,166556 + ,135 + ,30 + ,58092 + ,278911 + ,75 + ,26 + ,42009 + ,240943 + ,0 + ,0 + ,0 + ,0 + ,54 + ,31 + ,36022 + ,233971 + ,62 + ,14 + ,23333 + ,149649 + ,46 + ,35 + ,53349 + ,161703 + ,83 + ,34 + ,92596 + ,254893 + ,106 + ,22 + ,49598 + ,269492 + ,51 + ,34 + ,44093 + ,169526 + ,27 + ,23 + ,84205 + ,107893 + ,78 + ,24 + ,63369 + ,229714 + ,71 + ,26 + ,60132 + ,139667 + ,44 + ,25 + ,37403 + ,178553 + ,23 + ,35 + ,24460 + ,81407 + ,78 + ,24 + ,46456 + ,251392 + ,60 + ,31 + ,66616 + ,239807 + ,73 + ,30 + ,41554 + ,172743 + ,12 + ,22 + ,22346 + ,48188 + ,104 + ,23 + ,30874 + ,169355 + ,95 + ,27 + ,68701 + ,335398 + ,57 + ,30 + ,35728 + ,244729 + ,68 + ,34 + ,29010 + ,208286 + ,44 + ,12 + ,23110 + ,159913 + ,62 + ,26 + ,38844 + ,232137 + ,26 + ,29 + ,27084 + ,116156 + ,67 + ,23 + ,35139 + ,157258 + ,36 + ,38 + ,57476 + ,211586 + ,56 + ,32 + ,33277 + ,181076 + ,55 + ,22 + ,31141 + ,158024 + ,54 + ,22 + ,61281 + ,141491 + ,61 + ,26 + ,25820 + ,130108 + ,27 + ,28 + ,23284 + ,166420 + ,64 + ,33 + ,35378 + ,135509 + ,76 + ,36 + ,74990 + ,195043 + ,93 + ,25 + ,29653 + ,138708 + ,59 + ,25 + ,64622 + ,116552 + ,5 + ,21 + ,4157 + ,31970 + ,62 + ,23 + ,29245 + ,291993 + ,47 + ,14 + ,50008 + ,167825 + ,88 + ,30 + ,52338 + ,135926 + ,62 + ,24 + ,13310 + ,141464 + ,81 + ,39 + ,92901 + ,171518 + ,35 + ,37 + ,10956 + ,112714 + ,102 + ,28 + ,34241 + ,183471 + ,73 + ,31 + ,75043 + ,167426 + ,32 + ,21 + ,21152 + ,112510 + ,34 + ,33 + ,42249 + ,92421 + ,80 + ,29 + ,42005 + ,117175 + ,49 + ,29 + ,41152 + ,304603 + ,36 + ,24 + ,14399 + ,110631 + ,77 + ,29 + ,28263 + ,167192 + ,54 + ,22 + ,17215 + ,95827 + ,38 + ,26 + ,48140 + ,173931 + ,63 + ,33 + ,62897 + ,250424 + ,58 + ,24 + ,22883 + ,115367 + ,49 + ,24 + ,41622 + ,125839 + ,46 + ,21 + ,40715 + ,164078 + ,51 + ,28 + ,65897 + ,158931 + ,90 + ,28 + ,76542 + ,190382 + ,45 + ,25 + ,37477 + ,155226 + ,28 + ,15 + ,53216 + ,146159 + ,26 + ,13 + ,40911 + ,62641 + ,54 + ,36 + ,57021 + ,258585 + ,96 + ,27 + ,73116 + ,199841 + ,13 + ,1 + ,3895 + ,19349 + ,43 + ,24 + ,46609 + ,247280 + ,46 + ,31 + ,29351 + ,173152 + ,30 + ,4 + ,2325 + ,72128 + ,59 + ,21 + ,31747 + ,104253 + ,73 + ,27 + ,32665 + ,151090 + ,40 + ,26 + ,19249 + ,147990 + ,36 + ,12 + ,15292 + ,87448 + ,2 + ,16 + ,5842 + ,27676 + ,103 + ,29 + ,33994 + ,170326 + ,30 + ,26 + ,13018 + ,132148 + ,0 + ,0 + ,0 + ,0 + ,78 + ,25 + ,98177 + ,133868 + ,25 + ,21 + ,37941 + ,109001 + ,59 + ,24 + ,31032 + ,158833 + ,60 + ,21 + ,32683 + ,150013 + ,54 + ,21 + ,34545 + ,102573 + ,0 + ,0 + ,0 + ,3616 + ,0 + ,0 + ,0 + ,0 + ,51 + ,26 + ,27525 + ,216535 + ,79 + ,33 + ,66856 + ,177323 + ,30 + ,32 + ,28549 + ,177948 + ,43 + ,25 + ,38610 + ,140106 + ,7 + ,1 + ,2781 + ,43410 + ,92 + ,29 + ,41211 + ,206059 + ,32 + ,20 + ,22698 + ,109873 + ,84 + ,34 + ,41194 + ,157084 + ,3 + ,12 + ,32689 + ,60493 + ,10 + ,2 + ,5752 + ,19764 + ,47 + ,21 + ,26757 + ,177559 + ,44 + ,28 + ,22527 + ,154169 + ,54 + ,35 + ,44810 + ,164249 + ,1 + ,2 + ,0 + ,11796 + ,0 + ,0 + ,0 + ,10674 + ,46 + ,18 + ,100674 + ,151322 + ,0 + ,1 + ,0 + ,6836 + ,51 + ,21 + ,57786 + ,174712 + ,5 + ,0 + ,0 + ,5118 + ,8 + ,4 + ,5444 + ,40248 + ,0 + ,0 + ,0 + ,0 + ,38 + ,29 + ,28470 + ,127628 + ,21 + ,26 + ,61849 + ,88837 + ,0 + ,0 + ,0 + ,7131 + ,0 + ,4 + ,2179 + ,9056 + ,26 + ,19 + ,8019 + ,97191 + ,53 + ,25 + ,39644 + ,157579 + ,31 + ,22 + ,23494 + ,125593) + ,dim=c(4 + ,144) + ,dimnames=list(c('Blog' + ,'PR' + ,'Characters' + ,'Time') + ,1:144)) > y <- array(NA,dim=c(4,144),dimnames=list(c('Blog','PR','Characters','Time'),1:144)) > 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] "Blog" > x[,par1] [1] 48 75 0 79 92 137 65 97 62 72 50 88 83 79 56 54 101 13 [19] 80 19 34 99 38 68 54 63 66 90 75 68 69 80 59 135 75 0 [37] 54 62 46 83 106 51 27 78 71 44 23 78 60 73 12 104 95 57 [55] 68 44 62 26 67 36 56 55 54 61 27 64 76 93 59 5 62 47 [73] 88 62 81 35 102 73 32 34 80 49 36 77 54 38 63 58 49 46 [91] 51 90 45 28 26 54 96 13 43 46 30 59 73 40 36 2 103 30 [109] 0 78 25 59 60 54 0 0 51 79 30 43 7 92 32 84 3 10 [127] 47 44 54 1 0 46 0 51 5 8 0 38 21 0 0 26 53 31 > 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 2 3 5 7 8 10 12 13 19 21 23 25 26 27 28 30 31 32 10 1 1 1 2 1 1 1 1 2 1 1 1 1 3 2 1 3 1 2 34 35 36 38 40 43 44 45 46 47 48 49 50 51 53 54 55 56 57 58 2 1 3 3 1 2 3 1 4 2 1 2 1 4 1 8 1 2 1 1 59 60 61 62 63 64 65 66 67 68 69 71 72 73 75 76 77 78 79 80 4 2 1 5 2 1 1 1 1 3 1 1 1 3 3 1 1 3 3 3 81 83 84 88 90 92 93 95 96 97 99 101 102 103 104 106 135 137 1 2 1 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 > colnames(x) [1] "Blog" "PR" "Characters" "Time" > colnames(x)[par1] [1] "Blog" > x[,par1] [1] 48 75 0 79 92 137 65 97 62 72 50 88 83 79 56 54 101 13 [19] 80 19 34 99 38 68 54 63 66 90 75 68 69 80 59 135 75 0 [37] 54 62 46 83 106 51 27 78 71 44 23 78 60 73 12 104 95 57 [55] 68 44 62 26 67 36 56 55 54 61 27 64 76 93 59 5 62 47 [73] 88 62 81 35 102 73 32 34 80 49 36 77 54 38 63 58 49 46 [91] 51 90 45 28 26 54 96 13 43 46 30 59 73 40 36 2 103 30 [109] 0 78 25 59 60 54 0 0 51 79 30 43 7 92 32 84 3 10 [127] 47 44 54 1 0 46 0 51 5 8 0 38 21 0 0 26 53 31 > 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/1al6w1324658615.tab") + } + } > m Conditional inference tree with 7 terminal nodes Response: Blog Inputs: PR, Characters, Time Number of observations: 144 1) Time <= 112714; criterion = 1, statistic = 83.244 2) Time <= 60493; criterion = 1, statistic = 28.391 3) Characters <= 2179; criterion = 0.994, statistic = 9.402 4)* weights = 12 3) Characters > 2179 5)* weights = 9 2) Time > 60493 6)* weights = 18 1) Time > 112714 7) Time <= 182371; criterion = 1, statistic = 19.874 8) PR <= 28; criterion = 0.965, statistic = 6.33 9)* weights = 41 8) PR > 28 10)* weights = 23 7) Time > 182371 11) Characters <= 66616; criterion = 0.992, statistic = 8.968 12)* weights = 33 11) Characters > 66616 13)* weights = 8 > postscript(file="/var/wessaorg/rcomp/tmp/2dm3z1324658615.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/3ymg61324658615.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 48 54.243902 -6.2439024 2 75 71.727273 3.2727273 3 0 0.500000 -0.5000000 4 79 66.913043 12.0869565 5 92 71.727273 20.2727273 6 137 93.875000 43.1250000 7 65 71.727273 -6.7272727 8 97 71.727273 25.2727273 9 62 66.913043 -4.9130435 10 72 71.727273 0.2727273 11 50 54.243902 -4.2439024 12 88 71.727273 16.2727273 13 83 54.243902 28.7560976 14 79 71.727273 7.2727273 15 56 54.243902 1.7560976 16 54 54.243902 -0.2439024 17 101 66.913043 34.0869565 18 13 33.166667 -20.1666667 19 80 66.913043 13.0869565 20 19 8.777778 10.2222222 21 34 33.166667 0.8333333 22 99 93.875000 5.1250000 23 38 71.727273 -33.7272727 24 68 66.913043 1.0869565 25 54 54.243902 -0.2439024 26 63 71.727273 -8.7272727 27 66 71.727273 -5.7272727 28 90 71.727273 18.2727273 29 75 93.875000 -18.8750000 30 68 71.727273 -3.7272727 31 69 71.727273 -2.7272727 32 80 71.727273 8.2727273 33 59 54.243902 4.7560976 34 135 71.727273 63.2727273 35 75 71.727273 3.2727273 36 0 0.500000 -0.5000000 37 54 71.727273 -17.7272727 38 62 54.243902 7.7560976 39 46 66.913043 -20.9130435 40 83 93.875000 -10.8750000 41 106 71.727273 34.2727273 42 51 66.913043 -15.9130435 43 27 33.166667 -6.1666667 44 78 71.727273 6.2727273 45 71 54.243902 16.7560976 46 44 54.243902 -10.2439024 47 23 33.166667 -10.1666667 48 78 71.727273 6.2727273 49 60 71.727273 -11.7272727 50 73 66.913043 6.0869565 51 12 8.777778 3.2222222 52 104 54.243902 49.7560976 53 95 93.875000 1.1250000 54 57 71.727273 -14.7272727 55 68 71.727273 -3.7272727 56 44 54.243902 -10.2439024 57 62 71.727273 -9.7272727 58 26 66.913043 -40.9130435 59 67 54.243902 12.7560976 60 36 71.727273 -35.7272727 61 56 66.913043 -10.9130435 62 55 54.243902 0.7560976 63 54 54.243902 -0.2439024 64 61 54.243902 6.7560976 65 27 54.243902 -27.2439024 66 64 66.913043 -2.9130435 67 76 93.875000 -17.8750000 68 93 54.243902 38.7560976 69 59 54.243902 4.7560976 70 5 8.777778 -3.7777778 71 62 71.727273 -9.7272727 72 47 54.243902 -7.2439024 73 88 66.913043 21.0869565 74 62 54.243902 7.7560976 75 81 66.913043 14.0869565 76 35 33.166667 1.8333333 77 102 71.727273 30.2727273 78 73 66.913043 6.0869565 79 32 33.166667 -1.1666667 80 34 33.166667 0.8333333 81 80 66.913043 13.0869565 82 49 71.727273 -22.7272727 83 36 33.166667 2.8333333 84 77 66.913043 10.0869565 85 54 33.166667 20.8333333 86 38 54.243902 -16.2439024 87 63 71.727273 -8.7272727 88 58 54.243902 3.7560976 89 49 54.243902 -5.2439024 90 46 54.243902 -8.2439024 91 51 54.243902 -3.2439024 92 90 93.875000 -3.8750000 93 45 54.243902 -9.2439024 94 28 54.243902 -26.2439024 95 26 33.166667 -7.1666667 96 54 71.727273 -17.7272727 97 96 93.875000 2.1250000 98 13 8.777778 4.2222222 99 43 71.727273 -28.7272727 100 46 66.913043 -20.9130435 101 30 33.166667 -3.1666667 102 59 33.166667 25.8333333 103 73 54.243902 18.7560976 104 40 54.243902 -14.2439024 105 36 33.166667 2.8333333 106 2 8.777778 -6.7777778 107 103 66.913043 36.0869565 108 30 54.243902 -24.2439024 109 0 0.500000 -0.5000000 110 78 54.243902 23.7560976 111 25 33.166667 -8.1666667 112 59 54.243902 4.7560976 113 60 54.243902 5.7560976 114 54 33.166667 20.8333333 115 0 0.500000 -0.5000000 116 0 0.500000 -0.5000000 117 51 71.727273 -20.7272727 118 79 66.913043 12.0869565 119 30 66.913043 -36.9130435 120 43 54.243902 -11.2439024 121 7 8.777778 -1.7777778 122 92 71.727273 20.2727273 123 32 33.166667 -1.1666667 124 84 66.913043 17.0869565 125 3 8.777778 -5.7777778 126 10 8.777778 1.2222222 127 47 54.243902 -7.2439024 128 44 54.243902 -10.2439024 129 54 66.913043 -12.9130435 130 1 0.500000 0.5000000 131 0 0.500000 -0.5000000 132 46 54.243902 -8.2439024 133 0 0.500000 -0.5000000 134 51 54.243902 -3.2439024 135 5 0.500000 4.5000000 136 8 8.777778 -0.7777778 137 0 0.500000 -0.5000000 138 38 66.913043 -28.9130435 139 21 33.166667 -12.1666667 140 0 0.500000 -0.5000000 141 0 0.500000 -0.5000000 142 26 33.166667 -7.1666667 143 53 54.243902 -1.2439024 144 31 54.243902 -23.2439024 > 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/4uwdv1324658615.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/5mlq61324658615.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/65yti1324658615.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/76v7a1324658615.tab") + } > > try(system("convert tmp/2dm3z1324658615.ps tmp/2dm3z1324658615.png",intern=TRUE)) character(0) > try(system("convert tmp/3ymg61324658615.ps tmp/3ymg61324658615.png",intern=TRUE)) character(0) > try(system("convert tmp/4uwdv1324658615.ps tmp/4uwdv1324658615.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.102 0.279 3.378