R version 2.12.1 (2010-12-16) 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(1655 + ,264530 + ,64 + ,461 + ,85 + ,3 + ,954 + ,135248 + ,59 + ,331 + ,58 + ,4 + ,1740 + ,207253 + ,64 + ,639 + ,57 + ,14 + ,2405 + ,197987 + ,96 + ,1061 + ,132 + ,2 + ,1025 + ,143105 + ,46 + ,310 + ,44 + ,1 + ,577 + ,65295 + ,27 + ,164 + ,42 + ,3 + ,3916 + ,439387 + ,103 + ,1912 + ,94 + ,0 + ,381 + ,33186 + ,19 + ,111 + ,46 + ,0 + ,1817 + ,183696 + ,51 + ,703 + ,71 + ,5 + ,1607 + ,186657 + ,39 + ,556 + ,65 + ,0 + ,1941 + ,276819 + ,99 + ,726 + ,78 + ,0 + ,1752 + ,200779 + ,100 + ,536 + ,55 + ,7 + ,1463 + ,141987 + ,59 + ,560 + ,55 + ,7 + ,2489 + ,313944 + ,69 + ,1005 + ,103 + ,3 + ,1691 + ,196251 + ,76 + ,554 + ,41 + ,10 + ,4301 + ,342434 + ,166 + ,1515 + ,115 + ,0 + ,1917 + ,276692 + ,60 + ,690 + ,46 + ,4 + ,2352 + ,263451 + ,130 + ,940 + ,80 + ,3 + ,1283 + ,157448 + ,49 + ,460 + ,37 + ,3 + ,2108 + ,240201 + ,74 + ,631 + ,50 + ,7 + ,2197 + ,245847 + ,66 + ,719 + ,93 + ,0 + ,2524 + ,396701 + ,94 + ,1081 + ,93 + ,1 + ,1276 + ,157544 + ,37 + ,411 + ,61 + ,5 + ,1470 + ,156189 + ,47 + ,488 + ,57 + ,9 + ,2904 + ,196316 + ,108 + ,1116 + ,150 + ,0 + ,2304 + ,192167 + ,107 + ,847 + ,67 + ,0 + ,2653 + ,249893 + ,122 + ,994 + ,88 + ,5 + ,1709 + ,236812 + ,76 + ,530 + ,54 + ,0 + ,1385 + ,143182 + ,47 + ,524 + ,47 + ,0 + ,2225 + ,282946 + ,55 + ,838 + ,121 + ,0 + ,2007 + ,243048 + ,68 + ,780 + ,44 + ,3 + ,1623 + ,176062 + ,67 + ,551 + ,73 + ,4 + ,1944 + ,287382 + ,81 + ,722 + ,49 + ,1 + ,849 + ,87485 + ,33 + ,280 + ,36 + ,4 + ,2803 + ,343613 + ,88 + ,1108 + ,72 + ,2 + ,2236 + ,247082 + ,52 + ,950 + ,77 + ,0 + ,3308 + ,380797 + ,109 + ,1182 + ,71 + ,0 + ,1668 + ,191653 + ,75 + ,552 + ,63 + ,2 + ,917 + ,114673 + ,31 + ,275 + ,36 + ,1 + ,2951 + ,309038 + ,170 + ,1047 + ,45 + ,2 + ,2982 + ,292891 + ,73 + ,1370 + ,37 + ,10 + ,1422 + ,155568 + ,60 + ,568 + ,65 + ,6 + ,1536 + ,177306 + ,68 + ,571 + ,78 + ,5 + ,1487 + ,146175 + ,51 + ,416 + ,69 + ,5 + ,2369 + ,140319 + ,73 + ,985 + ,82 + ,1 + ,4908 + ,405267 + ,135 + ,1851 + ,780 + ,2 + ,918 + ,78800 + ,42 + ,330 + ,57 + ,2 + ,2085 + ,201970 + ,69 + ,611 + ,72 + ,0 + ,3679 + ,302833 + ,103 + ,1255 + ,112 + ,9 + ,1923 + ,164733 + ,50 + ,812 + ,61 + ,3 + ,1617 + ,194221 + ,69 + ,501 + ,39 + ,0 + ,496 + ,24188 + ,24 + ,218 + ,20 + ,0 + ,2343 + ,346142 + ,289 + ,787 + ,73 + ,8 + ,744 + ,65029 + ,17 + ,255 + ,21 + ,5 + ,1161 + ,101097 + ,64 + ,454 + ,70 + ,3 + ,2722 + ,255082 + ,51 + ,983 + ,124 + ,1 + ,2322 + ,283783 + ,78 + ,609 + ,75 + ,5 + ,3298 + ,295924 + ,164 + ,1006 + ,201 + ,5 + ,2184 + ,280943 + ,121 + ,884 + ,58 + ,0 + ,1863 + ,214872 + ,74 + ,690 + ,67 + ,12 + ,3609 + ,346520 + ,128 + ,1201 + ,65 + ,9 + ,2827 + ,273924 + ,109 + ,1032 + ,138 + ,11 + ,2280 + ,197035 + ,94 + ,919 + ,71 + ,10 + ,2188 + ,231904 + ,81 + ,783 + ,48 + ,8 + ,1303 + ,209798 + ,62 + ,521 + ,54 + ,2 + ,1540 + ,201345 + ,60 + ,409 + ,55 + ,0 + ,1777 + ,180403 + ,121 + ,547 + ,46 + ,6 + ,2418 + ,204441 + ,129 + ,757 + ,84 + ,8 + ,1961 + ,197813 + ,67 + ,736 + ,71 + ,2 + ,1419 + ,136421 + ,61 + ,515 + ,56 + ,5 + ,2293 + ,216092 + ,60 + ,789 + ,55 + ,13 + ,893 + ,73566 + ,32 + ,385 + ,39 + ,6 + ,1958 + ,214064 + ,70 + ,649 + ,52 + ,7 + ,1593 + ,181728 + ,50 + ,667 + ,94 + ,2 + ,1524 + ,150006 + ,53 + ,515 + ,57 + ,0 + ,2037 + ,308343 + ,72 + ,891 + ,83 + ,4 + ,1915 + ,251592 + ,80 + ,773 + ,42 + ,3 + ,1728 + ,202392 + ,103 + ,503 + ,45 + ,6 + ,2002 + ,173286 + ,57 + ,619 + ,52 + ,2 + ,1541 + ,162366 + ,58 + ,565 + ,67 + ,0 + ,1539 + ,132672 + ,42 + ,565 + ,38 + ,1 + ,3391 + ,390163 + ,102 + ,1104 + ,114 + ,0 + ,1356 + ,145905 + ,66 + ,649 + ,45 + ,5 + ,1965 + ,228657 + ,90 + ,551 + ,53 + ,2 + ,870 + ,80953 + ,25 + ,437 + ,31 + ,0 + ,1728 + ,132957 + ,49 + ,739 + ,169 + ,0 + ,1100 + ,135163 + ,50 + ,311 + ,60 + ,5 + ,3380 + ,333962 + ,169 + ,1332 + ,276 + ,1 + ,2241 + ,271806 + ,96 + ,783 + ,84 + ,0 + ,2973 + ,169483 + ,100 + ,1005 + ,67 + ,1 + ,2135 + ,234193 + ,81 + ,737 + ,58 + ,1 + ,1856 + ,207178 + ,69 + ,584 + ,71 + ,2 + ,1568 + ,157117 + ,58 + ,510 + ,80 + ,6 + ,2788 + ,242395 + ,68 + ,1009 + ,89 + ,1 + ,2119 + ,261601 + ,71 + ,838 + ,115 + ,4 + ,1521 + ,178489 + ,35 + ,523 + ,60 + ,3 + ,1505 + ,204221 + ,44 + ,513 + ,69 + ,3 + ,1910 + ,268066 + ,69 + ,706 + ,57 + ,0 + ,3518 + ,335002 + ,134 + ,1153 + ,121 + ,11 + ,3278 + ,361799 + ,102 + ,1281 + ,69 + ,12 + ,2261 + ,247804 + ,107 + ,746 + ,60 + ,8 + ,2128 + ,265849 + ,58 + ,787 + ,81 + ,0 + ,1885 + ,168501 + ,164 + ,597 + ,115 + ,0 + ,602 + ,43287 + ,14 + ,214 + ,43 + ,4 + ,1977 + ,172244 + ,69 + ,662 + ,72 + ,4 + ,1775 + ,189021 + ,121 + ,651 + ,61 + ,0 + ,2283 + ,227681 + ,44 + ,1015 + ,101 + ,0 + ,2402 + ,269329 + ,82 + ,922 + ,50 + ,0 + ,974 + ,106655 + ,57 + ,314 + ,32 + ,0 + ,1447 + ,117891 + ,78 + ,465 + ,78 + ,0 + ,1760 + ,290342 + ,61 + ,572 + ,58 + ,4 + ,2082 + ,266805 + ,78 + ,627 + ,65 + ,0 + ,398 + ,23623 + ,11 + ,156 + ,9 + ,0 + ,1821 + ,174970 + ,69 + ,648 + ,49 + ,0 + ,530 + ,61857 + ,25 + ,192 + ,25 + ,4 + ,1508 + ,144927 + ,44 + ,438 + ,102 + ,0 + ,2709 + ,355619 + ,105 + ,1083 + ,59 + ,1 + ,387 + ,21054 + ,16 + ,146 + ,2 + ,0 + ,1913 + ,230091 + ,46 + ,779 + ,56 + ,5 + ,449 + ,31414 + ,19 + ,200 + ,22 + ,0 + ,3076 + ,280685 + ,107 + ,1117 + ,148 + ,2 + ,1794 + ,209481 + ,58 + ,603 + ,70 + ,7 + ,1456 + ,161691 + ,76 + ,444 + ,91 + ,12 + ,1477 + ,132310 + ,49 + ,581 + ,46 + ,2 + ,568 + ,38214 + ,34 + ,276 + ,52 + ,0 + ,1594 + ,166026 + ,36 + ,546 + ,101 + ,2 + ,2433 + ,316370 + ,74 + ,916 + ,105 + ,0 + ,1223 + ,186273 + ,56 + ,427 + ,58 + ,0 + ,3187 + ,369581 + ,73 + ,1406 + ,130 + ,3 + ,2186 + ,275578 + ,91 + ,743 + ,120 + ,0 + ,3081 + ,368855 + ,109 + ,1075 + ,104 + ,3 + ,1127 + ,172464 + ,31 + ,431 + ,44 + ,0 + ,1045 + ,94381 + ,35 + ,380 + ,48 + ,0 + ,2477 + ,251253 + ,292 + ,806 + ,144 + ,4 + ,3842 + ,382499 + ,154 + ,1367 + ,146 + ,4 + ,1506 + ,118033 + ,43 + ,473 + ,94 + ,14 + ,3810 + ,365575 + ,123 + ,1610 + ,139 + ,0 + ,1730 + ,147989 + ,72 + ,651 + ,67 + ,4 + ,1627 + ,236370 + ,46 + ,528 + ,83 + ,0 + ,1929 + ,193220 + ,77 + ,672 + ,169 + ,1 + ,1595 + ,189020 + ,108 + ,523 + ,69 + ,0 + ,3627 + ,341992 + ,106 + ,1474 + ,99 + ,9 + ,1987 + ,222289 + ,80 + ,698 + ,61 + ,1 + ,2035 + ,173260 + ,63 + ,716 + ,37 + ,3 + ,2538 + ,275969 + ,92 + ,821 + ,54 + ,11 + ,1603 + ,130908 + ,52 + ,556 + ,121 + ,5 + ,2297 + ,208598 + ,77 + ,892 + ,51 + ,2 + ,2268 + ,262412 + ,94 + ,721 + ,52 + ,1 + ,2 + ,1 + ,0 + ,0 + ,0 + ,9 + ,207 + ,14688 + ,10 + ,85 + ,0 + ,0 + ,5 + ,98 + ,1 + ,0 + ,0 + ,0 + ,8 + ,455 + ,2 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1785 + ,195812 + ,76 + ,610 + ,51 + ,2 + ,2946 + ,345447 + ,134 + ,973 + ,108 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,4 + ,203 + ,4 + ,0 + ,0 + ,0 + ,151 + ,7199 + ,5 + ,74 + ,0 + ,0 + ,474 + ,46660 + ,20 + ,259 + ,7 + ,0 + ,141 + ,17547 + ,5 + ,69 + ,3 + ,0 + ,976 + ,107465 + ,38 + ,267 + ,80 + ,0 + ,29 + ,969 + ,2 + ,0 + ,0 + ,0 + ,1549 + ,179994 + ,58 + ,518 + ,43 + ,2) + ,dim=c(6 + ,164) + ,dimnames=list(c('pageviews' + ,'time_rfc' + ,'logins' + ,'comp_views' + ,'comp_views_pr' + ,'shared_comp') + ,1:164)) > y <- array(NA,dim=c(6,164),dimnames=list(c('pageviews','time_rfc','logins','comp_views','comp_views_pr','shared_comp'),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 = '3' > par2 = 'none' > par1 = '5' > 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] "comp_views_pr" > x[,par1] [1] 85 58 57 132 44 42 94 46 71 65 78 55 55 103 41 115 46 80 [19] 37 50 93 93 61 57 150 67 88 54 47 121 44 73 49 36 72 77 [37] 71 63 36 45 37 65 78 69 82 780 57 72 112 61 39 20 73 21 [55] 70 124 75 201 58 67 65 138 71 48 54 55 46 84 71 56 55 39 [73] 52 94 57 83 42 45 52 67 38 114 45 53 31 169 60 276 84 67 [91] 58 71 80 89 115 60 69 57 121 69 60 81 115 43 72 61 101 50 [109] 32 78 58 65 9 49 25 102 59 2 56 22 148 70 91 46 52 101 [127] 105 58 130 120 104 44 48 144 146 94 139 67 83 169 69 99 61 37 [145] 54 121 51 52 0 0 0 0 0 0 51 108 0 0 0 7 3 80 [163] 0 43 > 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 2 3 7 9 20 21 22 25 31 32 36 37 38 39 41 42 43 44 45 10 1 1 1 1 1 1 1 1 1 1 2 3 1 2 1 2 2 3 3 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 63 65 67 69 4 1 2 2 2 2 4 1 3 4 2 5 5 1 3 4 1 4 5 4 70 71 72 73 75 77 78 80 81 82 83 84 85 88 89 91 93 94 99 101 2 5 3 2 1 1 3 3 1 1 2 2 1 1 1 1 2 3 1 2 102 103 104 105 108 112 114 115 120 121 124 130 132 138 139 144 146 148 150 169 1 1 1 1 1 1 1 3 1 3 1 1 1 1 1 1 1 1 1 2 201 276 780 1 1 1 > colnames(x) [1] "pageviews" "time_rfc" "logins" "comp_views" [5] "comp_views_pr" "shared_comp" > colnames(x)[par1] [1] "comp_views_pr" > x[,par1] [1] 85 58 57 132 44 42 94 46 71 65 78 55 55 103 41 115 46 80 [19] 37 50 93 93 61 57 150 67 88 54 47 121 44 73 49 36 72 77 [37] 71 63 36 45 37 65 78 69 82 780 57 72 112 61 39 20 73 21 [55] 70 124 75 201 58 67 65 138 71 48 54 55 46 84 71 56 55 39 [73] 52 94 57 83 42 45 52 67 38 114 45 53 31 169 60 276 84 67 [91] 58 71 80 89 115 60 69 57 121 69 60 81 115 43 72 61 101 50 [109] 32 78 58 65 9 49 25 102 59 2 56 22 148 70 91 46 52 101 [127] 105 58 130 120 104 44 48 144 146 94 139 67 83 169 69 99 61 37 [145] 54 121 51 52 0 0 0 0 0 0 51 108 0 0 0 7 3 80 [163] 0 43 > 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/1sudi1323618691.tab") + } + } > m Conditional inference tree with 5 terminal nodes Response: comp_views_pr Inputs: pageviews, time_rfc, logins, comp_views, shared_comp Number of observations: 164 1) pageviews <= 3278; criterion = 1, statistic = 59.112 2) pageviews <= 917; criterion = 1, statistic = 70.248 3) logins <= 11; criterion = 1, statistic = 18.014 4)* weights = 12 3) logins > 11 5)* weights = 14 2) pageviews > 917 6) pageviews <= 2402; criterion = 1, statistic = 18.624 7)* weights = 103 6) pageviews > 2402 8)* weights = 22 1) pageviews > 3278 9)* weights = 13 > postscript(file="/var/www/rcomp/tmp/2te8c1323618691.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/3ul3z1323618691.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 85 67.34951 17.6504854 2 58 67.34951 -9.3495146 3 57 67.34951 -10.3495146 4 132 97.40909 34.5909091 5 44 67.34951 -23.3495146 6 42 30.14286 11.8571429 7 94 179.46154 -85.4615385 8 46 30.14286 15.8571429 9 71 67.34951 3.6504854 10 65 67.34951 -2.3495146 11 78 67.34951 10.6504854 12 55 67.34951 -12.3495146 13 55 67.34951 -12.3495146 14 103 97.40909 5.5909091 15 41 67.34951 -26.3495146 16 115 179.46154 -64.4615385 17 46 67.34951 -21.3495146 18 80 67.34951 12.6504854 19 37 67.34951 -30.3495146 20 50 67.34951 -17.3495146 21 93 67.34951 25.6504854 22 93 97.40909 -4.4090909 23 61 67.34951 -6.3495146 24 57 67.34951 -10.3495146 25 150 97.40909 52.5909091 26 67 67.34951 -0.3495146 27 88 97.40909 -9.4090909 28 54 67.34951 -13.3495146 29 47 67.34951 -20.3495146 30 121 67.34951 53.6504854 31 44 67.34951 -23.3495146 32 73 67.34951 5.6504854 33 49 67.34951 -18.3495146 34 36 30.14286 5.8571429 35 72 97.40909 -25.4090909 36 77 67.34951 9.6504854 37 71 179.46154 -108.4615385 38 63 67.34951 -4.3495146 39 36 30.14286 5.8571429 40 45 97.40909 -52.4090909 41 37 97.40909 -60.4090909 42 65 67.34951 -2.3495146 43 78 67.34951 10.6504854 44 69 67.34951 1.6504854 45 82 67.34951 14.6504854 46 780 179.46154 600.5384615 47 57 67.34951 -10.3495146 48 72 67.34951 4.6504854 49 112 179.46154 -67.4615385 50 61 67.34951 -6.3495146 51 39 67.34951 -28.3495146 52 20 30.14286 -10.1428571 53 73 67.34951 5.6504854 54 21 30.14286 -9.1428571 55 70 67.34951 2.6504854 56 124 97.40909 26.5909091 57 75 67.34951 7.6504854 58 201 179.46154 21.5384615 59 58 67.34951 -9.3495146 60 67 67.34951 -0.3495146 61 65 179.46154 -114.4615385 62 138 97.40909 40.5909091 63 71 67.34951 3.6504854 64 48 67.34951 -19.3495146 65 54 67.34951 -13.3495146 66 55 67.34951 -12.3495146 67 46 67.34951 -21.3495146 68 84 97.40909 -13.4090909 69 71 67.34951 3.6504854 70 56 67.34951 -11.3495146 71 55 67.34951 -12.3495146 72 39 30.14286 8.8571429 73 52 67.34951 -15.3495146 74 94 67.34951 26.6504854 75 57 67.34951 -10.3495146 76 83 67.34951 15.6504854 77 42 67.34951 -25.3495146 78 45 67.34951 -22.3495146 79 52 67.34951 -15.3495146 80 67 67.34951 -0.3495146 81 38 67.34951 -29.3495146 82 114 179.46154 -65.4615385 83 45 67.34951 -22.3495146 84 53 67.34951 -14.3495146 85 31 30.14286 0.8571429 86 169 67.34951 101.6504854 87 60 67.34951 -7.3495146 88 276 179.46154 96.5384615 89 84 67.34951 16.6504854 90 67 97.40909 -30.4090909 91 58 67.34951 -9.3495146 92 71 67.34951 3.6504854 93 80 67.34951 12.6504854 94 89 97.40909 -8.4090909 95 115 67.34951 47.6504854 96 60 67.34951 -7.3495146 97 69 67.34951 1.6504854 98 57 67.34951 -10.3495146 99 121 179.46154 -58.4615385 100 69 97.40909 -28.4090909 101 60 67.34951 -7.3495146 102 81 67.34951 13.6504854 103 115 67.34951 47.6504854 104 43 30.14286 12.8571429 105 72 67.34951 4.6504854 106 61 67.34951 -6.3495146 107 101 67.34951 33.6504854 108 50 67.34951 -17.3495146 109 32 67.34951 -35.3495146 110 78 67.34951 10.6504854 111 58 67.34951 -9.3495146 112 65 67.34951 -2.3495146 113 9 1.00000 8.0000000 114 49 67.34951 -18.3495146 115 25 30.14286 -5.1428571 116 102 67.34951 34.6504854 117 59 97.40909 -38.4090909 118 2 30.14286 -28.1428571 119 56 67.34951 -11.3495146 120 22 30.14286 -8.1428571 121 148 97.40909 50.5909091 122 70 67.34951 2.6504854 123 91 67.34951 23.6504854 124 46 67.34951 -21.3495146 125 52 30.14286 21.8571429 126 101 67.34951 33.6504854 127 105 97.40909 7.5909091 128 58 67.34951 -9.3495146 129 130 97.40909 32.5909091 130 120 67.34951 52.6504854 131 104 97.40909 6.5909091 132 44 67.34951 -23.3495146 133 48 67.34951 -19.3495146 134 144 97.40909 46.5909091 135 146 179.46154 -33.4615385 136 94 67.34951 26.6504854 137 139 179.46154 -40.4615385 138 67 67.34951 -0.3495146 139 83 67.34951 15.6504854 140 169 67.34951 101.6504854 141 69 67.34951 1.6504854 142 99 179.46154 -80.4615385 143 61 67.34951 -6.3495146 144 37 67.34951 -30.3495146 145 54 97.40909 -43.4090909 146 121 67.34951 53.6504854 147 51 67.34951 -16.3495146 148 52 67.34951 -15.3495146 149 0 1.00000 -1.0000000 150 0 1.00000 -1.0000000 151 0 1.00000 -1.0000000 152 0 1.00000 -1.0000000 153 0 1.00000 -1.0000000 154 0 1.00000 -1.0000000 155 51 67.34951 -16.3495146 156 108 97.40909 10.5909091 157 0 1.00000 -1.0000000 158 0 1.00000 -1.0000000 159 0 1.00000 -1.0000000 160 7 30.14286 -23.1428571 161 3 1.00000 2.0000000 162 80 67.34951 12.6504854 163 0 1.00000 -1.0000000 164 43 67.34951 -24.3495146 > 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/4tiy01323618691.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/5hf9j1323618691.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/65e9a1323618691.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/7un9c1323618691.tab") + } > > try(system("convert tmp/2te8c1323618691.ps tmp/2te8c1323618691.png",intern=TRUE)) character(0) > try(system("convert tmp/3ul3z1323618691.ps tmp/3ul3z1323618691.png",intern=TRUE)) character(0) > try(system("convert tmp/4tiy01323618691.ps tmp/4tiy01323618691.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.904 0.240 4.362