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 + ,124252 + ,165119 + ,134577 + ,59 + ,330 + ,58 + ,30 + ,111 + ,98956 + ,107269 + ,198520 + ,62 + ,609 + ,62 + ,38 + ,93 + ,98073 + ,93497 + ,189326 + ,94 + ,1015 + ,108 + ,34 + ,119 + ,106816 + ,100269 + ,137449 + ,44 + ,294 + ,55 + ,25 + ,57 + ,41449 + ,91627 + ,65295 + ,27 + ,164 + ,8 + ,31 + ,80 + ,76173 + ,47552 + ,439387 + ,103 + ,1912 + ,134 + ,29 + ,107 + ,177551 + ,233933 + ,33186 + ,19 + ,111 + ,1 + ,18 + ,22 + ,22807 + ,6853 + ,178368 + ,51 + ,698 + ,64 + ,30 + ,103 + ,126938 + ,104380 + ,186657 + ,38 + ,556 + ,77 + ,29 + ,72 + ,61680 + ,98431 + ,265539 + ,97 + ,717 + ,86 + ,39 + ,127 + ,72117 + ,156949 + ,191088 + ,96 + ,495 + ,93 + ,50 + ,168 + ,79738 + ,81817 + ,138866 + ,57 + ,544 + ,44 + ,33 + ,100 + ,57793 + ,59238 + ,296878 + ,66 + ,959 + ,106 + ,46 + ,143 + ,91677 + ,101138 + ,192648 + ,72 + ,540 + ,63 + ,38 + ,79 + ,64631 + ,107158 + ,333462 + ,162 + ,1486 + ,160 + ,52 + ,183 + ,106385 + ,155499 + ,243571 + ,58 + ,635 + ,104 + ,32 + ,123 + ,161961 + ,156274 + ,263451 + ,130 + ,940 + ,86 + ,35 + ,81 + ,112669 + ,121777 + ,155679 + ,49 + ,452 + ,93 + ,25 + ,74 + ,114029 + ,105037 + ,227053 + ,71 + ,617 + ,119 + ,42 + ,158 + ,124550 + ,118661 + ,240028 + ,63 + ,695 + ,107 + ,40 + ,133 + ,105416 + ,131187 + ,388549 + ,90 + ,1046 + ,86 + ,35 + ,128 + ,72875 + ,145026 + ,156540 + ,34 + ,405 + ,50 + ,25 + ,84 + ,81964 + ,107016 + ,148421 + ,43 + ,477 + ,92 + ,46 + ,184 + ,104880 + ,87242 + ,177732 + ,97 + ,1012 + ,123 + ,36 + ,127 + ,76302 + ,91699 + ,191441 + ,106 + ,842 + ,81 + ,35 + ,128 + ,96740 + ,110087 + ,249893 + ,122 + ,994 + ,93 + ,38 + ,118 + ,93071 + ,145447 + ,236812 + ,76 + ,530 + ,113 + ,35 + ,125 + ,78912 + ,143307 + ,142329 + ,45 + ,515 + ,52 + ,28 + ,89 + ,35224 + ,61678 + ,259667 + ,53 + ,766 + ,113 + ,37 + ,122 + ,90694 + ,210080 + ,231625 + ,66 + ,734 + ,112 + ,40 + ,151 + ,125369 + ,165005 + ,176062 + ,67 + ,551 + ,44 + ,42 + ,122 + ,80849 + ,97806 + ,286683 + ,79 + ,718 + ,123 + ,44 + ,162 + ,104434 + ,184471 + ,87485 + ,33 + ,280 + ,38 + ,33 + ,121 + ,65702 + ,27786 + ,322865 + ,83 + ,1055 + ,111 + ,35 + ,132 + ,108179 + ,184458 + ,247082 + ,51 + ,950 + ,77 + ,37 + ,110 + ,63583 + ,98765 + ,346011 + ,106 + ,1038 + ,92 + ,39 + ,135 + ,95066 + ,178441 + ,191653 + ,74 + ,552 + ,74 + ,32 + ,80 + ,62486 + ,100619 + ,114673 + ,31 + ,275 + ,33 + ,17 + ,46 + ,31081 + ,58391 + ,284224 + ,162 + ,986 + ,105 + ,34 + ,127 + ,94584 + ,151672 + ,284195 + ,72 + ,1336 + ,108 + ,33 + ,103 + ,87408 + ,124437 + ,155363 + ,60 + ,565 + ,66 + ,35 + ,95 + ,68966 + ,79929 + ,177306 + ,67 + ,571 + ,69 + ,32 + ,100 + ,88766 + ,123064 + ,144571 + ,49 + ,404 + ,62 + ,35 + ,102 + ,57139 + ,50466 + ,140319 + ,73 + ,985 + ,50 + ,45 + ,45 + ,90586 + ,100991 + ,405267 + ,135 + ,1851 + ,91 + ,38 + ,122 + ,109249 + ,79367 + ,78800 + ,42 + ,330 + ,20 + ,26 + ,66 + ,33032 + ,56968 + ,201970 + ,69 + ,611 + ,101 + ,45 + ,159 + ,96056 + ,106257 + ,302674 + ,99 + ,1249 + ,129 + ,44 + ,153 + ,146648 + ,178412 + ,164733 + ,50 + ,812 + ,93 + ,40 + ,131 + ,80613 + ,98520 + ,194221 + ,68 + ,501 + ,89 + ,33 + ,113 + ,87026 + ,153670 + ,24188 + ,24 + ,218 + ,8 + ,4 + ,7 + ,5950 + ,15049 + ,346142 + ,282 + ,787 + ,80 + ,41 + ,147 + ,131106 + ,174478 + ,65029 + ,17 + ,255 + ,21 + ,18 + ,61 + ,32551 + ,25109 + ,101097 + ,64 + ,454 + ,30 + ,14 + ,41 + ,31701 + ,45824 + ,246088 + ,46 + ,944 + ,86 + ,33 + ,108 + ,91072 + ,116772 + ,273108 + ,75 + ,600 + ,116 + ,49 + ,184 + ,159803 + ,189150 + ,282220 + ,160 + ,977 + ,106 + ,32 + ,115 + ,143950 + ,194404 + ,275505 + ,120 + ,872 + ,127 + ,37 + ,132 + ,112368 + ,185881 + ,214872 + ,74 + ,690 + ,75 + ,32 + ,113 + ,82124 + ,67508 + ,335121 + ,124 + ,1176 + ,138 + ,41 + ,141 + ,144068 + ,188597 + ,267171 + ,107 + ,1013 + ,114 + ,25 + ,65 + ,162627 + ,203618 + ,189637 + ,89 + ,894 + ,55 + ,42 + ,94 + ,55062 + ,87232 + ,229512 + ,78 + ,777 + ,67 + ,35 + ,121 + ,95329 + ,110875 + ,209798 + ,61 + ,521 + ,45 + ,33 + ,112 + ,105612 + ,144756 + ,201345 + ,60 + ,409 + ,88 + ,28 + ,81 + ,62853 + ,129825 + ,163833 + ,114 + ,493 + ,67 + ,31 + ,116 + ,125976 + ,92189 + ,204250 + ,129 + ,757 + ,75 + ,40 + ,132 + ,79146 + ,121158 + ,197813 + ,67 + ,736 + ,114 + ,32 + ,104 + ,108461 + ,96219 + ,132955 + ,60 + ,511 + ,123 + ,25 + ,80 + ,99971 + ,84128 + ,216092 + ,59 + ,789 + ,86 + ,42 + ,145 + ,77826 + ,97960 + ,73566 + ,32 + ,385 + ,22 + ,23 + ,67 + ,22618 + ,23824 + ,213198 + ,67 + ,644 + ,67 + ,42 + ,159 + ,84892 + ,103515 + ,181713 + ,50 + ,664 + ,77 + ,38 + ,90 + ,92059 + ,91313 + ,148698 + ,49 + ,505 + ,105 + ,34 + ,120 + ,77993 + ,85407 + ,300103 + ,70 + ,878 + ,119 + ,38 + ,126 + ,104155 + ,95871 + ,251437 + ,78 + ,769 + ,88 + ,32 + ,118 + ,109840 + ,143846 + ,197295 + ,101 + ,499 + ,78 + ,37 + ,112 + ,238712 + ,155387 + ,158163 + ,55 + ,546 + ,112 + ,34 + ,123 + ,67486 + ,74429 + ,155529 + ,57 + ,551 + ,66 + ,33 + ,98 + ,68007 + ,74004 + ,132672 + ,41 + ,565 + ,58 + ,25 + ,78 + ,48194 + ,71987 + ,377213 + ,102 + ,1087 + ,132 + ,40 + ,119 + ,134796 + ,150629 + ,145905 + ,66 + ,649 + ,30 + ,26 + ,99 + ,38692 + ,68580 + ,223701 + ,87 + ,540 + ,100 + ,40 + ,81 + ,93587 + ,119855 + ,80953 + ,25 + ,437 + ,49 + ,8 + ,27 + ,56622 + ,55792 + ,130805 + ,47 + ,732 + ,26 + ,27 + ,77 + ,15986 + ,25157 + ,135082 + ,48 + ,308 + ,67 + ,32 + ,118 + ,113402 + ,90895 + ,305270 + ,160 + ,1243 + ,57 + ,33 + ,122 + ,97967 + ,117510 + ,271806 + ,95 + ,783 + ,95 + ,50 + ,103 + ,74844 + ,144774 + ,150949 + ,96 + ,933 + ,139 + ,37 + ,129 + ,136051 + ,77529 + ,225805 + ,79 + ,710 + ,73 + ,33 + ,69 + ,50548 + ,103123 + ,197389 + ,68 + ,563 + ,134 + ,34 + ,121 + ,112215 + ,104669 + ,156583 + ,56 + ,508 + ,37 + ,28 + ,81 + ,59591 + ,82414 + ,232718 + ,68 + ,968 + ,108 + ,36 + ,135 + ,59938 + ,82390 + ,261601 + ,70 + ,838 + ,58 + ,32 + ,116 + ,137639 + ,128446 + ,178489 + ,35 + ,523 + ,78 + ,32 + ,123 + ,143372 + ,111542 + ,200657 + ,44 + ,500 + ,88 + ,31 + ,111 + ,138599 + ,136048 + ,259244 + ,69 + ,694 + ,142 + ,35 + ,100 + ,174110 + ,197257 + ,313075 + ,130 + ,1060 + ,127 + ,58 + ,221 + ,135062 + ,162079 + ,346933 + ,100 + ,1232 + ,139 + ,27 + ,95 + ,175681 + ,206286 + ,246440 + ,104 + ,735 + ,108 + ,45 + ,153 + ,130307 + ,109858 + ,252444 + ,58 + ,757 + ,128 + ,37 + ,118 + ,139141 + ,182125 + ,159965 + ,159 + ,574 + ,62 + ,32 + ,50 + ,44244 + ,74168 + ,43287 + ,14 + ,214 + ,13 + ,19 + ,64 + ,43750 + ,19630 + ,172239 + ,68 + ,661 + ,89 + ,22 + ,34 + ,48029 + ,88634 + ,185198 + ,121 + ,640 + ,83 + ,35 + ,76 + ,95216 + ,128321 + ,227681 + ,43 + ,1015 + ,116 + ,36 + ,112 + ,92288 + ,118936 + ,260464 + ,81 + ,893 + ,157 + ,36 + ,115 + ,94588 + ,127044 + ,106288 + ,54 + ,293 + ,28 + ,23 + ,69 + ,197426 + ,178377 + ,109632 + ,77 + ,446 + ,83 + ,36 + ,108 + ,151244 + ,69581 + ,268905 + ,58 + ,538 + ,72 + ,36 + ,130 + ,139206 + ,168019 + ,266805 + ,78 + ,627 + ,134 + ,42 + ,110 + ,106271 + ,113598 + ,23623 + ,11 + ,156 + ,12 + ,1 + ,0 + ,1168 + ,5841 + ,152474 + ,66 + ,577 + ,106 + ,32 + ,83 + ,71764 + ,93116 + ,61857 + ,25 + ,192 + ,23 + ,11 + ,30 + ,25162 + ,24610 + ,144889 + ,43 + ,437 + ,83 + ,40 + ,106 + ,45635 + ,60611 + ,346600 + ,99 + ,1054 + ,126 + ,34 + ,91 + ,101817 + ,226620 + ,21054 + ,16 + ,146 + ,4 + ,0 + ,0 + ,855 + ,6622 + ,224051 + ,45 + ,751 + ,71 + ,27 + ,69 + ,100174 + ,121996 + ,31414 + ,19 + ,200 + ,18 + ,8 + ,9 + ,14116 + ,13155 + ,261043 + ,105 + ,1050 + ,98 + ,35 + ,123 + ,85008 + ,154158 + ,206108 + ,58 + ,601 + ,66 + ,44 + ,150 + ,124254 + ,78489 + ,154984 + ,74 + ,430 + ,44 + ,40 + ,125 + ,105793 + ,22007 + ,112933 + ,45 + ,467 + ,29 + ,28 + ,81 + ,117129 + ,72530 + ,38214 + ,34 + ,276 + ,16 + ,8 + ,21 + ,8773 + ,13983 + ,158671 + ,33 + ,528 + ,56 + ,35 + ,124 + ,94747 + ,73397 + ,302148 + ,71 + ,898 + ,112 + ,47 + ,168 + ,107549 + ,143878 + ,177918 + ,55 + ,411 + ,46 + ,46 + ,149 + ,97392 + ,119956 + ,350552 + ,70 + ,1362 + ,129 + ,42 + ,147 + ,126893 + ,181558 + ,275578 + ,91 + ,743 + ,139 + ,48 + ,145 + ,118850 + ,208236 + ,368746 + ,106 + ,1069 + ,136 + ,49 + ,172 + ,234853 + ,237085 + ,172464 + ,31 + ,431 + ,66 + ,35 + ,126 + ,74783 + ,110297 + ,94381 + ,35 + ,380 + ,42 + ,32 + ,89 + ,66089 + ,61394 + ,244295 + ,281 + ,790 + ,70 + ,36 + ,137 + ,95684 + ,81420 + ,382487 + ,154 + ,1367 + ,97 + ,42 + ,149 + ,139537 + ,191154 + ,114525 + ,40 + ,449 + ,49 + ,35 + ,121 + ,144253 + ,11798 + ,345884 + ,120 + ,1495 + ,113 + ,42 + ,149 + ,153824 + ,135724 + ,147989 + ,72 + ,651 + ,55 + ,34 + ,93 + ,63995 + ,68614 + ,216638 + ,45 + ,494 + ,100 + ,36 + ,119 + ,84891 + ,139926 + ,192862 + ,72 + ,667 + ,80 + ,36 + ,102 + ,61263 + ,105203 + ,184818 + ,107 + ,510 + ,29 + ,32 + ,45 + ,106221 + ,80338 + ,336707 + ,105 + ,1472 + ,95 + ,33 + ,104 + ,113587 + ,121376 + ,215836 + ,76 + ,675 + ,114 + ,35 + ,111 + ,113864 + ,124922 + ,173260 + ,63 + ,716 + ,41 + ,21 + ,78 + ,37238 + ,10901 + ,271773 + ,89 + ,814 + ,128 + ,40 + ,120 + ,119906 + ,135471 + ,130908 + ,52 + ,556 + ,142 + ,49 + ,176 + ,135096 + ,66395 + ,204009 + ,75 + ,887 + ,88 + ,33 + ,109 + ,151611 + ,134041 + ,245514 + ,92 + ,663 + ,147 + ,39 + ,132 + ,144645 + ,153554 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,14688 + ,10 + ,85 + ,4 + ,0 + ,0 + ,6023 + ,7953 + ,98 + ,1 + ,0 + ,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 + ,0 + ,0 + ,0 + ,195765 + ,75 + ,607 + ,56 + ,33 + ,78 + ,77457 + ,98922 + ,326038 + ,121 + ,934 + ,121 + ,42 + ,104 + ,62464 + ,165395 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,203 + ,4 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,7199 + ,5 + ,74 + ,7 + ,0 + ,0 + ,1644 + ,4245 + ,46660 + ,20 + ,259 + ,12 + ,5 + ,13 + ,6179 + ,21509 + ,17547 + ,5 + ,69 + ,0 + ,1 + ,4 + ,3926 + ,7670 + ,107465 + ,38 + ,267 + ,37 + ,38 + ,65 + ,42087 + ,15167 + ,969 + ,2 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,173102 + ,58 + ,517 + ,47 + ,28 + ,55 + ,87656 + ,63891) + ,dim=c(8 + ,164) + ,dimnames=list(c('Time' + ,'Logins' + ,'CompendiumViews' + ,'BloggedComputations' + ,'ReviewedCompendiums' + ,'LongFeedbackmessages' + ,'Characters' + ,'WritingTime') + ,1:164)) > y <- array(NA,dim=c(8,164),dimnames=list(c('Time','Logins','CompendiumViews','BloggedComputations','ReviewedCompendiums','LongFeedbackmessages','Characters','WritingTime'),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 = '3' > par2 = 'none' > par1 = '1' > library(party) Loading required package: survival Loading required package: splines Loading required package: grid Loading required package: modeltools Loading required package: stats4 Loading required package: coin Loading required package: mvtnorm Loading required package: zoo Loading required package: sandwich Loading required package: strucchange Loading required package: vcd Loading required package: MASS Loading required package: colorspace > library(Hmisc) Attaching package: 'Hmisc' The following object(s) are masked from 'package:survival': untangle.specials The following object(s) are masked from 'package:base': format.pval, round.POSIXt, trunc.POSIXt, units > par1 <- as.numeric(par1) > par3 <- as.numeric(par3) > x <- data.frame(t(y)) > is.data.frame(x) [1] TRUE > x <- x[!is.na(x[,par1]),] > k <- length(x[1,]) > n <- length(x[,1]) > colnames(x)[par1] [1] "Time" > x[,par1] [1] 252101 134577 198520 189326 137449 65295 439387 33186 178368 186657 [11] 265539 191088 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 346011 191653 114673 284224 [41] 284195 155363 177306 144571 140319 405267 78800 201970 302674 164733 [51] 194221 24188 346142 65029 101097 246088 273108 282220 275505 214872 [61] 335121 267171 189637 229512 209798 201345 163833 204250 197813 132955 [71] 216092 73566 213198 181713 148698 300103 251437 197295 158163 155529 [81] 132672 377213 145905 223701 80953 130805 135082 305270 271806 150949 [91] 225805 197389 156583 232718 261601 178489 200657 259244 313075 346933 [101] 246440 252444 159965 43287 172239 185198 227681 260464 106288 109632 [111] 268905 266805 23623 152474 61857 144889 346600 21054 224051 31414 [121] 261043 206108 154984 112933 38214 158671 302148 177918 350552 275578 [131] 368746 172464 94381 244295 382487 114525 345884 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 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 106288 107465 109632 112933 114525 114673 130805 1 1 1 1 1 1 1 1 1 1 1 130908 132672 132955 134577 135082 137449 138866 140319 142329 144571 144889 1 1 1 1 1 1 1 1 1 1 1 145905 147989 148421 148698 150949 152474 154984 155363 155529 155679 156540 1 1 1 1 1 1 1 1 1 1 1 156583 158163 158671 159965 163833 164733 172239 172464 173102 173260 176062 1 1 1 1 1 1 1 1 1 1 1 177306 177732 177918 178368 178489 181713 184818 185198 186657 189326 189637 1 1 1 1 1 1 1 1 1 1 1 191088 191441 191653 192648 192862 194221 195765 197295 197389 197813 198520 1 1 1 1 1 1 1 1 1 1 1 200657 201345 201970 204009 204250 206108 209798 213198 214872 215836 216092 1 1 1 1 1 1 1 1 1 1 1 216638 223701 224051 225805 227053 227681 229512 231625 232718 236812 240028 1 1 1 1 1 1 1 1 1 1 1 243571 244295 245514 246088 246440 247082 249893 251437 252101 252444 259244 1 1 1 1 1 1 1 1 1 1 1 259667 260464 261043 261601 263451 265539 266805 267171 268905 271773 271806 1 1 1 1 1 1 1 1 1 1 1 273108 275505 275578 282220 284195 284224 286683 296878 300103 302148 302674 1 1 1 1 1 1 1 1 1 1 1 305270 313075 322865 326038 333462 335121 336707 345884 346011 346142 346600 1 1 1 1 1 1 1 1 1 1 1 346933 350552 368746 377213 382487 388549 405267 439387 1 1 1 1 1 1 1 1 > colnames(x) [1] "Time" "Logins" "CompendiumViews" [4] "BloggedComputations" "ReviewedCompendiums" "LongFeedbackmessages" [7] "Characters" "WritingTime" > colnames(x)[par1] [1] "Time" > x[,par1] [1] 252101 134577 198520 189326 137449 65295 439387 33186 178368 186657 [11] 265539 191088 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 346011 191653 114673 284224 [41] 284195 155363 177306 144571 140319 405267 78800 201970 302674 164733 [51] 194221 24188 346142 65029 101097 246088 273108 282220 275505 214872 [61] 335121 267171 189637 229512 209798 201345 163833 204250 197813 132955 [71] 216092 73566 213198 181713 148698 300103 251437 197295 158163 155529 [81] 132672 377213 145905 223701 80953 130805 135082 305270 271806 150949 [91] 225805 197389 156583 232718 261601 178489 200657 259244 313075 346933 [101] 246440 252444 159965 43287 172239 185198 227681 260464 106288 109632 [111] 268905 266805 23623 152474 61857 144889 346600 21054 224051 31414 [121] 261043 206108 154984 112933 38214 158671 302148 177918 350552 275578 [131] 368746 172464 94381 244295 382487 114525 345884 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 == '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/11d031324649851.tab") + } + } > m Conditional inference tree with 10 terminal nodes Response: Time Inputs: Logins, CompendiumViews, BloggedComputations, ReviewedCompendiums, LongFeedbackmessages, Characters, WritingTime Number of observations: 164 1) CompendiumViews <= 385; criterion = 1, statistic = 127.741 2) BloggedComputations <= 18; criterion = 1, statistic = 27.342 3) WritingTime <= 4245; criterion = 1, statistic = 16.012 4)* weights = 9 3) WritingTime > 4245 5)* weights = 11 2) BloggedComputations > 18 6)* weights = 12 1) CompendiumViews > 385 7) CompendiumViews <= 1015; criterion = 1, statistic = 81.018 8) WritingTime <= 111542; criterion = 1, statistic = 63.901 9) CompendiumViews <= 577; criterion = 1, statistic = 21.348 10) WritingTime <= 72530; criterion = 0.998, statistic = 12.765 11)* weights = 13 10) WritingTime > 72530 12)* weights = 22 9) CompendiumViews > 577 13)* weights = 31 8) WritingTime > 111542 14) CompendiumViews <= 675; criterion = 0.998, statistic = 13.357 15)* weights = 19 14) CompendiumViews > 675 16) Logins <= 78; criterion = 0.986, statistic = 9.557 17)* weights = 12 16) Logins > 78 18)* weights = 15 7) CompendiumViews > 1015 19)* weights = 20 > postscript(file="/var/www/rcomp/tmp/26pnp1324649851.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/3c46u1324649851.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 252101 221778.0000 30323.00000 2 134577 99721.0000 34856.00000 3 198520 199820.9355 -1300.93548 4 189326 199820.9355 -10494.93548 5 137449 99721.0000 37728.00000 6 65295 32650.5455 32644.45455 7 439387 344602.0500 94784.95000 8 33186 32650.5455 535.45455 9 178368 199820.9355 -21452.93548 10 186657 167006.4545 19650.54545 11 265539 275382.4667 -9843.46667 12 191088 167006.4545 24081.54545 13 138866 129343.1538 9522.84615 14 296878 199820.9355 97057.06452 15 192648 167006.4545 25641.54545 16 333462 344602.0500 -11140.05000 17 243571 221778.0000 21793.00000 18 263451 275382.4667 -11931.46667 19 155679 167006.4545 -11327.45455 20 227053 221778.0000 5275.00000 21 240028 246668.5833 -6640.58333 22 388549 344602.0500 43946.95000 23 156540 167006.4545 -10466.45455 24 148421 167006.4545 -18585.45455 25 177732 199820.9355 -22088.93548 26 191441 199820.9355 -8379.93548 27 249893 275382.4667 -25489.46667 28 236812 221778.0000 15034.00000 29 142329 129343.1538 12985.84615 30 259667 246668.5833 12998.41667 31 231625 246668.5833 -15043.58333 32 176062 167006.4545 9055.54545 33 286683 275382.4667 11300.53333 34 87485 99721.0000 -12236.00000 35 322865 344602.0500 -21737.05000 36 247082 199820.9355 47261.06452 37 346011 344602.0500 1408.95000 38 191653 167006.4545 24646.54545 39 114673 99721.0000 14952.00000 40 284224 275382.4667 8841.53333 41 284195 344602.0500 -60407.05000 42 155363 167006.4545 -11643.45455 43 177306 221778.0000 -44472.00000 44 144571 129343.1538 15227.84615 45 140319 199820.9355 -59501.93548 46 405267 344602.0500 60664.95000 47 78800 99721.0000 -20921.00000 48 201970 199820.9355 2149.06452 49 302674 344602.0500 -41928.05000 50 164733 199820.9355 -35087.93548 51 194221 221778.0000 -27557.00000 52 24188 32650.5455 -8462.54545 53 346142 275382.4667 70759.53333 54 65029 99721.0000 -34692.00000 55 101097 129343.1538 -28246.15385 56 246088 246668.5833 -580.58333 57 273108 221778.0000 51330.00000 58 282220 275382.4667 6837.53333 59 275505 275382.4667 122.53333 60 214872 199820.9355 15051.06452 61 335121 344602.0500 -9481.05000 62 267171 275382.4667 -8211.46667 63 189637 199820.9355 -10183.93548 64 229512 199820.9355 29691.06452 65 209798 221778.0000 -11980.00000 66 201345 221778.0000 -20433.00000 67 163833 167006.4545 -3173.45455 68 204250 275382.4667 -71132.46667 69 197813 199820.9355 -2007.93548 70 132955 167006.4545 -34051.45455 71 216092 199820.9355 16271.06452 72 73566 99721.0000 -26155.00000 73 213198 199820.9355 13377.06452 74 181713 199820.9355 -18107.93548 75 148698 167006.4545 -18308.45455 76 300103 199820.9355 100282.06452 77 251437 246668.5833 4768.41667 78 197295 221778.0000 -24483.00000 79 158163 167006.4545 -8843.45455 80 155529 167006.4545 -11477.45455 81 132672 129343.1538 3328.84615 82 377213 344602.0500 32610.95000 83 145905 199820.9355 -53915.93548 84 223701 221778.0000 1923.00000 85 80953 129343.1538 -48390.15385 86 130805 199820.9355 -69015.93548 87 135082 99721.0000 35361.00000 88 305270 344602.0500 -39332.05000 89 271806 275382.4667 -3576.46667 90 150949 199820.9355 -48871.93548 91 225805 199820.9355 25984.06452 92 197389 167006.4545 30382.54545 93 156583 167006.4545 -10423.45455 94 232718 199820.9355 32897.06452 95 261601 246668.5833 14932.41667 96 178489 167006.4545 11482.54545 97 200657 221778.0000 -21121.00000 98 259244 246668.5833 12575.41667 99 313075 344602.0500 -31527.05000 100 346933 344602.0500 2330.95000 101 246440 199820.9355 46619.06452 102 252444 246668.5833 5775.41667 103 159965 167006.4545 -7041.45455 104 43287 32650.5455 10636.45455 105 172239 199820.9355 -27581.93548 106 185198 221778.0000 -36580.00000 107 227681 246668.5833 -18987.58333 108 260464 275382.4667 -14918.46667 109 106288 99721.0000 6567.00000 110 109632 129343.1538 -19711.15385 111 268905 221778.0000 47127.00000 112 266805 221778.0000 45027.00000 113 23623 32650.5455 -9027.54545 114 152474 167006.4545 -14532.45455 115 61857 99721.0000 -37864.00000 116 144889 129343.1538 15545.84615 117 346600 344602.0500 1997.95000 118 21054 32650.5455 -11596.54545 119 224051 246668.5833 -22617.58333 120 31414 32650.5455 -1236.54545 121 261043 344602.0500 -83559.05000 122 206108 199820.9355 6287.06452 123 154984 129343.1538 25640.84615 124 112933 129343.1538 -16410.15385 125 38214 32650.5455 5563.45455 126 158671 167006.4545 -8335.45455 127 302148 246668.5833 55479.41667 128 177918 221778.0000 -43860.00000 129 350552 344602.0500 5949.95000 130 275578 275382.4667 195.53333 131 368746 344602.0500 24143.95000 132 172464 167006.4545 5457.54545 133 94381 99721.0000 -5340.00000 134 244295 199820.9355 44474.06452 135 382487 344602.0500 37884.95000 136 114525 129343.1538 -14818.15385 137 345884 344602.0500 1281.95000 138 147989 199820.9355 -51831.93548 139 216638 221778.0000 -5140.00000 140 192862 199820.9355 -6958.93548 141 184818 167006.4545 17811.54545 142 336707 344602.0500 -7895.05000 143 215836 221778.0000 -5942.00000 144 173260 199820.9355 -26560.93548 145 271773 275382.4667 -3609.46667 146 130908 129343.1538 1564.84615 147 204009 246668.5833 -42659.58333 148 245514 221778.0000 23736.00000 149 1 991.6667 -990.66667 150 14688 32650.5455 -17962.54545 151 98 991.6667 -893.66667 152 455 991.6667 -536.66667 153 0 991.6667 -991.66667 154 0 991.6667 -991.66667 155 195765 199820.9355 -4055.93548 156 326038 275382.4667 50655.53333 157 0 991.6667 -991.66667 158 203 991.6667 -788.66667 159 7199 991.6667 6207.33333 160 46660 32650.5455 14009.45455 161 17547 32650.5455 -15103.54545 162 107465 99721.0000 7744.00000 163 969 991.6667 -22.66667 164 173102 129343.1538 43758.84615 > 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/4v5p71324649851.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/58ynp1324649851.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/6c0291324649851.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/7k7ac1324649851.tab") + } > > try(system("convert tmp/26pnp1324649851.ps tmp/26pnp1324649851.png",intern=TRUE)) character(0) > try(system("convert tmp/3c46u1324649851.ps tmp/3c46u1324649851.png",intern=TRUE)) character(0) > try(system("convert tmp/4v5p71324649851.ps tmp/4v5p71324649851.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.090 0.130 3.195