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(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 = '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] 264530 135248 207253 197987 143105 65295 439387 33186 183696 186657 [11] 276819 200779 141987 313944 196251 342434 276692 263451 157448 240201 [21] 245847 396701 157544 156189 196316 192167 249893 236812 143182 282946 [31] 243048 176062 287382 87485 343613 247082 380797 191653 114673 309038 [41] 292891 155568 177306 146175 140319 405267 78800 201970 302833 164733 [51] 194221 24188 346142 65029 101097 255082 283783 295924 280943 214872 [61] 346520 273924 197035 231904 209798 201345 180403 204441 197813 136421 [71] 216092 73566 214064 181728 150006 308343 251592 202392 173286 162366 [81] 132672 390163 145905 228657 80953 132957 135163 333962 271806 169483 [91] 234193 207178 157117 242395 261601 178489 204221 268066 335002 361799 [101] 247804 265849 168501 43287 172244 189021 227681 269329 106655 117891 [111] 290342 266805 23623 174970 61857 144927 355619 21054 230091 31414 [121] 280685 209481 161691 132310 38214 166026 316370 186273 369581 275578 [131] 368855 172464 94381 251253 382499 118033 365575 147989 236370 193220 [141] 189020 341992 222289 173260 275969 130908 208598 262412 1 14688 [151] 98 455 0 0 195812 345447 0 203 7199 46660 [161] 17547 107465 969 179994 > 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 98 203 455 969 7199 14688 17547 21054 23623 3 1 1 1 1 1 1 1 1 1 1 24188 31414 33186 38214 43287 46660 61857 65029 65295 73566 78800 1 1 1 1 1 1 1 1 1 1 1 80953 87485 94381 101097 106655 107465 114673 117891 118033 130908 132310 1 1 1 1 1 1 1 1 1 1 1 132672 132957 135163 135248 136421 140319 141987 143105 143182 144927 145905 1 1 1 1 1 1 1 1 1 1 1 146175 147989 150006 155568 156189 157117 157448 157544 161691 162366 164733 1 1 1 1 1 1 1 1 1 1 1 166026 168501 169483 172244 172464 173260 173286 174970 176062 177306 178489 1 1 1 1 1 1 1 1 1 1 1 179994 180403 181728 183696 186273 186657 189020 189021 191653 192167 193220 1 1 1 1 1 1 1 1 1 1 1 194221 195812 196251 196316 197035 197813 197987 200779 201345 201970 202392 1 1 1 1 1 1 1 1 1 1 1 204221 204441 207178 207253 208598 209481 209798 214064 214872 216092 222289 1 1 1 1 1 1 1 1 1 1 1 227681 228657 230091 231904 234193 236370 236812 240201 242395 243048 245847 1 1 1 1 1 1 1 1 1 1 1 247082 247804 249893 251253 251592 255082 261601 262412 263451 264530 265849 1 1 1 1 1 1 1 1 1 1 1 266805 268066 269329 271806 273924 275578 275969 276692 276819 280685 280943 1 1 1 1 1 1 1 1 1 1 1 282946 283783 287382 290342 292891 295924 302833 308343 309038 313944 316370 1 1 1 1 1 1 1 1 1 1 1 333962 335002 341992 342434 343613 345447 346142 346520 355619 361799 365575 1 1 1 1 1 1 1 1 1 1 1 368855 369581 380797 382499 390163 396701 405267 439387 1 1 1 1 1 1 1 1 > colnames(x) [1] "pageviews" "time_rfc" "logins" "comp_views" [5] "comp_views_pr" "shared_comp" > colnames(x)[par1] [1] "time_rfc" > x[,par1] [1] 264530 135248 207253 197987 143105 65295 439387 33186 183696 186657 [11] 276819 200779 141987 313944 196251 342434 276692 263451 157448 240201 [21] 245847 396701 157544 156189 196316 192167 249893 236812 143182 282946 [31] 243048 176062 287382 87485 343613 247082 380797 191653 114673 309038 [41] 292891 155568 177306 146175 140319 405267 78800 201970 302833 164733 [51] 194221 24188 346142 65029 101097 255082 283783 295924 280943 214872 [61] 346520 273924 197035 231904 209798 201345 180403 204441 197813 136421 [71] 216092 73566 214064 181728 150006 308343 251592 202392 173286 162366 [81] 132672 390163 145905 228657 80953 132957 135163 333962 271806 169483 [91] 234193 207178 157117 242395 261601 178489 204221 268066 335002 361799 [101] 247804 265849 168501 43287 172244 189021 227681 269329 106655 117891 [111] 290342 266805 23623 174970 61857 144927 355619 21054 230091 31414 [121] 280685 209481 161691 132310 38214 166026 316370 186273 369581 275578 [131] 368855 172464 94381 251253 382499 118033 365575 147989 236370 193220 [141] 189020 341992 222289 173260 275969 130908 208598 262412 1 14688 [151] 98 455 0 0 195812 345447 0 203 7199 46660 [161] 17547 107465 969 179994 > 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/142wj1323620791.tab") + } + } > m Conditional inference tree with 9 terminal nodes Response: time_rfc Inputs: pageviews, logins, comp_views, comp_views_pr, shared_comp Number of observations: 164 1) pageviews <= 1603; criterion = 1, statistic = 136.405 2) pageviews <= 893; criterion = 1, statistic = 55.807 3) pageviews <= 496; criterion = 1, statistic = 21.988 4)* weights = 17 3) pageviews > 496 5)* weights = 8 2) pageviews > 893 6) pageviews <= 1161; criterion = 0.996, statistic = 11.381 7)* weights = 10 6) pageviews > 1161 8)* weights = 29 1) pageviews > 1603 9) pageviews <= 2418; criterion = 1, statistic = 54.652 10) pageviews <= 1885; criterion = 0.979, statistic = 8.203 11)* weights = 23 10) pageviews > 1885 12) logins <= 77; criterion = 0.966, statistic = 7.302 13)* weights = 23 12) logins > 77 14)* weights = 21 9) pageviews > 2418 15) comp_views <= 1047; criterion = 0.996, statistic = 11.403 16)* weights = 12 15) comp_views > 1047 17)* weights = 21 > postscript(file="/var/www/rcomp/tmp/2p8491323620791.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/38hmq1323620791.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 264530 199487.04 65042.9565 2 135248 118905.10 16342.9000 3 207253 199487.04 7765.9565 4 197987 252024.71 -54037.7143 5 143105 118905.10 24199.9000 6 65295 64460.75 834.2500 7 439387 349166.24 90220.7619 8 33186 13016.76 20169.2353 9 183696 199487.04 -15791.0435 10 186657 199487.04 -12830.0435 11 276819 252024.71 24794.2857 12 200779 199487.04 1291.9565 13 141987 159397.93 -17410.9310 14 313944 274893.50 39050.5000 15 196251 199487.04 -3236.0435 16 342434 349166.24 -6732.2381 17 276692 224045.48 52646.5217 18 263451 252024.71 11426.2857 19 157448 159397.93 -1949.9310 20 240201 224045.48 16155.5217 21 245847 224045.48 21801.5217 22 396701 349166.24 47534.7619 23 157544 159397.93 -1853.9310 24 156189 159397.93 -3208.9310 25 196316 349166.24 -152850.2381 26 192167 252024.71 -59857.7143 27 249893 274893.50 -25000.5000 28 236812 199487.04 37324.9565 29 143182 159397.93 -16215.9310 30 282946 224045.48 58900.5217 31 243048 224045.48 19002.5217 32 176062 199487.04 -23425.0435 33 287382 252024.71 35357.2857 34 87485 64460.75 23024.2500 35 343613 349166.24 -5553.2381 36 247082 224045.48 23036.5217 37 380797 349166.24 31630.7619 38 191653 199487.04 -7834.0435 39 114673 118905.10 -4232.1000 40 309038 274893.50 34144.5000 41 292891 349166.24 -56275.2381 42 155568 159397.93 -3829.9310 43 177306 159397.93 17908.0690 44 146175 159397.93 -13222.9310 45 140319 224045.48 -83726.4783 46 405267 349166.24 56100.7619 47 78800 118905.10 -40105.1000 48 201970 224045.48 -22075.4783 49 302833 349166.24 -46333.2381 50 164733 224045.48 -59312.4783 51 194221 199487.04 -5266.0435 52 24188 13016.76 11171.2353 53 346142 252024.71 94117.2857 54 65029 64460.75 568.2500 55 101097 118905.10 -17808.1000 56 255082 274893.50 -19811.5000 57 283783 252024.71 31758.2857 58 295924 274893.50 21030.5000 59 280943 252024.71 28918.2857 60 214872 199487.04 15384.9565 61 346520 349166.24 -2646.2381 62 273924 274893.50 -969.5000 63 197035 252024.71 -54989.7143 64 231904 252024.71 -20120.7143 65 209798 159397.93 50400.0690 66 201345 159397.93 41947.0690 67 180403 199487.04 -19084.0435 68 204441 252024.71 -47583.7143 69 197813 224045.48 -26232.4783 70 136421 159397.93 -22976.9310 71 216092 224045.48 -7953.4783 72 73566 64460.75 9105.2500 73 214064 224045.48 -9981.4783 74 181728 159397.93 22330.0690 75 150006 159397.93 -9391.9310 76 308343 224045.48 84297.5217 77 251592 252024.71 -432.7143 78 202392 199487.04 2904.9565 79 173286 224045.48 -50759.4783 80 162366 159397.93 2968.0690 81 132672 159397.93 -26725.9310 82 390163 349166.24 40996.7619 83 145905 159397.93 -13492.9310 84 228657 252024.71 -23367.7143 85 80953 64460.75 16492.2500 86 132957 199487.04 -66530.0435 87 135163 118905.10 16257.9000 88 333962 349166.24 -15204.2381 89 271806 252024.71 19781.2857 90 169483 274893.50 -105410.5000 91 234193 252024.71 -17831.7143 92 207178 199487.04 7690.9565 93 157117 159397.93 -2280.9310 94 242395 274893.50 -32498.5000 95 261601 224045.48 37555.5217 96 178489 159397.93 19091.0690 97 204221 159397.93 44823.0690 98 268066 224045.48 44020.5217 99 335002 349166.24 -14164.2381 100 361799 349166.24 12632.7619 101 247804 252024.71 -4220.7143 102 265849 224045.48 41803.5217 103 168501 199487.04 -30986.0435 104 43287 64460.75 -21173.7500 105 172244 224045.48 -51801.4783 106 189021 199487.04 -10466.0435 107 227681 224045.48 3635.5217 108 269329 252024.71 17304.2857 109 106655 118905.10 -12250.1000 110 117891 159397.93 -41506.9310 111 290342 199487.04 90854.9565 112 266805 252024.71 14780.2857 113 23623 13016.76 10606.2353 114 174970 199487.04 -24517.0435 115 61857 64460.75 -2603.7500 116 144927 159397.93 -14470.9310 117 355619 349166.24 6452.7619 118 21054 13016.76 8037.2353 119 230091 224045.48 6045.5217 120 31414 13016.76 18397.2353 121 280685 349166.24 -68481.2381 122 209481 199487.04 9993.9565 123 161691 159397.93 2293.0690 124 132310 159397.93 -27087.9310 125 38214 64460.75 -26246.7500 126 166026 159397.93 6628.0690 127 316370 274893.50 41476.5000 128 186273 159397.93 26875.0690 129 369581 349166.24 20414.7619 130 275578 252024.71 23553.2857 131 368855 349166.24 19688.7619 132 172464 118905.10 53558.9000 133 94381 118905.10 -24524.1000 134 251253 274893.50 -23640.5000 135 382499 349166.24 33332.7619 136 118033 159397.93 -41364.9310 137 365575 349166.24 16408.7619 138 147989 199487.04 -51498.0435 139 236370 199487.04 36882.9565 140 193220 224045.48 -30825.4783 141 189020 159397.93 29622.0690 142 341992 349166.24 -7174.2381 143 222289 252024.71 -29735.7143 144 173260 224045.48 -50785.4783 145 275969 274893.50 1075.5000 146 130908 159397.93 -28489.9310 147 208598 224045.48 -15447.4783 148 262412 252024.71 10387.2857 149 1 13016.76 -13015.7647 150 14688 13016.76 1671.2353 151 98 13016.76 -12918.7647 152 455 13016.76 -12561.7647 153 0 13016.76 -13016.7647 154 0 13016.76 -13016.7647 155 195812 199487.04 -3675.0435 156 345447 274893.50 70553.5000 157 0 13016.76 -13016.7647 158 203 13016.76 -12813.7647 159 7199 13016.76 -5817.7647 160 46660 13016.76 33643.2353 161 17547 13016.76 4530.2353 162 107465 118905.10 -11440.1000 163 969 13016.76 -12047.7647 164 179994 159397.93 20596.0690 > 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/47hx81323620791.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/59sbw1323620791.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/6axr31323620791.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/7se5s1323620791.tab") + } > > try(system("convert tmp/2p8491323620791.ps tmp/2p8491323620791.png",intern=TRUE)) character(0) > try(system("convert tmp/38hmq1323620791.ps tmp/38hmq1323620791.png",intern=TRUE)) character(0) > try(system("convert tmp/47hx81323620791.ps tmp/47hx81323620791.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.850 0.140 2.979