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(252101 + ,62 + ,438 + ,92 + ,34 + ,104 + ,165119 + ,134577 + ,59 + ,330 + ,58 + ,30 + ,111 + ,107269 + ,198520 + ,62 + ,609 + ,62 + ,38 + ,93 + ,93497 + ,189326 + ,94 + ,1015 + ,108 + ,34 + ,119 + ,100269 + ,137449 + ,43 + ,294 + ,55 + ,25 + ,57 + ,91627 + ,65295 + ,27 + ,164 + ,8 + ,31 + ,80 + ,47552 + ,439387 + ,103 + ,1912 + ,134 + ,29 + ,107 + ,233933 + ,33186 + ,19 + ,111 + ,1 + ,18 + ,22 + ,6853 + ,178368 + ,51 + ,698 + ,64 + ,30 + ,103 + ,104380 + ,186657 + ,38 + ,556 + ,77 + ,29 + ,72 + ,98431 + ,261949 + ,96 + ,711 + ,86 + ,38 + ,123 + ,156949 + ,191051 + ,95 + ,495 + ,93 + ,49 + ,164 + ,81817 + ,138866 + ,57 + ,544 + ,44 + ,33 + ,100 + ,59238 + ,296878 + ,66 + ,959 + ,106 + ,46 + ,143 + ,101138 + ,192648 + ,72 + ,540 + ,63 + ,38 + ,79 + ,107158 + ,333462 + ,162 + ,1486 + ,160 + ,52 + ,183 + ,155499 + ,243571 + ,58 + ,635 + ,104 + ,32 + ,123 + ,156274 + ,263451 + ,130 + ,940 + ,86 + ,35 + ,81 + ,121777 + ,155679 + ,48 + ,452 + ,93 + ,25 + ,74 + ,105037 + ,227053 + ,70 + ,617 + ,119 + ,42 + ,158 + ,118661 + ,240028 + ,63 + ,695 + ,107 + ,40 + ,133 + ,131187 + ,388549 + ,90 + ,1046 + ,86 + ,35 + ,128 + ,145026 + ,156540 + ,34 + ,405 + ,50 + ,25 + ,84 + ,107016 + ,148421 + ,43 + ,477 + ,92 + ,46 + ,184 + ,87242 + ,177732 + ,97 + ,1012 + ,123 + ,36 + ,127 + ,91699 + ,191441 + ,105 + ,842 + ,81 + ,35 + ,128 + ,110087 + ,249893 + ,122 + ,994 + ,93 + ,38 + ,118 + ,145447 + ,236812 + ,76 + ,530 + ,113 + ,35 + ,125 + ,143307 + ,142329 + ,45 + ,515 + ,52 + ,28 + ,89 + ,61678 + ,259667 + ,53 + ,766 + ,113 + ,37 + ,122 + ,210080 + ,231625 + ,65 + ,734 + ,112 + ,40 + ,151 + ,165005 + ,176062 + ,67 + ,551 + ,44 + ,42 + ,122 + ,97806 + ,286683 + ,79 + ,718 + ,123 + ,44 + ,162 + ,184471 + ,87485 + ,33 + ,280 + ,38 + ,33 + ,121 + ,27786 + ,322865 + ,83 + ,1055 + ,111 + ,35 + ,132 + ,184458 + ,247082 + ,51 + ,950 + ,77 + ,37 + ,110 + ,98765 + ,344092 + ,104 + ,1035 + ,92 + ,39 + ,135 + ,178441 + ,191653 + ,74 + ,552 + ,74 + ,32 + ,80 + ,100619 + ,114673 + ,31 + ,275 + ,33 + ,17 + ,46 + ,58391 + ,284224 + ,161 + ,986 + ,105 + ,34 + ,127 + ,151672 + ,284195 + ,72 + ,1336 + ,108 + ,33 + ,103 + ,124437 + ,155363 + ,59 + ,565 + ,66 + ,35 + ,95 + ,79929 + ,177306 + ,67 + ,571 + ,69 + ,32 + ,100 + ,123064 + ,144571 + ,49 + ,404 + ,62 + ,35 + ,102 + ,50466 + ,140319 + ,73 + ,985 + ,50 + ,45 + ,45 + ,100991 + ,405267 + ,135 + ,1851 + ,91 + ,38 + ,122 + ,79367 + ,78800 + ,42 + ,330 + ,20 + ,26 + ,66 + ,56968 + ,201970 + ,69 + ,611 + ,101 + ,45 + ,159 + ,106257 + ,302674 + ,99 + ,1249 + ,129 + ,44 + ,153 + ,178412 + ,164733 + ,50 + ,812 + ,93 + ,40 + ,131 + ,98520 + ,194221 + ,68 + ,501 + ,89 + ,33 + ,113 + ,153670 + ,24188 + ,24 + ,218 + ,8 + ,4 + ,7 + ,15049 + ,342263 + ,279 + ,785 + ,79 + ,41 + ,147 + ,174478 + ,65029 + ,17 + ,255 + ,21 + ,18 + ,61 + ,25109 + ,101097 + ,64 + ,454 + ,30 + ,14 + ,41 + ,45824 + ,246088 + ,46 + ,944 + ,86 + ,33 + ,108 + ,116772 + ,273108 + ,75 + ,600 + ,116 + ,49 + ,184 + ,189150 + ,282220 + ,160 + ,977 + ,106 + ,32 + ,115 + ,194404 + ,273495 + ,119 + ,863 + ,127 + ,37 + ,132 + ,185881 + ,214872 + ,74 + ,690 + ,75 + ,32 + ,113 + ,67508 + ,335121 + ,123 + ,1176 + ,138 + ,41 + ,141 + ,188597 + ,267171 + ,106 + ,1013 + ,114 + ,25 + ,65 + ,203618 + ,187938 + ,88 + ,890 + ,55 + ,40 + ,87 + ,87232 + ,229512 + ,78 + ,777 + ,67 + ,35 + ,121 + ,110875 + ,209798 + ,61 + ,521 + ,45 + ,33 + ,112 + ,144756 + ,201345 + ,60 + ,409 + ,88 + ,28 + ,81 + ,129825 + ,163833 + ,113 + ,493 + ,67 + ,31 + ,116 + ,92189 + ,204250 + ,129 + ,757 + ,75 + ,40 + ,132 + ,121158 + ,197813 + ,67 + ,736 + ,114 + ,32 + ,104 + ,96219 + ,132955 + ,60 + ,511 + ,123 + ,25 + ,80 + ,84128 + ,216092 + ,59 + ,789 + ,86 + ,42 + ,145 + ,97960 + ,73566 + ,32 + ,385 + ,22 + ,23 + ,67 + ,23824 + ,213198 + ,67 + ,644 + ,67 + ,42 + ,159 + ,103515 + ,181713 + ,49 + ,664 + ,77 + ,38 + ,90 + ,91313 + ,148698 + ,49 + ,505 + ,105 + ,34 + ,120 + ,85407 + ,300103 + ,70 + ,878 + ,119 + ,38 + ,126 + ,95871 + ,251437 + ,78 + ,769 + ,88 + ,32 + ,118 + ,143846 + ,197295 + ,101 + ,499 + ,78 + ,37 + ,112 + ,155387 + ,158163 + ,55 + ,546 + ,112 + ,34 + ,123 + ,74429 + ,155529 + ,57 + ,551 + ,66 + ,33 + ,98 + ,74004 + ,132672 + ,41 + ,565 + ,58 + ,25 + ,78 + ,71987 + ,377205 + ,100 + ,1086 + ,132 + ,40 + ,119 + ,150629 + ,145905 + ,66 + ,649 + ,30 + ,26 + ,99 + ,68580 + ,223701 + ,86 + ,540 + ,100 + ,40 + ,81 + ,119855 + ,80953 + ,25 + ,437 + ,49 + ,8 + ,27 + ,55792 + ,130805 + ,47 + ,732 + ,26 + ,27 + ,77 + ,25157 + ,135082 + ,48 + ,308 + ,67 + ,32 + ,118 + ,90895 + ,300170 + ,154 + ,1236 + ,57 + ,33 + ,122 + ,117510 + ,271806 + ,95 + ,783 + ,95 + ,50 + ,103 + ,144774 + ,150949 + ,96 + ,933 + ,139 + ,37 + ,129 + ,77529 + ,225805 + ,79 + ,710 + ,73 + ,33 + ,69 + ,103123 + ,197389 + ,67 + ,563 + ,134 + ,34 + ,121 + ,104669 + ,156583 + ,56 + ,508 + ,37 + ,28 + ,81 + ,82414 + ,222599 + ,66 + ,936 + ,98 + ,32 + ,119 + ,82390 + ,261601 + ,70 + ,838 + ,58 + ,32 + ,116 + ,128446 + ,178489 + ,35 + ,523 + ,78 + ,32 + ,123 + ,111542 + ,200657 + ,43 + ,500 + ,88 + ,31 + ,111 + ,136048 + ,259084 + ,67 + ,691 + ,142 + ,35 + ,100 + ,197257 + ,313075 + ,130 + ,1060 + ,127 + ,58 + ,221 + ,162079 + ,346933 + ,100 + ,1232 + ,139 + ,27 + ,95 + ,206286 + ,246440 + ,104 + ,735 + ,108 + ,45 + ,153 + ,109858 + ,252444 + ,58 + ,757 + ,128 + ,37 + ,118 + ,182125 + ,159965 + ,159 + ,574 + ,62 + ,32 + ,50 + ,74168 + ,43287 + ,14 + ,214 + ,13 + ,19 + ,64 + ,19630 + ,172239 + ,68 + ,661 + ,89 + ,22 + ,34 + ,88634 + ,181897 + ,119 + ,630 + ,83 + ,35 + ,76 + ,128321 + ,227681 + ,43 + ,1015 + ,116 + ,36 + ,112 + ,118936 + ,260464 + ,81 + ,893 + ,157 + ,36 + ,115 + ,127044 + ,106288 + ,54 + ,293 + ,28 + ,23 + ,69 + ,178377 + ,109632 + ,76 + ,446 + ,83 + ,36 + ,108 + ,69581 + ,268905 + ,58 + ,538 + ,72 + ,36 + ,130 + ,168019 + ,266805 + ,78 + ,627 + ,134 + ,42 + ,110 + ,113598 + ,23623 + ,11 + ,156 + ,12 + ,1 + ,0 + ,5841 + ,152474 + ,65 + ,577 + ,106 + ,32 + ,83 + ,93116 + ,61857 + ,25 + ,192 + ,23 + ,11 + ,30 + ,24610 + ,144889 + ,43 + ,437 + ,83 + ,40 + ,106 + ,60611 + ,346600 + ,99 + ,1054 + ,126 + ,34 + ,91 + ,226620 + ,21054 + ,16 + ,146 + ,4 + ,0 + ,0 + ,6622 + ,224051 + ,45 + ,751 + ,71 + ,27 + ,69 + ,121996 + ,31414 + ,19 + ,200 + ,18 + ,8 + ,9 + ,13155 + ,261043 + ,105 + ,1050 + ,98 + ,35 + ,123 + ,154158 + ,197819 + ,57 + ,590 + ,66 + ,41 + ,143 + ,78489 + ,154984 + ,73 + ,430 + ,44 + ,40 + ,125 + ,22007 + ,112933 + ,45 + ,467 + ,29 + ,28 + ,81 + ,72530 + ,38214 + ,34 + ,276 + ,16 + ,8 + ,21 + ,13983 + ,158671 + ,33 + ,528 + ,56 + ,35 + ,124 + ,73397 + ,302148 + ,70 + ,898 + ,112 + ,47 + ,168 + ,143878 + ,177918 + ,55 + ,411 + ,46 + ,46 + ,149 + ,119956 + ,350552 + ,70 + ,1362 + ,129 + ,42 + ,147 + ,181558 + ,275578 + ,91 + ,743 + ,139 + ,48 + ,145 + ,208236 + ,366217 + ,105 + ,1068 + ,136 + ,49 + ,172 + ,237085 + ,172464 + ,31 + ,431 + ,66 + ,35 + ,126 + ,110297 + ,94381 + ,35 + ,380 + ,42 + ,32 + ,89 + ,61394 + ,243875 + ,278 + ,788 + ,70 + ,36 + ,137 + ,81420 + ,382487 + ,153 + ,1367 + ,97 + ,42 + ,149 + ,191154 + ,114525 + ,40 + ,449 + ,49 + ,35 + ,121 + ,11798 + ,335681 + ,119 + ,1461 + ,113 + ,37 + ,133 + ,135724 + ,147989 + ,72 + ,651 + ,55 + ,34 + ,93 + ,68614 + ,216638 + ,44 + ,494 + ,100 + ,36 + ,119 + ,139926 + ,192862 + ,72 + ,667 + ,80 + ,36 + ,102 + ,105203 + ,184818 + ,107 + ,510 + ,29 + ,32 + ,45 + ,80338 + ,336707 + ,105 + ,1472 + ,95 + ,33 + ,104 + ,121376 + ,215836 + ,76 + ,675 + ,114 + ,35 + ,111 + ,124922 + ,173260 + ,63 + ,716 + ,41 + ,21 + ,78 + ,10901 + ,271773 + ,89 + ,814 + ,128 + ,40 + ,120 + ,135471 + ,130908 + ,52 + ,556 + ,142 + ,49 + ,176 + ,66395 + ,204009 + ,75 + ,887 + ,88 + ,33 + ,109 + ,134041 + ,245514 + ,92 + ,663 + ,147 + ,39 + ,132 + ,153554 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,14688 + ,10 + ,85 + ,4 + ,0 + ,0 + ,7953 + ,98 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,455 + ,2 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,195765 + ,75 + ,607 + ,56 + ,33 + ,78 + ,98922 + ,326038 + ,121 + ,934 + ,121 + ,42 + ,104 + ,165395 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,203 + ,4 + ,0 + ,0 + ,0 + ,0 + ,0 + ,7199 + ,5 + ,74 + ,7 + ,0 + ,0 + ,4245 + ,46660 + ,20 + ,259 + ,12 + ,5 + ,13 + ,21509 + ,17547 + ,5 + ,69 + ,0 + ,1 + ,4 + ,7670 + ,107465 + ,38 + ,267 + ,37 + ,38 + ,65 + ,15167 + ,969 + ,2 + ,0 + ,0 + ,0 + ,0 + ,0 + ,173102 + ,58 + ,517 + ,47 + ,28 + ,55 + ,63891) + ,dim=c(7 + ,164) + ,dimnames=list(c('Time' + ,'Logins' + ,'Views' + ,'Blogs' + ,'Reviews' + ,'LFM' + ,'Compendia_time ') + ,1:164)) > y <- array(NA,dim=c(7,164),dimnames=list(c('Time','Logins','Views','Blogs','Reviews','LFM','Compendia_time '),1:164)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par20 = '' > par19 = '' > par18 = '' > par17 = '' > par16 = '' > par15 = '' > par14 = '' > par13 = '' > par12 = '' > par11 = '' > par10 = '' > par9 = '' > par8 = '' > par7 = '' > par6 = '' > par5 = '' > par4 = 'no' > par3 = '2' > par2 = 'quantiles' > 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] 252101 134577 198520 189326 137449 65295 439387 33186 178368 186657 [11] 261949 191051 138866 296878 192648 333462 243571 263451 155679 227053 [21] 240028 388549 156540 148421 177732 191441 249893 236812 142329 259667 [31] 231625 176062 286683 87485 322865 247082 344092 191653 114673 284224 [41] 284195 155363 177306 144571 140319 405267 78800 201970 302674 164733 [51] 194221 24188 342263 65029 101097 246088 273108 282220 273495 214872 [61] 335121 267171 187938 229512 209798 201345 163833 204250 197813 132955 [71] 216092 73566 213198 181713 148698 300103 251437 197295 158163 155529 [81] 132672 377205 145905 223701 80953 130805 135082 300170 271806 150949 [91] 225805 197389 156583 222599 261601 178489 200657 259084 313075 346933 [101] 246440 252444 159965 43287 172239 181897 227681 260464 106288 109632 [111] 268905 266805 23623 152474 61857 144889 346600 21054 224051 31414 [121] 261043 197819 154984 112933 38214 158671 302148 177918 350552 275578 [131] 366217 172464 94381 243875 382487 114525 335681 147989 216638 192862 [141] 184818 336707 215836 173260 271773 130908 204009 245514 1 14688 [151] 98 455 0 0 195765 326038 0 203 7199 46660 [161] 17547 107465 969 173102 > 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,192648) [192648,439387] 82 82 > colnames(x) [1] "Time" "Logins" "Views" "Blogs" [5] "Reviews" "LFM" "Compendia_time." > colnames(x)[par1] [1] "Time" > x[,par1] [1] [192648,439387] [ 0,192648) [192648,439387] [ 0,192648) [5] [ 0,192648) [ 0,192648) [192648,439387] [ 0,192648) [9] [ 0,192648) [ 0,192648) [192648,439387] [ 0,192648) [13] [ 0,192648) [192648,439387] [192648,439387] [192648,439387] [17] [192648,439387] [192648,439387] [ 0,192648) [192648,439387] [21] [192648,439387] [192648,439387] [ 0,192648) [ 0,192648) [25] [ 0,192648) [ 0,192648) [192648,439387] [192648,439387] [29] [ 0,192648) [192648,439387] [192648,439387] [ 0,192648) [33] [192648,439387] [ 0,192648) [192648,439387] [192648,439387] [37] [192648,439387] [ 0,192648) [ 0,192648) [192648,439387] [41] [192648,439387] [ 0,192648) [ 0,192648) [ 0,192648) [45] [ 0,192648) [192648,439387] [ 0,192648) [192648,439387] [49] [192648,439387] [ 0,192648) [192648,439387] [ 0,192648) [53] [192648,439387] [ 0,192648) [ 0,192648) [192648,439387] [57] [192648,439387] [192648,439387] [192648,439387] [192648,439387] [61] [192648,439387] [192648,439387] [ 0,192648) [192648,439387] [65] [192648,439387] [192648,439387] [ 0,192648) [192648,439387] [69] [192648,439387] [ 0,192648) [192648,439387] [ 0,192648) [73] [192648,439387] [ 0,192648) [ 0,192648) [192648,439387] [77] [192648,439387] [192648,439387] [ 0,192648) [ 0,192648) [81] [ 0,192648) [192648,439387] [ 0,192648) [192648,439387] [85] [ 0,192648) [ 0,192648) [ 0,192648) [192648,439387] [89] [192648,439387] [ 0,192648) [192648,439387] [192648,439387] [93] [ 0,192648) [192648,439387] [192648,439387] [ 0,192648) [97] [192648,439387] [192648,439387] [192648,439387] [192648,439387] [101] [192648,439387] [192648,439387] [ 0,192648) [ 0,192648) [105] [ 0,192648) [ 0,192648) [192648,439387] [192648,439387] [109] [ 0,192648) [ 0,192648) [192648,439387] [192648,439387] [113] [ 0,192648) [ 0,192648) [ 0,192648) [ 0,192648) [117] [192648,439387] [ 0,192648) [192648,439387] [ 0,192648) [121] [192648,439387] [192648,439387] [ 0,192648) [ 0,192648) [125] [ 0,192648) [ 0,192648) [192648,439387] [ 0,192648) [129] [192648,439387] [192648,439387] [192648,439387] [ 0,192648) [133] [ 0,192648) [192648,439387] [192648,439387] [ 0,192648) [137] [192648,439387] [ 0,192648) [192648,439387] [192648,439387] [141] [ 0,192648) [192648,439387] [192648,439387] [ 0,192648) [145] [192648,439387] [ 0,192648) [192648,439387] [192648,439387] [149] [ 0,192648) [ 0,192648) [ 0,192648) [ 0,192648) [153] [ 0,192648) [ 0,192648) [192648,439387] [192648,439387] [157] [ 0,192648) [ 0,192648) [ 0,192648) [ 0,192648) [161] [ 0,192648) [ 0,192648) [ 0,192648) [ 0,192648) Levels: [ 0,192648) [192648,439387] > 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/1vksb1324647978.tab") + } + } > m Conditional inference tree with 4 terminal nodes Response: as.factor(Time) Inputs: Logins, Views, Blogs, Reviews, LFM, Compendia_time. Number of observations: 164 1) Compendia_time. <= 93116; criterion = 1, statistic = 85.119 2) Views <= 664; criterion = 1, statistic = 17.124 3)* weights = 61 2) Views > 664 4)* weights = 9 1) Compendia_time. > 93116 5) Blogs <= 83; criterion = 1, statistic = 21.701 6)* weights = 30 5) Blogs > 83 7)* weights = 64 > postscript(file="/var/www/rcomp/tmp/2rax11324647978.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/3yo381324647978.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,] 2 2 [2,] 1 2 [3,] 2 2 [4,] 1 2 [5,] 1 1 [6,] 1 1 [7,] 2 2 [8,] 1 1 [9,] 1 2 [10,] 1 2 [11,] 2 2 [12,] 1 1 [13,] 1 1 [14,] 2 2 [15,] 2 2 [16,] 2 2 [17,] 2 2 [18,] 2 2 [19,] 1 2 [20,] 2 2 [21,] 2 2 [22,] 2 2 [23,] 1 2 [24,] 1 1 [25,] 1 1 [26,] 1 2 [27,] 2 2 [28,] 2 2 [29,] 1 1 [30,] 2 2 [31,] 2 2 [32,] 1 2 [33,] 2 2 [34,] 1 1 [35,] 2 2 [36,] 2 2 [37,] 2 2 [38,] 1 2 [39,] 1 1 [40,] 2 2 [41,] 2 2 [42,] 1 1 [43,] 1 2 [44,] 1 1 [45,] 1 2 [46,] 2 1 [47,] 1 1 [48,] 2 2 [49,] 2 2 [50,] 1 2 [51,] 2 2 [52,] 1 1 [53,] 2 2 [54,] 1 1 [55,] 1 1 [56,] 2 2 [57,] 2 2 [58,] 2 2 [59,] 2 2 [60,] 2 1 [61,] 2 2 [62,] 2 2 [63,] 1 1 [64,] 2 2 [65,] 2 2 [66,] 2 2 [67,] 1 1 [68,] 2 2 [69,] 2 2 [70,] 1 1 [71,] 2 2 [72,] 1 1 [73,] 2 2 [74,] 1 1 [75,] 1 1 [76,] 2 2 [77,] 2 2 [78,] 2 2 [79,] 1 1 [80,] 1 1 [81,] 1 1 [82,] 2 2 [83,] 1 1 [84,] 2 2 [85,] 1 1 [86,] 1 1 [87,] 1 1 [88,] 2 2 [89,] 2 2 [90,] 1 1 [91,] 2 2 [92,] 2 2 [93,] 1 1 [94,] 2 1 [95,] 2 2 [96,] 1 2 [97,] 2 2 [98,] 2 2 [99,] 2 2 [100,] 2 2 [101,] 2 2 [102,] 2 2 [103,] 1 1 [104,] 1 1 [105,] 1 1 [106,] 1 2 [107,] 2 2 [108,] 2 2 [109,] 1 2 [110,] 1 1 [111,] 2 2 [112,] 2 2 [113,] 1 1 [114,] 1 1 [115,] 1 1 [116,] 1 1 [117,] 2 2 [118,] 1 1 [119,] 2 2 [120,] 1 1 [121,] 2 2 [122,] 2 1 [123,] 1 1 [124,] 1 1 [125,] 1 1 [126,] 1 1 [127,] 2 2 [128,] 1 2 [129,] 2 2 [130,] 2 2 [131,] 2 2 [132,] 1 2 [133,] 1 1 [134,] 2 1 [135,] 2 2 [136,] 1 1 [137,] 2 2 [138,] 1 1 [139,] 2 2 [140,] 2 2 [141,] 1 1 [142,] 2 2 [143,] 2 2 [144,] 1 1 [145,] 2 2 [146,] 1 1 [147,] 2 2 [148,] 2 2 [149,] 1 1 [150,] 1 1 [151,] 1 1 [152,] 1 1 [153,] 1 1 [154,] 1 1 [155,] 2 2 [156,] 2 2 [157,] 1 1 [158,] 1 1 [159,] 1 1 [160,] 1 1 [161,] 1 1 [162,] 1 1 [163,] 1 1 [164,] 1 1 [ 0,192648) [192648,439387] [ 0,192648) 65 17 [192648,439387] 5 77 > postscript(file="/var/www/rcomp/tmp/4b8uq1324647978.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/59g8g1324647978.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/6a8y31324647978.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/7hbsv1324647978.tab") + } > > try(system("convert tmp/2rax11324647978.ps tmp/2rax11324647978.png",intern=TRUE)) character(0) > try(system("convert tmp/3yo381324647978.ps tmp/3yo381324647978.png",intern=TRUE)) character(0) > try(system("convert tmp/4b8uq1324647978.ps tmp/4b8uq1324647978.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.420 0.120 2.534