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(158147 + ,1760 + ,89 + ,48 + ,18 + ,20465 + ,182462 + ,1609 + ,56 + ,52 + ,20 + ,33629 + ,7215 + ,192 + ,18 + ,0 + ,0 + ,1423 + ,122259 + ,2182 + ,92 + ,49 + ,26 + ,25629 + ,222405 + ,3367 + ,131 + ,76 + ,31 + ,54002 + ,485890 + ,6658 + ,253 + ,124 + ,36 + ,151036 + ,150777 + ,1548 + ,54 + ,42 + ,23 + ,33287 + ,160529 + ,1507 + ,56 + ,68 + ,30 + ,31172 + ,133238 + ,1682 + ,42 + ,52 + ,30 + ,28113 + ,275326 + ,2811 + ,91 + ,67 + ,26 + ,57803 + ,121821 + ,1943 + ,74 + ,50 + ,24 + ,49830 + ,172489 + ,2017 + ,66 + ,71 + ,30 + ,52143 + ,89942 + ,1702 + ,96 + ,41 + ,21 + ,21055 + ,208851 + ,3034 + ,110 + ,79 + ,25 + ,47007 + ,151886 + ,1379 + ,55 + ,49 + ,18 + ,28735 + ,145427 + ,1517 + ,79 + ,54 + ,19 + ,59147 + ,134153 + ,1637 + ,53 + ,75 + ,33 + ,78950 + ,64149 + ,1077 + ,53 + ,0 + ,15 + ,13497 + ,122417 + ,2384 + ,84 + ,54 + ,34 + ,46154 + ,27997 + ,726 + ,24 + ,13 + ,18 + ,53249 + ,65004 + ,993 + ,55 + ,17 + ,15 + ,10726 + ,205417 + ,2446 + ,91 + ,83 + ,27 + ,83700 + ,188103 + ,1713 + ,70 + ,37 + ,25 + ,40400 + ,118698 + ,2027 + ,50 + ,44 + ,34 + ,33797 + ,143682 + ,1818 + ,81 + ,50 + ,21 + ,36205 + ,140172 + ,1393 + ,28 + ,39 + ,21 + ,30165 + ,186377 + ,2000 + ,154 + ,59 + ,25 + ,58534 + ,174870 + ,1346 + ,85 + ,79 + ,31 + ,44663 + ,317699 + ,2522 + ,114 + ,55 + ,30 + ,92556 + ,192335 + ,2106 + ,43 + ,52 + ,20 + ,40078 + ,151621 + ,1515 + ,42 + ,50 + ,28 + ,34711 + ,167466 + ,1519 + ,43 + ,54 + ,20 + ,31076 + ,125909 + ,2165 + ,100 + ,53 + ,17 + ,74608 + ,221896 + ,2959 + ,120 + ,76 + ,25 + ,58092 + ,217447 + ,2364 + ,52 + ,60 + ,24 + ,42009 + ,0 + ,1 + ,1 + ,0 + ,0 + ,0 + ,207163 + ,2009 + ,59 + ,53 + ,27 + ,36022 + ,93107 + ,1564 + ,50 + ,44 + ,14 + ,23333 + ,133763 + ,2072 + ,47 + ,36 + ,32 + ,53349 + ,246427 + ,2106 + ,63 + ,83 + ,31 + ,92596 + ,224097 + ,2270 + ,69 + ,100 + ,21 + ,49598 + ,142057 + ,1643 + ,56 + ,37 + ,34 + ,44093 + ,94332 + ,957 + ,29 + ,25 + ,23 + ,84205 + ,171724 + ,2025 + ,77 + ,59 + ,24 + ,63369 + ,101683 + ,1115 + ,45 + ,44 + ,26 + ,60132 + ,156753 + ,1176 + ,90 + ,41 + ,22 + ,37403 + ,81293 + ,744 + ,31 + ,23 + ,35 + ,24460 + ,201984 + ,1974 + ,91 + ,63 + ,21 + ,46456 + ,219875 + ,2224 + ,85 + ,54 + ,31 + ,66616 + ,156589 + ,2561 + ,56 + ,67 + ,26 + ,41554 + ,48188 + ,658 + ,28 + ,12 + ,22 + ,22346 + ,138146 + ,1716 + ,64 + ,82 + ,21 + ,30874 + ,279590 + ,2355 + ,71 + ,64 + ,27 + ,68701 + ,234829 + ,2017 + ,77 + ,56 + ,30 + ,35728 + ,181731 + ,1686 + ,57 + ,54 + ,33 + ,29010 + ,141014 + ,1675 + ,54 + ,35 + ,11 + ,23110 + ,189220 + ,1760 + ,62 + ,52 + ,26 + ,38844 + ,76419 + ,875 + ,23 + ,25 + ,26 + ,27084 + ,151898 + ,1169 + ,65 + ,67 + ,23 + ,35139 + ,189402 + ,2789 + ,93 + ,36 + ,38 + ,57476 + ,140189 + ,1606 + ,56 + ,50 + ,29 + ,33277 + ,123181 + ,1986 + ,75 + ,48 + ,19 + ,31141 + ,124234 + ,1300 + ,58 + ,46 + ,19 + ,61281 + ,107277 + ,1176 + ,34 + ,53 + ,24 + ,25820 + ,153813 + ,1215 + ,32 + ,27 + ,26 + ,23284 + ,94982 + ,1230 + ,38 + ,38 + ,29 + ,35378 + ,178613 + ,2226 + ,67 + ,68 + ,36 + ,74990 + ,138708 + ,2897 + ,65 + ,93 + ,25 + ,29653 + ,102378 + ,1008 + ,37 + ,48 + ,24 + ,64622 + ,31970 + ,340 + ,15 + ,5 + ,21 + ,4157 + ,211635 + ,2704 + ,110 + ,53 + ,19 + ,29245 + ,111885 + ,1209 + ,63 + ,36 + ,12 + ,50008 + ,99687 + ,1290 + ,63 + ,62 + ,30 + ,52338 + ,102900 + ,1535 + ,68 + ,46 + ,21 + ,13310 + ,156475 + ,2585 + ,65 + ,73 + ,34 + ,92901 + ,74513 + ,1315 + ,41 + ,2 + ,32 + ,10956 + ,159186 + ,2142 + ,57 + ,76 + ,27 + ,34241 + ,155818 + ,2513 + ,94 + ,71 + ,28 + ,75043 + ,60138 + ,817 + ,24 + ,16 + ,21 + ,21152 + ,84971 + ,1234 + ,71 + ,34 + ,31 + ,42249 + ,80478 + ,917 + ,66 + ,54 + ,26 + ,42005 + ,244325 + ,1924 + ,59 + ,39 + ,29 + ,41152 + ,56486 + ,853 + ,27 + ,26 + ,23 + ,14399 + ,110743 + ,1398 + ,34 + ,40 + ,25 + ,28263 + ,75092 + ,986 + ,44 + ,35 + ,22 + ,17215 + ,148286 + ,1608 + ,47 + ,32 + ,26 + ,48140 + ,222914 + ,2576 + ,219 + ,55 + ,33 + ,62897 + ,115019 + ,1201 + ,108 + ,58 + ,24 + ,22883 + ,93083 + ,1189 + ,56 + ,39 + ,24 + ,41622 + ,143258 + ,1383 + ,49 + ,33 + ,21 + ,40715 + ,117794 + ,1563 + ,39 + ,45 + ,28 + ,65897 + ,158586 + ,2185 + ,74 + ,72 + ,27 + ,76542 + ,151465 + ,1228 + ,56 + ,39 + ,25 + ,37477 + ,124626 + ,1266 + ,58 + ,27 + ,15 + ,53216 + ,51801 + ,830 + ,36 + ,22 + ,13 + ,40911 + ,223020 + ,2217 + ,110 + ,47 + ,36 + ,57021 + ,188957 + ,1787 + ,68 + ,95 + ,24 + ,73116 + ,19349 + ,223 + ,12 + ,13 + ,1 + ,3895 + ,188069 + ,2170 + ,99 + ,27 + ,24 + ,46609 + ,150561 + ,1927 + ,74 + ,40 + ,31 + ,29351 + ,53921 + ,665 + ,28 + ,22 + ,4 + ,2325 + ,58280 + ,804 + ,22 + ,41 + ,20 + ,31747 + ,124951 + ,1211 + ,49 + ,55 + ,23 + ,32665 + ,112263 + ,1143 + ,57 + ,28 + ,23 + ,19249 + ,72904 + ,710 + ,38 + ,30 + ,12 + ,15292 + ,27676 + ,596 + ,22 + ,2 + ,16 + ,5842 + ,131274 + ,1353 + ,44 + ,79 + ,29 + ,33994 + ,117451 + ,971 + ,32 + ,18 + ,10 + ,13018 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,85610 + ,1030 + ,31 + ,46 + ,25 + ,98177 + ,107175 + ,1130 + ,66 + ,25 + ,21 + ,37941 + ,133024 + ,1284 + ,44 + ,50 + ,23 + ,31032 + ,136473 + ,1438 + ,61 + ,59 + ,21 + ,32683 + ,71894 + ,849 + ,57 + ,36 + ,21 + ,34545 + ,3616 + ,78 + ,5 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,154806 + ,925 + ,39 + ,35 + ,23 + ,27525 + ,137977 + ,1518 + ,78 + ,68 + ,29 + ,66856 + ,149846 + ,1946 + ,95 + ,26 + ,28 + ,28549 + ,113245 + ,914 + ,37 + ,36 + ,23 + ,38610 + ,43410 + ,778 + ,19 + ,7 + ,1 + ,2781 + ,170330 + ,1713 + ,71 + ,67 + ,29 + ,41211 + ,89410 + ,895 + ,40 + ,30 + ,17 + ,22698 + ,112749 + ,1756 + ,52 + ,55 + ,29 + ,41194 + ,60373 + ,701 + ,40 + ,3 + ,12 + ,32689 + ,19764 + ,285 + ,12 + ,10 + ,2 + ,5752 + ,160995 + ,1774 + ,55 + ,46 + ,21 + ,26757 + ,121052 + ,1021 + ,28 + ,26 + ,25 + ,22527 + ,150039 + ,1582 + ,46 + ,49 + ,29 + ,44810 + ,11796 + ,256 + ,9 + ,1 + ,2 + ,0 + ,10674 + ,98 + ,9 + ,0 + ,0 + ,0 + ,134836 + ,1358 + ,55 + ,33 + ,18 + ,100674 + ,6836 + ,41 + ,3 + ,0 + ,1 + ,0 + ,153278 + ,1770 + ,57 + ,48 + ,21 + ,57786 + ,5118 + ,42 + ,3 + ,5 + ,0 + ,0 + ,40248 + ,528 + ,16 + ,8 + ,4 + ,5444 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,117842 + ,1026 + ,45 + ,35 + ,25 + ,28470 + ,87635 + ,1296 + ,38 + ,21 + ,26 + ,61849 + ,7131 + ,81 + ,4 + ,0 + ,0 + ,0 + ,8812 + ,257 + ,13 + ,0 + ,4 + ,2179 + ,68916 + ,914 + ,23 + ,15 + ,17 + ,8019 + ,132686 + ,1178 + ,50 + ,50 + ,21 + ,39644 + ,94127 + ,1080 + ,19 + ,17 + ,22 + ,23494) + ,dim=c(6 + ,144) + ,dimnames=list(c('time' + ,'pageviews' + ,'logins' + ,'BC' + ,'review' + ,'char') + ,1:144)) > y <- array(NA,dim=c(6,144),dimnames=list(c('time','pageviews','logins','BC','review','char'),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 = '2' > par2 = 'hclust' > 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] "time" > x[,par1] [1] 158147 182462 7215 122259 222405 485890 150777 160529 133238 275326 [11] 121821 172489 89942 208851 151886 145427 134153 64149 122417 27997 [21] 65004 205417 188103 118698 143682 140172 186377 174870 317699 192335 [31] 151621 167466 125909 221896 217447 0 207163 93107 133763 246427 [41] 224097 142057 94332 171724 101683 156753 81293 201984 219875 156589 [51] 48188 138146 279590 234829 181731 141014 189220 76419 151898 189402 [61] 140189 123181 124234 107277 153813 94982 178613 138708 102378 31970 [71] 211635 111885 99687 102900 156475 74513 159186 155818 60138 84971 [81] 80478 244325 56486 110743 75092 148286 222914 115019 93083 143258 [91] 117794 158586 151465 124626 51801 223020 188957 19349 188069 150561 [101] 53921 58280 124951 112263 72904 27676 131274 117451 0 85610 [111] 107175 133024 136473 71894 3616 0 154806 137977 149846 113245 [121] 43410 170330 89410 112749 60373 19764 160995 121052 150039 11796 [131] 10674 134836 6836 153278 5118 40248 0 117842 87635 7131 [141] 8812 68916 132686 94127 > 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 + } Call: hclust(d = dist(x[, par1])^2, method = "cen") Cluster method : centroid Distance : euclidean Number of objects: 144 [1] C1 C1 C1 C1 C1 C2 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 [26] C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 [51] C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 [76] C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 [101] C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 [126] C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 Levels: C1 C2 > if (par2=='equal') { + ed <- cut(as.numeric(x[,par1]),par3,labels=paste('C',1:par3,sep='')) + x[,par1] <- as.factor(ed) + } > table(x[,par1]) C1 C2 143 1 > colnames(x) [1] "time" "pageviews" "logins" "BC" "review" "char" > colnames(x)[par1] [1] "time" > x[,par1] [1] C1 C1 C1 C1 C1 C2 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 [26] C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 [51] C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 [76] C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 [101] C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 [126] C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 Levels: C1 C2 > 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/1hytx1324477837.tab") + } + } > m Conditional inference tree with 2 terminal nodes Response: as.factor(time) Inputs: pageviews, logins, BC, review, char Number of observations: 144 1) pageviews <= 2704; criterion = 1, statistic = 37.904 2)* weights = 137 1) pageviews > 2704 3)* weights = 7 > postscript(file="/var/wessaorg/rcomp/tmp/2bbao1324477837.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/3uhw01324477837.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,] 1 1 [2,] 1 1 [3,] 1 1 [4,] 1 1 [5,] 1 1 [6,] 2 1 [7,] 1 1 [8,] 1 1 [9,] 1 1 [10,] 1 1 [11,] 1 1 [12,] 1 1 [13,] 1 1 [14,] 1 1 [15,] 1 1 [16,] 1 1 [17,] 1 1 [18,] 1 1 [19,] 1 1 [20,] 1 1 [21,] 1 1 [22,] 1 1 [23,] 1 1 [24,] 1 1 [25,] 1 1 [26,] 1 1 [27,] 1 1 [28,] 1 1 [29,] 1 1 [30,] 1 1 [31,] 1 1 [32,] 1 1 [33,] 1 1 [34,] 1 1 [35,] 1 1 [36,] 1 1 [37,] 1 1 [38,] 1 1 [39,] 1 1 [40,] 1 1 [41,] 1 1 [42,] 1 1 [43,] 1 1 [44,] 1 1 [45,] 1 1 [46,] 1 1 [47,] 1 1 [48,] 1 1 [49,] 1 1 [50,] 1 1 [51,] 1 1 [52,] 1 1 [53,] 1 1 [54,] 1 1 [55,] 1 1 [56,] 1 1 [57,] 1 1 [58,] 1 1 [59,] 1 1 [60,] 1 1 [61,] 1 1 [62,] 1 1 [63,] 1 1 [64,] 1 1 [65,] 1 1 [66,] 1 1 [67,] 1 1 [68,] 1 1 [69,] 1 1 [70,] 1 1 [71,] 1 1 [72,] 1 1 [73,] 1 1 [74,] 1 1 [75,] 1 1 [76,] 1 1 [77,] 1 1 [78,] 1 1 [79,] 1 1 [80,] 1 1 [81,] 1 1 [82,] 1 1 [83,] 1 1 [84,] 1 1 [85,] 1 1 [86,] 1 1 [87,] 1 1 [88,] 1 1 [89,] 1 1 [90,] 1 1 [91,] 1 1 [92,] 1 1 [93,] 1 1 [94,] 1 1 [95,] 1 1 [96,] 1 1 [97,] 1 1 [98,] 1 1 [99,] 1 1 [100,] 1 1 [101,] 1 1 [102,] 1 1 [103,] 1 1 [104,] 1 1 [105,] 1 1 [106,] 1 1 [107,] 1 1 [108,] 1 1 [109,] 1 1 [110,] 1 1 [111,] 1 1 [112,] 1 1 [113,] 1 1 [114,] 1 1 [115,] 1 1 [116,] 1 1 [117,] 1 1 [118,] 1 1 [119,] 1 1 [120,] 1 1 [121,] 1 1 [122,] 1 1 [123,] 1 1 [124,] 1 1 [125,] 1 1 [126,] 1 1 [127,] 1 1 [128,] 1 1 [129,] 1 1 [130,] 1 1 [131,] 1 1 [132,] 1 1 [133,] 1 1 [134,] 1 1 [135,] 1 1 [136,] 1 1 [137,] 1 1 [138,] 1 1 [139,] 1 1 [140,] 1 1 [141,] 1 1 [142,] 1 1 [143,] 1 1 [144,] 1 1 C1 C2 C1 143 0 C2 1 0 > postscript(file="/var/wessaorg/rcomp/tmp/4pp111324477837.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/5zb261324477837.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/61tjg1324477837.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/7izwk1324477837.tab") + } > > try(system("convert tmp/2bbao1324477837.ps tmp/2bbao1324477837.png",intern=TRUE)) character(0) > try(system("convert tmp/3uhw01324477837.ps tmp/3uhw01324477837.png",intern=TRUE)) character(0) > try(system("convert tmp/4pp111324477837.ps tmp/4pp111324477837.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.708 0.290 3.000