R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list(165119 + ,62 + ,438 + ,92 + ,34 + ,104 + ,124252 + ,252101 + ,107269 + ,59 + ,330 + ,58 + ,30 + ,111 + ,98956 + ,134577 + ,93497 + ,62 + ,609 + ,62 + ,38 + ,93 + ,98073 + ,198520 + ,100269 + ,94 + ,1015 + ,108 + ,34 + ,119 + ,106816 + ,189326 + ,91627 + ,44 + ,294 + ,55 + ,25 + ,57 + ,41449 + ,137449 + ,47552 + ,27 + ,164 + ,8 + ,31 + ,80 + ,76173 + ,65295 + ,233933 + ,103 + ,1912 + ,134 + ,29 + ,107 + ,177551 + ,439387 + ,6853 + ,19 + ,111 + ,1 + ,18 + ,22 + ,22807 + ,33186 + ,104380 + ,51 + ,698 + ,64 + ,30 + ,103 + ,126938 + ,178368 + ,98431 + ,38 + ,556 + ,77 + ,29 + ,72 + ,61680 + ,186657 + ,156949 + ,97 + ,717 + ,86 + ,39 + ,127 + ,72117 + ,265539 + ,81817 + ,96 + ,495 + ,93 + ,50 + ,168 + ,79738 + ,191088 + ,59238 + ,57 + ,544 + ,44 + ,33 + ,100 + ,57793 + ,138866 + ,101138 + ,66 + ,959 + ,106 + ,46 + ,143 + ,91677 + ,296878 + ,107158 + ,72 + ,540 + ,63 + ,38 + ,79 + ,64631 + ,192648 + ,155499 + ,162 + ,1486 + ,160 + ,52 + ,183 + ,106385 + ,333462 + ,156274 + ,58 + ,635 + ,104 + ,32 + ,123 + ,161961 + ,243571 + ,121777 + ,130 + ,940 + ,86 + ,35 + ,81 + ,112669 + ,263451 + ,105037 + ,49 + ,452 + ,93 + ,25 + ,74 + ,114029 + ,155679 + ,118661 + ,71 + ,617 + ,119 + ,42 + ,158 + ,124550 + ,227053 + ,131187 + ,63 + ,695 + ,107 + ,40 + ,133 + ,105416 + ,240028 + ,145026 + ,90 + ,1046 + ,86 + ,35 + ,128 + ,72875 + ,388549 + ,107016 + ,34 + ,405 + ,50 + ,25 + ,84 + ,81964 + ,156540 + ,87242 + ,43 + ,477 + ,92 + ,46 + ,184 + ,104880 + ,148421 + ,91699 + ,97 + ,1012 + ,123 + ,36 + ,127 + ,76302 + ,177732 + ,110087 + ,106 + ,842 + ,81 + ,35 + ,128 + ,96740 + ,191441 + ,145447 + ,122 + ,994 + ,93 + ,38 + ,118 + ,93071 + ,249893 + ,143307 + ,76 + ,530 + ,113 + ,35 + ,125 + ,78912 + ,236812 + ,61678 + ,45 + ,515 + ,52 + ,28 + ,89 + ,35224 + ,142329 + ,210080 + ,53 + ,766 + ,113 + ,37 + ,122 + ,90694 + ,259667 + ,165005 + ,66 + ,734 + ,112 + ,40 + ,151 + ,125369 + ,231625 + ,97806 + ,67 + ,551 + ,44 + ,42 + ,122 + ,80849 + ,176062 + ,184471 + ,79 + ,718 + ,123 + ,44 + ,162 + ,104434 + ,286683 + ,27786 + ,33 + ,280 + ,38 + ,33 + ,121 + ,65702 + ,87485 + ,184458 + ,83 + ,1055 + ,111 + ,35 + ,132 + ,108179 + ,322865 + ,98765 + ,51 + ,950 + ,77 + ,37 + ,110 + ,63583 + ,247082 + ,178441 + ,106 + ,1038 + ,92 + ,39 + ,135 + ,95066 + ,346011 + ,100619 + ,74 + ,552 + ,74 + ,32 + ,80 + ,62486 + ,191653 + ,58391 + ,31 + ,275 + ,33 + ,17 + ,46 + ,31081 + ,114673 + ,151672 + ,162 + ,986 + ,105 + ,34 + ,127 + ,94584 + ,284224 + ,124437 + ,72 + ,1336 + ,108 + ,33 + ,103 + ,87408 + ,284195 + ,79929 + ,60 + ,565 + ,66 + ,35 + ,95 + ,68966 + ,155363 + ,123064 + ,67 + ,571 + ,69 + ,32 + ,100 + ,88766 + ,177306 + ,50466 + ,49 + ,404 + ,62 + ,35 + ,102 + ,57139 + ,144571 + ,100991 + ,73 + ,985 + ,50 + ,45 + ,45 + ,90586 + ,140319 + ,79367 + ,135 + ,1851 + ,91 + ,38 + ,122 + ,109249 + ,405267 + ,56968 + ,42 + ,330 + ,20 + ,26 + ,66 + ,33032 + ,78800 + ,106257 + ,69 + ,611 + ,101 + ,45 + ,159 + ,96056 + ,201970 + ,178412 + ,99 + ,1249 + ,129 + ,44 + ,153 + ,146648 + ,302674 + ,98520 + ,50 + ,812 + ,93 + ,40 + ,131 + ,80613 + ,164733 + ,153670 + ,68 + ,501 + ,89 + ,33 + ,113 + ,87026 + ,194221 + ,15049 + ,24 + ,218 + ,8 + ,4 + ,7 + ,5950 + ,24188 + ,174478 + ,282 + ,787 + ,80 + ,41 + ,147 + ,131106 + ,346142 + ,25109 + ,17 + ,255 + ,21 + ,18 + ,61 + ,32551 + ,65029 + ,45824 + ,64 + ,454 + ,30 + ,14 + ,41 + ,31701 + ,101097 + ,116772 + ,46 + ,944 + ,86 + ,33 + ,108 + ,91072 + ,246088 + ,189150 + ,75 + ,600 + ,116 + ,49 + ,184 + ,159803 + ,273108 + ,194404 + ,160 + ,977 + ,106 + ,32 + ,115 + ,143950 + ,282220 + ,185881 + ,120 + ,872 + ,127 + ,37 + ,132 + ,112368 + ,275505 + ,67508 + ,74 + ,690 + ,75 + ,32 + ,113 + ,82124 + ,214872 + ,188597 + ,124 + ,1176 + ,138 + ,41 + ,141 + ,144068 + ,335121 + ,203618 + ,107 + ,1013 + ,114 + ,25 + ,65 + ,162627 + ,267171 + ,87232 + ,89 + ,894 + ,55 + ,42 + ,94 + ,55062 + ,189637 + ,110875 + ,78 + ,777 + ,67 + ,35 + ,121 + ,95329 + ,229512 + ,144756 + ,61 + ,521 + ,45 + ,33 + ,112 + ,105612 + ,209798 + ,129825 + ,60 + ,409 + ,88 + ,28 + ,81 + ,62853 + ,201345 + ,92189 + ,114 + ,493 + ,67 + ,31 + ,116 + ,125976 + ,163833 + ,121158 + ,129 + ,757 + ,75 + ,40 + ,132 + ,79146 + ,204250 + ,96219 + ,67 + ,736 + ,114 + ,32 + ,104 + ,108461 + ,197813 + ,84128 + ,60 + ,511 + ,123 + ,25 + ,80 + ,99971 + ,132955 + ,97960 + ,59 + ,789 + ,86 + ,42 + ,145 + ,77826 + ,216092 + ,23824 + ,32 + ,385 + ,22 + ,23 + ,67 + ,22618 + ,73566 + ,103515 + ,67 + ,644 + ,67 + ,42 + ,159 + ,84892 + ,213198 + ,91313 + ,50 + ,664 + ,77 + ,38 + ,90 + ,92059 + ,181713 + ,85407 + ,49 + ,505 + ,105 + ,34 + ,120 + ,77993 + ,148698 + ,95871 + ,70 + ,878 + ,119 + ,38 + ,126 + ,104155 + ,300103 + ,143846 + ,78 + ,769 + ,88 + ,32 + ,118 + ,109840 + ,251437 + ,155387 + ,101 + ,499 + ,78 + ,37 + ,112 + ,238712 + ,197295 + ,74429 + ,55 + ,546 + ,112 + ,34 + ,123 + ,67486 + ,158163 + ,74004 + ,57 + ,551 + ,66 + ,33 + ,98 + ,68007 + ,155529 + ,71987 + ,41 + ,565 + ,58 + ,25 + ,78 + ,48194 + ,132672 + ,150629 + ,102 + ,1087 + ,132 + ,40 + ,119 + ,134796 + ,377213 + ,68580 + ,66 + ,649 + ,30 + ,26 + ,99 + ,38692 + ,145905 + ,119855 + ,87 + ,540 + ,100 + ,40 + ,81 + ,93587 + ,223701 + ,55792 + ,25 + ,437 + ,49 + ,8 + ,27 + ,56622 + ,80953 + ,25157 + ,47 + ,732 + ,26 + ,27 + ,77 + ,15986 + ,130805 + ,90895 + ,48 + ,308 + ,67 + ,32 + ,118 + ,113402 + ,135082 + ,117510 + ,160 + ,1243 + ,57 + ,33 + ,122 + ,97967 + ,305270 + ,144774 + ,95 + ,783 + ,95 + ,50 + ,103 + ,74844 + ,271806 + ,77529 + ,96 + ,933 + ,139 + ,37 + ,129 + ,136051 + ,150949 + ,103123 + ,79 + ,710 + ,73 + ,33 + ,69 + ,50548 + ,225805 + ,104669 + ,68 + ,563 + ,134 + ,34 + ,121 + ,112215 + ,197389 + ,82414 + ,56 + ,508 + ,37 + ,28 + ,81 + ,59591 + ,156583 + ,82390 + ,68 + ,968 + ,108 + ,36 + ,135 + ,59938 + ,232718 + ,128446 + ,70 + ,838 + ,58 + ,32 + ,116 + ,137639 + ,261601 + ,111542 + ,35 + ,523 + ,78 + ,32 + ,123 + ,143372 + ,178489 + ,136048 + ,44 + ,500 + ,88 + ,31 + ,111 + ,138599 + ,200657 + ,197257 + ,69 + ,694 + ,142 + ,35 + ,100 + ,174110 + ,259244 + ,162079 + ,130 + ,1060 + ,127 + ,58 + ,221 + ,135062 + ,313075 + ,206286 + ,100 + ,1232 + ,139 + ,27 + ,95 + ,175681 + ,346933 + ,109858 + ,104 + ,735 + ,108 + ,45 + ,153 + ,130307 + ,246440 + ,182125 + ,58 + ,757 + ,128 + ,37 + ,118 + ,139141 + ,252444 + ,74168 + ,159 + ,574 + ,62 + ,32 + ,50 + ,44244 + ,159965 + ,19630 + ,14 + ,214 + ,13 + ,19 + ,64 + ,43750 + ,43287 + ,88634 + ,68 + ,661 + ,89 + ,22 + ,34 + ,48029 + ,172239 + ,128321 + ,121 + ,640 + ,83 + ,35 + ,76 + ,95216 + ,185198 + ,118936 + ,43 + ,1015 + ,116 + ,36 + ,112 + ,92288 + ,227681 + ,127044 + ,81 + ,893 + ,157 + ,36 + ,115 + ,94588 + ,260464 + ,178377 + ,54 + ,293 + ,28 + ,23 + ,69 + ,197426 + ,106288 + ,69581 + ,77 + ,446 + ,83 + ,36 + ,108 + ,151244 + ,109632 + ,168019 + ,58 + ,538 + ,72 + ,36 + ,130 + ,139206 + ,268905 + ,113598 + ,78 + ,627 + ,134 + ,42 + ,110 + ,106271 + ,266805 + ,5841 + ,11 + ,156 + ,12 + ,1 + ,0 + ,1168 + ,23623 + ,93116 + ,66 + ,577 + ,106 + ,32 + ,83 + ,71764 + ,152474 + ,24610 + ,25 + ,192 + ,23 + ,11 + ,30 + ,25162 + ,61857 + ,60611 + ,43 + ,437 + ,83 + ,40 + ,106 + ,45635 + ,144889 + ,226620 + ,99 + ,1054 + ,126 + ,34 + ,91 + ,101817 + ,346600 + ,6622 + ,16 + ,146 + ,4 + ,0 + ,0 + ,855 + ,21054 + ,121996 + ,45 + ,751 + ,71 + ,27 + ,69 + ,100174 + ,224051 + ,13155 + ,19 + ,200 + ,18 + ,8 + ,9 + ,14116 + ,31414 + ,154158 + ,105 + ,1050 + ,98 + ,35 + ,123 + ,85008 + ,261043 + ,78489 + ,58 + ,601 + ,66 + ,44 + ,150 + ,124254 + ,206108 + ,22007 + ,74 + ,430 + ,44 + ,40 + ,125 + ,105793 + ,154984 + ,72530 + ,45 + ,467 + ,29 + ,28 + ,81 + ,117129 + ,112933 + ,13983 + ,34 + ,276 + ,16 + ,8 + ,21 + ,8773 + ,38214 + ,73397 + ,33 + ,528 + ,56 + ,35 + ,124 + ,94747 + ,158671 + ,143878 + ,71 + ,898 + ,112 + ,47 + ,168 + ,107549 + ,302148 + ,119956 + ,55 + ,411 + ,46 + ,46 + ,149 + ,97392 + ,177918 + ,181558 + ,70 + ,1362 + ,129 + ,42 + ,147 + ,126893 + ,350552 + ,208236 + ,91 + ,743 + ,139 + ,48 + ,145 + ,118850 + ,275578 + ,237085 + ,106 + ,1069 + ,136 + ,49 + ,172 + ,234853 + ,368746 + ,110297 + ,31 + ,431 + ,66 + ,35 + ,126 + ,74783 + ,172464 + ,61394 + ,35 + ,380 + ,42 + ,32 + ,89 + ,66089 + ,94381 + ,81420 + ,281 + ,790 + ,70 + ,36 + ,137 + ,95684 + ,244295 + ,191154 + ,154 + ,1367 + ,97 + ,42 + ,149 + ,139537 + ,382487 + ,11798 + ,40 + ,449 + ,49 + ,35 + ,121 + ,144253 + ,114525 + ,135724 + ,120 + ,1495 + ,113 + ,42 + ,149 + ,153824 + ,345884 + ,68614 + ,72 + ,651 + ,55 + ,34 + ,93 + ,63995 + ,147989 + ,139926 + ,45 + ,494 + ,100 + ,36 + ,119 + ,84891 + ,216638 + ,105203 + ,72 + ,667 + ,80 + ,36 + ,102 + ,61263 + ,192862 + ,80338 + ,107 + ,510 + ,29 + ,32 + ,45 + ,106221 + ,184818 + ,121376 + ,105 + ,1472 + ,95 + ,33 + ,104 + ,113587 + ,336707 + ,124922 + ,76 + ,675 + ,114 + ,35 + ,111 + ,113864 + ,215836 + ,10901 + ,63 + ,716 + ,41 + ,21 + ,78 + ,37238 + ,173260 + ,135471 + ,89 + ,814 + ,128 + ,40 + ,120 + ,119906 + ,271773 + ,66395 + ,52 + ,556 + ,142 + ,49 + ,176 + ,135096 + ,130908 + ,134041 + ,75 + ,887 + ,88 + ,33 + ,109 + ,151611 + ,204009 + ,153554 + ,92 + ,663 + ,147 + ,39 + ,132 + ,144645 + ,245514 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1 + ,7953 + ,10 + ,85 + ,4 + ,0 + ,0 + ,6023 + ,14688 + ,0 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,98 + ,0 + ,2 + ,0 + ,0 + ,0 + ,0 + ,0 + ,455 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,98922 + ,75 + ,607 + ,56 + ,33 + ,78 + ,77457 + ,195765 + ,165395 + ,121 + ,934 + ,121 + ,42 + ,104 + ,62464 + ,326038 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,4 + ,0 + ,0 + ,0 + ,0 + ,0 + ,203 + ,4245 + ,5 + ,74 + ,7 + ,0 + ,0 + ,1644 + ,7199 + ,21509 + ,20 + ,259 + ,12 + ,5 + ,13 + ,6179 + ,46660 + ,7670 + ,5 + ,69 + ,0 + ,1 + ,4 + ,3926 + ,17547 + ,15167 + ,38 + ,267 + ,37 + ,38 + ,65 + ,42087 + ,107465 + ,0 + ,2 + ,0 + ,0 + ,0 + ,0 + ,0 + ,969 + ,63891 + ,58 + ,517 + ,47 + ,28 + ,55 + ,87656 + ,173102) + ,dim=c(8 + ,164) + ,dimnames=list(c('WritingTime' + ,'Logins' + ,'CompendiumViews' + ,'BloggedComputations' + ,'ReviewedCompendiums' + ,'LongFeedbackmessages' + ,'Characters' + ,'Time_in_RFC') + ,1:164)) > y <- array(NA,dim=c(8,164),dimnames=list(c('WritingTime','Logins','CompendiumViews','BloggedComputations','ReviewedCompendiums','LongFeedbackmessages','Characters','Time_in_RFC'),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 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Dr. Ian E. Holliday > #To cite this work: Ian E. Holliday, 2009, YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: > #Technical description: > 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] "WritingTime" > x[,par1] [1] 165119 107269 93497 100269 91627 47552 233933 6853 104380 98431 [11] 156949 81817 59238 101138 107158 155499 156274 121777 105037 118661 [21] 131187 145026 107016 87242 91699 110087 145447 143307 61678 210080 [31] 165005 97806 184471 27786 184458 98765 178441 100619 58391 151672 [41] 124437 79929 123064 50466 100991 79367 56968 106257 178412 98520 [51] 153670 15049 174478 25109 45824 116772 189150 194404 185881 67508 [61] 188597 203618 87232 110875 144756 129825 92189 121158 96219 84128 [71] 97960 23824 103515 91313 85407 95871 143846 155387 74429 74004 [81] 71987 150629 68580 119855 55792 25157 90895 117510 144774 77529 [91] 103123 104669 82414 82390 128446 111542 136048 197257 162079 206286 [101] 109858 182125 74168 19630 88634 128321 118936 127044 178377 69581 [111] 168019 113598 5841 93116 24610 60611 226620 6622 121996 13155 [121] 154158 78489 22007 72530 13983 73397 143878 119956 181558 208236 [131] 237085 110297 61394 81420 191154 11798 135724 68614 139926 105203 [141] 80338 121376 124922 10901 135471 66395 134041 153554 0 7953 [151] 0 0 0 0 98922 165395 0 0 4245 21509 [161] 7670 15167 0 63891 > 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 4245 5841 6622 6853 7670 7953 10901 11798 13155 13983 8 1 1 1 1 1 1 1 1 1 1 15049 15167 19630 21509 22007 23824 24610 25109 25157 27786 45824 1 1 1 1 1 1 1 1 1 1 1 47552 50466 55792 56968 58391 59238 60611 61394 61678 63891 66395 1 1 1 1 1 1 1 1 1 1 1 67508 68580 68614 69581 71987 72530 73397 74004 74168 74429 77529 1 1 1 1 1 1 1 1 1 1 1 78489 79367 79929 80338 81420 81817 82390 82414 84128 85407 87232 1 1 1 1 1 1 1 1 1 1 1 87242 88634 90895 91313 91627 91699 92189 93116 93497 95871 96219 1 1 1 1 1 1 1 1 1 1 1 97806 97960 98431 98520 98765 98922 100269 100619 100991 101138 103123 1 1 1 1 1 1 1 1 1 1 1 103515 104380 104669 105037 105203 106257 107016 107158 107269 109858 110087 1 1 1 1 1 1 1 1 1 1 1 110297 110875 111542 113598 116772 117510 118661 118936 119855 119956 121158 1 1 1 1 1 1 1 1 1 1 1 121376 121777 121996 123064 124437 124922 127044 128321 128446 129825 131187 1 1 1 1 1 1 1 1 1 1 1 134041 135471 135724 136048 139926 143307 143846 143878 144756 144774 145026 1 1 1 1 1 1 1 1 1 1 1 145447 150629 151672 153554 153670 154158 155387 155499 156274 156949 162079 1 1 1 1 1 1 1 1 1 1 1 165005 165119 165395 168019 174478 178377 178412 178441 181558 182125 184458 1 1 1 1 1 1 1 1 1 1 1 184471 185881 188597 189150 191154 194404 197257 203618 206286 208236 210080 1 1 1 1 1 1 1 1 1 1 1 226620 233933 237085 1 1 1 > colnames(x) [1] "WritingTime" "Logins" "CompendiumViews" [4] "BloggedComputations" "ReviewedCompendiums" "LongFeedbackmessages" [7] "Characters" "Time_in_RFC" > colnames(x)[par1] [1] "WritingTime" > x[,par1] [1] 165119 107269 93497 100269 91627 47552 233933 6853 104380 98431 [11] 156949 81817 59238 101138 107158 155499 156274 121777 105037 118661 [21] 131187 145026 107016 87242 91699 110087 145447 143307 61678 210080 [31] 165005 97806 184471 27786 184458 98765 178441 100619 58391 151672 [41] 124437 79929 123064 50466 100991 79367 56968 106257 178412 98520 [51] 153670 15049 174478 25109 45824 116772 189150 194404 185881 67508 [61] 188597 203618 87232 110875 144756 129825 92189 121158 96219 84128 [71] 97960 23824 103515 91313 85407 95871 143846 155387 74429 74004 [81] 71987 150629 68580 119855 55792 25157 90895 117510 144774 77529 [91] 103123 104669 82414 82390 128446 111542 136048 197257 162079 206286 [101] 109858 182125 74168 19630 88634 128321 118936 127044 178377 69581 [111] 168019 113598 5841 93116 24610 60611 226620 6622 121996 13155 [121] 154158 78489 22007 72530 13983 73397 143878 119956 181558 208236 [131] 237085 110297 61394 81420 191154 11798 135724 68614 139926 105203 [141] 80338 121376 124922 10901 135471 66395 134041 153554 0 7953 [151] 0 0 0 0 98922 165395 0 0 4245 21509 [161] 7670 15167 0 63891 > if (par2 == 'none') { + m <- ctree(as.formula(paste(colnames(x)[par1],' ~ .',sep='')),data = x) + } > > #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/rcomp/createtable") > > if (par2 != 'none') { + m <- ctree(as.formula(paste('as.factor(',colnames(x)[par1],') ~ .',sep='')),data = x) + if (par4=='yes') { + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'10-Fold Cross Validation',3+2*par3,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'',1,TRUE) + a<-table.element(a,'Prediction (training)',par3+1,TRUE) + a<-table.element(a,'Prediction (testing)',par3+1,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Actual',1,TRUE) + for (jjj in 1:par3) a<-table.element(a,paste('C',jjj,sep=''),1,TRUE) + a<-table.element(a,'CV',1,TRUE) + for (jjj in 1:par3) a<-table.element(a,paste('C',jjj,sep=''),1,TRUE) + a<-table.element(a,'CV',1,TRUE) + a<-table.row.end(a) + for (i in 1:10) { + ind <- sample(2, nrow(x), replace=T, prob=c(0.9,0.1)) + m.ct <- ctree(as.formula(paste('as.factor(',colnames(x)[par1],') ~ .',sep='')),data =x[ind==1,]) + if (i==1) { + m.ct.i.pred <- predict(m.ct, newdata=x[ind==1,]) + m.ct.i.actu <- x[ind==1,par1] + m.ct.x.pred <- predict(m.ct, newdata=x[ind==2,]) + m.ct.x.actu <- x[ind==2,par1] + } else { + m.ct.i.pred <- c(m.ct.i.pred,predict(m.ct, newdata=x[ind==1,])) + m.ct.i.actu <- c(m.ct.i.actu,x[ind==1,par1]) + m.ct.x.pred <- c(m.ct.x.pred,predict(m.ct, newdata=x[ind==2,])) + m.ct.x.actu <- c(m.ct.x.actu,x[ind==2,par1]) + } + } + print(m.ct.i.tab <- table(m.ct.i.actu,m.ct.i.pred)) + numer <- 0 + for (i in 1:par3) { + print(m.ct.i.tab[i,i] / sum(m.ct.i.tab[i,])) + numer <- numer + m.ct.i.tab[i,i] + } + print(m.ct.i.cp <- numer / sum(m.ct.i.tab)) + print(m.ct.x.tab <- table(m.ct.x.actu,m.ct.x.pred)) + numer <- 0 + for (i in 1:par3) { + print(m.ct.x.tab[i,i] / sum(m.ct.x.tab[i,])) + numer <- numer + m.ct.x.tab[i,i] + } + print(m.ct.x.cp <- numer / sum(m.ct.x.tab)) + for (i in 1:par3) { + a<-table.row.start(a) + a<-table.element(a,paste('C',i,sep=''),1,TRUE) + for (jjj in 1:par3) a<-table.element(a,m.ct.i.tab[i,jjj]) + a<-table.element(a,round(m.ct.i.tab[i,i]/sum(m.ct.i.tab[i,]),4)) + for (jjj in 1:par3) a<-table.element(a,m.ct.x.tab[i,jjj]) + a<-table.element(a,round(m.ct.x.tab[i,i]/sum(m.ct.x.tab[i,]),4)) + a<-table.row.end(a) + } + a<-table.row.start(a) + a<-table.element(a,'Overall',1,TRUE) + for (jjj in 1:par3) a<-table.element(a,'-') + a<-table.element(a,round(m.ct.i.cp,4)) + for (jjj in 1:par3) a<-table.element(a,'-') + a<-table.element(a,round(m.ct.x.cp,4)) + a<-table.row.end(a) + a<-table.end(a) + table.save(a,file="/var/wessaorg/rcomp/tmp/187s11324656872.tab") + } + } > m Conditional inference tree with 8 terminal nodes Response: WritingTime Inputs: Logins, CompendiumViews, BloggedComputations, ReviewedCompendiums, LongFeedbackmessages, Characters, Time_in_RFC Number of observations: 164 1) Time_in_RFC <= 173260; criterion = 1, statistic = 120.306 2) Time_in_RFC <= 73566; criterion = 1, statistic = 39.423 3) Time_in_RFC <= 33186; criterion = 1, statistic = 18.107 4)* weights = 16 3) Time_in_RFC > 33186 5)* weights = 7 2) Time_in_RFC > 73566 6) Characters <= 66089; criterion = 0.977, statistic = 8.605 7)* weights = 20 6) Characters > 66089 8)* weights = 24 1) Time_in_RFC > 173260 9) Time_in_RFC <= 247082; criterion = 1, statistic = 34.833 10) Characters <= 124550; criterion = 0.996, statistic = 11.655 11)* weights = 42 10) Characters > 124550 12)* weights = 9 9) Time_in_RFC > 247082 13) Characters <= 137639; criterion = 0.997, statistic = 12.408 14)* weights = 33 13) Characters > 137639 15)* weights = 13 > postscript(file="/var/wessaorg/rcomp/tmp/2arar1324656872.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(m) > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/3cpv01324656872.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 165119 151052.39 14066.60606 2 107269 84415.58 22853.41667 3 93497 107902.21 -14405.21429 4 100269 107902.21 -7633.21429 5 91627 56769.85 34857.15000 6 47552 25173.86 22378.14286 7 233933 192751.08 41181.92308 8 6853 4211.75 2641.25000 9 104380 136232.11 -31852.11111 10 98431 107902.21 -9471.21429 11 156949 151052.39 5896.60606 12 81817 107902.21 -26085.21429 13 59238 56769.85 2468.15000 14 101138 151052.39 -49914.39394 15 107158 107902.21 -744.21429 16 155499 151052.39 4446.60606 17 156274 136232.11 20041.88889 18 121777 151052.39 -29275.39394 19 105037 84415.58 20621.41667 20 118661 107902.21 10758.78571 21 131187 107902.21 23284.78571 22 145026 151052.39 -6026.39394 23 107016 84415.58 22600.41667 24 87242 84415.58 2826.41667 25 91699 107902.21 -16203.21429 26 110087 107902.21 2184.78571 27 145447 151052.39 -5605.39394 28 143307 107902.21 35404.78571 29 61678 56769.85 4908.15000 30 210080 151052.39 59027.60606 31 165005 136232.11 28772.88889 32 97806 107902.21 -10096.21429 33 184471 151052.39 33418.60606 34 27786 56769.85 -28983.85000 35 184458 151052.39 33405.60606 36 98765 107902.21 -9137.21429 37 178441 151052.39 27388.60606 38 100619 107902.21 -7283.21429 39 58391 56769.85 1621.15000 40 151672 151052.39 619.60606 41 124437 151052.39 -26615.39394 42 79929 84415.58 -4486.58333 43 123064 107902.21 15161.78571 44 50466 56769.85 -6303.85000 45 100991 84415.58 16575.41667 46 79367 151052.39 -71685.39394 47 56968 56769.85 198.15000 48 106257 107902.21 -1645.21429 49 178412 192751.08 -14339.07692 50 98520 84415.58 14104.41667 51 153670 107902.21 45767.78571 52 15049 4211.75 10837.25000 53 174478 151052.39 23425.60606 54 25109 25173.86 -64.85714 55 45824 56769.85 -10945.85000 56 116772 107902.21 8869.78571 57 189150 192751.08 -3601.07692 58 194404 192751.08 1652.92308 59 185881 151052.39 34828.60606 60 67508 107902.21 -40394.21429 61 188597 192751.08 -4154.07692 62 203618 192751.08 10866.92308 63 87232 107902.21 -20670.21429 64 110875 107902.21 2972.78571 65 144756 107902.21 36853.78571 66 129825 107902.21 21922.78571 67 92189 84415.58 7773.41667 68 121158 107902.21 13255.78571 69 96219 107902.21 -11683.21429 70 84128 84415.58 -287.58333 71 97960 107902.21 -9942.21429 72 23824 25173.86 -1349.85714 73 103515 107902.21 -4387.21429 74 91313 107902.21 -16589.21429 75 85407 84415.58 991.41667 76 95871 151052.39 -55181.39394 77 143846 151052.39 -7206.39394 78 155387 136232.11 19154.88889 79 74429 84415.58 -9986.58333 80 74004 84415.58 -10411.58333 81 71987 56769.85 15217.15000 82 150629 151052.39 -423.39394 83 68580 56769.85 11810.15000 84 119855 107902.21 11952.78571 85 55792 56769.85 -977.85000 86 25157 56769.85 -31612.85000 87 90895 84415.58 6479.41667 88 117510 151052.39 -33542.39394 89 144774 151052.39 -6278.39394 90 77529 84415.58 -6886.58333 91 103123 107902.21 -4779.21429 92 104669 107902.21 -3233.21429 93 82414 56769.85 25644.15000 94 82390 107902.21 -25512.21429 95 128446 151052.39 -22606.39394 96 111542 136232.11 -24690.11111 97 136048 136232.11 -184.11111 98 197257 192751.08 4505.92308 99 162079 151052.39 11026.60606 100 206286 192751.08 13534.92308 101 109858 136232.11 -26374.11111 102 182125 192751.08 -10626.07692 103 74168 56769.85 17398.15000 104 19630 25173.86 -5543.85714 105 88634 56769.85 31864.15000 106 128321 107902.21 20418.78571 107 118936 107902.21 11033.78571 108 127044 151052.39 -24008.39394 109 178377 84415.58 93961.41667 110 69581 84415.58 -14834.58333 111 168019 192751.08 -24732.07692 112 113598 151052.39 -37454.39394 113 5841 4211.75 1629.25000 114 93116 84415.58 8700.41667 115 24610 25173.86 -563.85714 116 60611 56769.85 3841.15000 117 226620 151052.39 75567.60606 118 6622 4211.75 2410.25000 119 121996 107902.21 14093.78571 120 13155 4211.75 8943.25000 121 154158 151052.39 3105.60606 122 78489 107902.21 -29413.21429 123 22007 84415.58 -62408.58333 124 72530 84415.58 -11885.58333 125 13983 25173.86 -11190.85714 126 73397 84415.58 -11018.58333 127 143878 151052.39 -7174.39394 128 119956 107902.21 12053.78571 129 181558 151052.39 30505.60606 130 208236 151052.39 57183.60606 131 237085 192751.08 44333.92308 132 110297 84415.58 25881.41667 133 61394 56769.85 4624.15000 134 81420 107902.21 -26482.21429 135 191154 192751.08 -1597.07692 136 11798 84415.58 -72617.58333 137 135724 192751.08 -57027.07692 138 68614 56769.85 11844.15000 139 139926 107902.21 32023.78571 140 105203 107902.21 -2699.21429 141 80338 107902.21 -27564.21429 142 121376 151052.39 -29676.39394 143 124922 107902.21 17019.78571 144 10901 56769.85 -45868.85000 145 135471 151052.39 -15581.39394 146 66395 84415.58 -18020.58333 147 134041 136232.11 -2191.11111 148 153554 136232.11 17321.88889 149 0 4211.75 -4211.75000 150 7953 4211.75 3741.25000 151 0 4211.75 -4211.75000 152 0 4211.75 -4211.75000 153 0 4211.75 -4211.75000 154 0 4211.75 -4211.75000 155 98922 107902.21 -8980.21429 156 165395 151052.39 14342.60606 157 0 4211.75 -4211.75000 158 0 4211.75 -4211.75000 159 4245 4211.75 33.25000 160 21509 25173.86 -3664.85714 161 7670 4211.75 3458.25000 162 15167 56769.85 -41602.85000 163 0 4211.75 -4211.75000 164 63891 84415.58 -20524.58333 > if (par2 != 'none') { + print(cbind(as.factor(x[,par1]),predict(m))) + myt <- table(as.factor(x[,par1]),predict(m)) + print(myt) + } > postscript(file="/var/wessaorg/rcomp/tmp/4re8m1324656872.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > if(par2=='none') { + op <- par(mfrow=c(2,2)) + plot(density(result$Actuals),main='Kernel Density Plot of Actuals') + plot(density(result$Residuals),main='Kernel Density Plot of Residuals') + plot(result$Forecasts,result$Actuals,main='Actuals versus Predictions',xlab='Predictions',ylab='Actuals') + plot(density(result$Forecasts),main='Kernel Density Plot of Predictions') + par(op) + } > if(par2!='none') { + plot(myt,main='Confusion Matrix',xlab='Actual',ylab='Predicted') + } > dev.off() null device 1 > if (par2 == 'none') { + detcoef <- cor(result$Forecasts,result$Actuals) + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Goodness of Fit',2,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Correlation',1,TRUE) + a<-table.element(a,round(detcoef,4)) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'R-squared',1,TRUE) + a<-table.element(a,round(detcoef*detcoef,4)) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'RMSE',1,TRUE) + a<-table.element(a,round(sqrt(mean((result$Residuals)^2)),4)) + a<-table.row.end(a) + a<-table.end(a) + table.save(a,file="/var/wessaorg/rcomp/tmp/5bhz81324656872.tab") + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Actuals, Predictions, and Residuals',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'#',header=TRUE) + a<-table.element(a,'Actuals',header=TRUE) + a<-table.element(a,'Forecasts',header=TRUE) + a<-table.element(a,'Residuals',header=TRUE) + a<-table.row.end(a) + for (i in 1:length(result$Actuals)) { + a<-table.row.start(a) + a<-table.element(a,i,header=TRUE) + a<-table.element(a,result$Actuals[i]) + a<-table.element(a,result$Forecasts[i]) + a<-table.element(a,result$Residuals[i]) + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/wessaorg/rcomp/tmp/6k5td1324656872.tab") + } > if (par2 != 'none') { + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Confusion Matrix (predicted in columns / actuals in rows)',par3+1,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'',1,TRUE) + for (i in 1:par3) { + a<-table.element(a,paste('C',i,sep=''),1,TRUE) + } + a<-table.row.end(a) + for (i in 1:par3) { + a<-table.row.start(a) + a<-table.element(a,paste('C',i,sep=''),1,TRUE) + for (j in 1:par3) { + a<-table.element(a,myt[i,j]) + } + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/wessaorg/rcomp/tmp/7xiz61324656872.tab") + } > > try(system("convert tmp/2arar1324656872.ps tmp/2arar1324656872.png",intern=TRUE)) character(0) > try(system("convert tmp/3cpv01324656872.ps tmp/3cpv01324656872.png",intern=TRUE)) character(0) > try(system("convert tmp/4re8m1324656872.ps tmp/4re8m1324656872.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.812 0.278 4.327