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(276257 + ,492 + ,3 + ,41 + ,126 + ,140824 + ,32033 + ,165 + ,165 + ,180480 + ,436 + ,4 + ,34 + ,127 + ,110459 + ,20654 + ,135 + ,132 + ,229040 + ,694 + ,16 + ,44 + ,111 + ,105079 + ,16346 + ,121 + ,121 + ,218443 + ,1137 + ,2 + ,38 + ,133 + ,112098 + ,35926 + ,148 + ,145 + ,171533 + ,380 + ,1 + ,27 + ,64 + ,43929 + ,10621 + ,73 + ,71 + ,70849 + ,179 + ,3 + ,35 + ,89 + ,76173 + ,10024 + ,49 + ,47 + ,536497 + ,2354 + ,0 + ,33 + ,122 + ,187326 + ,43068 + ,185 + ,177 + ,33186 + ,111 + ,0 + ,18 + ,22 + ,22807 + ,1271 + ,5 + ,5 + ,217320 + ,740 + ,7 + ,34 + ,117 + ,144408 + ,34416 + ,125 + ,124 + ,213274 + ,595 + ,0 + ,33 + ,82 + ,66485 + ,20318 + ,93 + ,92 + ,310843 + ,809 + ,0 + ,46 + ,147 + ,79089 + ,24409 + ,154 + ,149 + ,242788 + ,693 + ,7 + ,57 + ,192 + ,81625 + ,20648 + ,98 + ,93 + ,195022 + ,738 + ,10 + ,37 + ,113 + ,68788 + ,12347 + ,70 + ,70 + ,367785 + ,1184 + ,4 + ,55 + ,171 + ,103297 + ,21857 + ,148 + ,148 + ,261990 + ,713 + ,10 + ,44 + ,87 + ,69446 + ,11034 + ,100 + ,100 + ,392509 + ,1729 + ,0 + ,62 + ,207 + ,114948 + ,33433 + ,150 + ,142 + ,335528 + ,844 + ,8 + ,40 + ,153 + ,167949 + ,35902 + ,197 + ,194 + ,376673 + ,1298 + ,4 + ,39 + ,92 + ,125081 + ,22355 + ,114 + ,113 + ,181980 + ,514 + ,3 + ,32 + ,95 + ,125818 + ,31219 + ,169 + ,162 + ,266736 + ,689 + ,8 + ,51 + ,193 + ,136588 + ,21983 + ,200 + ,186 + ,278265 + ,837 + ,0 + ,49 + ,160 + ,112431 + ,40085 + ,148 + ,147 + ,461287 + ,1330 + ,1 + ,39 + ,144 + ,103037 + ,18507 + ,140 + ,137 + ,195786 + ,491 + ,5 + ,25 + ,84 + ,82317 + ,16278 + ,74 + ,71 + ,197058 + ,622 + ,9 + ,56 + ,223 + ,118906 + ,24662 + ,128 + ,123 + ,250284 + ,1332 + ,1 + ,45 + ,154 + ,83515 + ,31452 + ,140 + ,134 + ,245373 + ,1043 + ,0 + ,38 + ,139 + ,104581 + ,32580 + ,116 + ,115 + ,274121 + ,1082 + ,5 + ,45 + ,142 + ,103129 + ,22883 + ,147 + ,138 + ,278027 + ,636 + ,0 + ,43 + ,148 + ,83243 + ,27652 + ,132 + ,125 + ,165597 + ,586 + ,0 + ,32 + ,99 + ,37110 + ,9845 + ,70 + ,66 + ,371452 + ,1170 + ,0 + ,41 + ,135 + ,113344 + ,20190 + ,144 + ,137 + ,295296 + ,973 + ,3 + ,50 + ,179 + ,139165 + ,46201 + ,155 + ,152 + ,248320 + ,721 + ,6 + ,50 + ,149 + ,86652 + ,10971 + ,165 + ,159 + ,351980 + ,863 + ,1 + ,51 + ,187 + ,112302 + ,34811 + ,161 + ,159 + ,101014 + ,343 + ,4 + ,37 + ,137 + ,69652 + ,3029 + ,31 + ,31 + ,412722 + ,1278 + ,4 + ,44 + ,163 + ,119442 + ,38941 + ,199 + ,185 + ,273950 + ,1186 + ,0 + ,42 + ,127 + ,69867 + ,4958 + ,78 + ,78 + ,425531 + ,1334 + ,0 + ,44 + ,151 + ,101629 + ,32344 + ,121 + ,117 + ,231912 + ,652 + ,2 + ,36 + ,89 + ,70168 + ,19433 + ,112 + ,109 + ,115658 + ,284 + ,1 + ,17 + ,46 + ,31081 + ,12558 + ,41 + ,41 + ,376008 + ,1273 + ,2 + ,43 + ,156 + ,103925 + ,36524 + ,158 + ,149 + ,335039 + ,1518 + ,10 + ,41 + ,128 + ,92622 + ,26041 + ,123 + ,123 + ,194127 + ,715 + ,10 + ,41 + ,111 + ,79011 + ,16637 + ,104 + ,103 + ,206947 + ,671 + ,5 + ,38 + ,114 + ,93487 + ,28395 + ,94 + ,87 + ,182286 + ,486 + ,6 + ,49 + ,148 + ,64520 + ,16747 + ,73 + ,71 + ,153778 + ,1022 + ,1 + ,45 + ,45 + ,93473 + ,9105 + ,52 + ,51 + ,457592 + ,2084 + ,2 + ,42 + ,134 + ,114360 + ,11941 + ,71 + ,70 + ,78800 + ,330 + ,2 + ,26 + ,66 + ,33032 + ,7935 + ,21 + ,21 + ,208277 + ,658 + ,0 + ,52 + ,180 + ,96125 + ,19499 + ,155 + ,155 + ,359144 + ,1385 + ,10 + ,50 + ,177 + ,151911 + ,22938 + ,174 + ,172 + ,184648 + ,930 + ,3 + ,45 + ,146 + ,89256 + ,25314 + ,136 + ,133 + ,234078 + ,620 + ,0 + ,40 + ,137 + ,95676 + ,28527 + ,128 + ,125 + ,24188 + ,218 + ,0 + ,4 + ,7 + ,5950 + ,2694 + ,7 + ,7 + ,380576 + ,840 + ,8 + ,44 + ,157 + ,149695 + ,20867 + ,165 + ,158 + ,65029 + ,255 + ,5 + ,18 + ,61 + ,32551 + ,3597 + ,21 + ,21 + ,101097 + ,454 + ,3 + ,14 + ,41 + ,31701 + ,5296 + ,35 + ,35 + ,288327 + ,1149 + ,1 + ,38 + ,123 + ,100087 + ,32982 + ,137 + ,133 + ,334829 + ,684 + ,5 + ,61 + ,228 + ,169707 + ,38975 + ,174 + ,169 + ,359400 + ,1190 + ,6 + ,39 + ,137 + ,150491 + ,42721 + ,257 + ,256 + ,369577 + ,1079 + ,0 + ,42 + ,150 + ,120192 + ,41455 + ,207 + ,190 + ,269961 + ,883 + ,12 + ,40 + ,141 + ,95893 + ,23923 + ,103 + ,100 + ,389738 + ,1331 + ,10 + ,51 + ,181 + ,151715 + ,26719 + ,171 + ,171 + ,309474 + ,1159 + ,12 + ,28 + ,73 + ,176225 + ,53405 + ,279 + ,267 + ,282769 + ,1217 + ,11 + ,43 + ,97 + ,59900 + ,12526 + ,83 + ,80 + ,269324 + ,946 + ,8 + ,42 + ,142 + ,104767 + ,26584 + ,130 + ,126 + ,234773 + ,579 + ,2 + ,37 + ,125 + ,114799 + ,37062 + ,131 + ,132 + ,237561 + ,474 + ,0 + ,30 + ,87 + ,72128 + ,25696 + ,126 + ,121 + ,211396 + ,626 + ,6 + ,39 + ,140 + ,143592 + ,24634 + ,158 + ,156 + ,240376 + ,843 + ,10 + ,44 + ,148 + ,89626 + ,27269 + ,138 + ,133 + ,247447 + ,893 + ,2 + ,36 + ,116 + ,131072 + ,25270 + ,200 + ,199 + ,181550 + ,633 + ,5 + ,28 + ,89 + ,126817 + ,24634 + ,104 + ,98 + ,242152 + ,873 + ,13 + ,47 + ,160 + ,81351 + ,17828 + ,111 + ,109 + ,73566 + ,385 + ,6 + ,23 + ,67 + ,22618 + ,3007 + ,26 + ,25 + ,246125 + ,729 + ,7 + ,48 + ,179 + ,88977 + ,20065 + ,115 + ,113 + ,199565 + ,774 + ,2 + ,38 + ,90 + ,92059 + ,24648 + ,127 + ,126 + ,222676 + ,769 + ,4 + ,42 + ,144 + ,81897 + ,21588 + ,140 + ,137 + ,363558 + ,996 + ,4 + ,46 + ,144 + ,108146 + ,25217 + ,121 + ,121 + ,365442 + ,1194 + ,3 + ,37 + ,135 + ,126372 + ,30927 + ,183 + ,178 + ,217036 + ,575 + ,6 + ,41 + ,125 + ,249771 + ,18487 + ,68 + ,63 + ,213466 + ,725 + ,2 + ,42 + ,146 + ,71154 + ,18050 + ,112 + ,109 + ,204477 + ,706 + ,0 + ,41 + ,121 + ,71571 + ,17696 + ,103 + ,101 + ,169080 + ,665 + ,1 + ,36 + ,109 + ,55918 + ,17326 + ,63 + ,61 + ,478396 + ,1259 + ,0 + ,45 + ,138 + ,160141 + ,39361 + ,166 + ,157 + ,145943 + ,653 + ,5 + ,26 + ,99 + ,38692 + ,9648 + ,38 + ,38 + ,288626 + ,694 + ,2 + ,44 + ,92 + ,102812 + ,26759 + ,163 + ,159 + ,80953 + ,437 + ,0 + ,8 + ,27 + ,56622 + ,7905 + ,59 + ,58 + ,150221 + ,822 + ,0 + ,27 + ,77 + ,15986 + ,4527 + ,27 + ,27 + ,179317 + ,458 + ,6 + ,38 + ,137 + ,123534 + ,41517 + ,108 + ,108 + ,395368 + ,1545 + ,1 + ,38 + ,140 + ,108535 + ,21261 + ,88 + ,83 + ,349460 + ,987 + ,0 + ,57 + ,122 + ,93879 + ,36099 + ,92 + ,88 + ,180679 + ,1051 + ,1 + ,45 + ,159 + ,144551 + ,39039 + ,170 + ,164 + ,286578 + ,838 + ,1 + ,40 + ,97 + ,56750 + ,13841 + ,98 + ,96 + ,274477 + ,703 + ,3 + ,42 + ,144 + ,127654 + ,23841 + ,205 + ,192 + ,195623 + ,613 + ,10 + ,31 + ,90 + ,65594 + ,8589 + ,96 + ,94 + ,282361 + ,1128 + ,1 + ,36 + ,135 + ,59938 + ,15049 + ,107 + ,107 + ,329121 + ,967 + ,4 + ,40 + ,147 + ,146975 + ,39038 + ,150 + ,144 + ,198658 + ,617 + ,4 + ,40 + ,155 + ,165904 + ,36774 + ,138 + ,136 + ,262630 + ,654 + ,5 + ,35 + ,127 + ,169265 + ,40076 + ,177 + ,171 + ,300481 + ,805 + ,0 + ,39 + ,104 + ,183500 + ,43840 + ,213 + ,210 + ,403404 + ,1355 + ,12 + ,65 + ,248 + ,165986 + ,43146 + ,208 + ,193 + ,406613 + ,1456 + ,13 + ,33 + ,116 + ,184923 + ,50099 + ,307 + ,297 + ,294371 + ,878 + ,8 + ,51 + ,176 + ,140358 + ,40312 + ,125 + ,125 + ,313267 + ,887 + ,0 + ,42 + ,133 + ,149959 + ,32616 + ,208 + ,204 + ,189276 + ,663 + ,0 + ,36 + ,59 + ,57224 + ,11338 + ,73 + ,70 + ,43287 + ,214 + ,4 + ,19 + ,64 + ,43750 + ,7409 + ,49 + ,49 + ,189520 + ,733 + ,4 + ,25 + ,40 + ,48029 + ,18213 + ,82 + ,82 + ,250254 + ,830 + ,0 + ,44 + ,98 + ,104978 + ,45873 + ,206 + ,205 + ,268886 + ,1174 + ,0 + ,40 + ,125 + ,100046 + ,39844 + ,112 + ,111 + ,314153 + ,1068 + ,0 + ,44 + ,135 + ,101047 + ,28317 + ,139 + ,135 + ,160308 + ,413 + ,0 + ,30 + ,83 + ,197426 + ,24797 + ,60 + ,59 + ,162843 + ,946 + ,0 + ,45 + ,138 + ,160902 + ,7471 + ,70 + ,70 + ,344925 + ,657 + ,5 + ,42 + ,149 + ,147172 + ,27259 + ,112 + ,108 + ,300526 + ,690 + ,0 + ,45 + ,115 + ,109432 + ,23201 + ,142 + ,141 + ,23623 + ,156 + ,0 + ,1 + ,0 + ,1168 + ,238 + ,11 + ,11 + ,195817 + ,779 + ,0 + ,40 + ,103 + ,83248 + ,28830 + ,130 + ,130 + ,61857 + ,192 + ,4 + ,11 + ,30 + ,25162 + ,3913 + ,31 + ,28 + ,163931 + ,461 + ,0 + ,45 + ,119 + ,45724 + ,9935 + ,132 + ,101 + ,428191 + ,1213 + ,1 + ,38 + ,102 + ,110529 + ,27738 + ,219 + ,216 + ,21054 + ,146 + ,0 + ,0 + ,0 + ,855 + ,338 + ,4 + ,4 + ,252805 + ,866 + ,5 + ,30 + ,77 + ,101382 + ,13326 + ,102 + ,97 + ,31961 + ,200 + ,0 + ,8 + ,9 + ,14116 + ,3988 + ,39 + ,39 + ,335888 + ,1290 + ,3 + ,41 + ,143 + ,89506 + ,24347 + ,125 + ,119 + ,246100 + ,715 + ,7 + ,48 + ,163 + ,135356 + ,27111 + ,121 + ,118 + ,180591 + ,514 + ,13 + ,48 + ,146 + ,116066 + ,3938 + ,42 + ,41 + ,163400 + ,697 + ,3 + ,32 + ,94 + ,144244 + ,17416 + ,111 + ,107 + ,38214 + ,276 + ,0 + ,8 + ,21 + ,8773 + ,1888 + ,16 + ,16 + ,224597 + ,752 + ,3 + ,43 + ,151 + ,102153 + ,18700 + ,70 + ,69 + ,357602 + ,1021 + ,0 + ,52 + ,187 + ,117440 + ,36809 + ,162 + ,160 + ,198104 + ,481 + ,0 + ,53 + ,171 + ,104128 + ,24959 + ,173 + ,158 + ,424398 + ,1626 + ,4 + ,49 + ,170 + ,134238 + ,37343 + ,171 + ,161 + ,348017 + ,884 + ,0 + ,48 + ,145 + ,134047 + ,21849 + ,172 + ,165 + ,421610 + ,1187 + ,3 + ,56 + ,198 + ,279488 + ,49809 + ,254 + ,246 + ,192170 + ,488 + ,0 + ,40 + ,137 + ,79756 + ,21654 + ,90 + ,89 + ,102510 + ,403 + ,0 + ,36 + ,100 + ,66089 + ,8728 + ,50 + ,49 + ,302158 + ,977 + ,4 + ,44 + ,162 + ,102070 + ,20920 + ,113 + ,107 + ,444599 + ,1525 + ,5 + ,46 + ,163 + ,146760 + ,27195 + ,187 + ,182 + ,148707 + ,551 + ,15 + ,43 + ,153 + ,154771 + ,1037 + ,16 + ,16 + ,407736 + ,1807 + ,5 + ,46 + ,161 + ,165933 + ,42570 + ,175 + ,173 + ,164406 + ,723 + ,5 + ,39 + ,112 + ,64593 + ,17672 + ,90 + ,90 + ,278077 + ,632 + ,2 + ,41 + ,135 + ,92280 + ,34245 + ,140 + ,140 + ,282461 + ,898 + ,1 + ,46 + ,124 + ,67150 + ,16786 + ,145 + ,142 + ,219544 + ,621 + ,0 + ,32 + ,45 + ,128692 + ,20954 + ,141 + ,126 + ,384177 + ,1606 + ,9 + ,45 + ,144 + ,124089 + ,16378 + ,125 + ,123 + ,246963 + ,811 + ,1 + ,39 + ,126 + ,125386 + ,31852 + ,241 + ,239 + ,173260 + ,716 + ,3 + ,21 + ,78 + ,37238 + ,2805 + ,16 + ,15 + ,336715 + ,1001 + ,11 + ,49 + ,149 + ,140015 + ,38086 + ,175 + ,170 + ,176654 + ,732 + ,5 + ,55 + ,196 + ,150047 + ,21166 + ,132 + ,123 + ,253341 + ,1024 + ,2 + ,36 + ,118 + ,154451 + ,34672 + ,154 + ,151 + ,307133 + ,831 + ,1 + ,48 + ,159 + ,156349 + ,36171 + ,198 + ,194 + ,1 + ,0 + ,9 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,14688 + ,85 + ,0 + ,0 + ,0 + ,6023 + ,2065 + ,5 + ,5 + ,98 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,455 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,260901 + ,773 + ,2 + ,43 + ,88 + ,84601 + ,19354 + ,125 + ,122 + ,409280 + ,1128 + ,3 + ,52 + ,129 + ,68946 + ,22124 + ,174 + ,173 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,203 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,7199 + ,74 + ,0 + ,0 + ,0 + ,1644 + ,556 + ,6 + ,6 + ,46660 + ,259 + ,0 + ,5 + ,13 + ,6179 + ,2089 + ,13 + ,13 + ,17547 + ,69 + ,0 + ,1 + ,4 + ,3926 + ,2658 + ,3 + ,3 + ,118589 + ,301 + ,0 + ,45 + ,82 + ,52789 + ,1813 + ,35 + ,35 + ,969 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,233108 + ,668 + ,2 + ,34 + ,71 + ,100350 + ,17372 + ,80 + ,72) + ,dim=c(9 + ,164) + ,dimnames=list(c('TotalTime' + ,'CourseCompendiumViews' + ,'SharedbyotherAuthors' + ,'ReviewedCompendiums' + ,'PeerReviews' + ,'CWnumberOfCharacters' + ,'CWNumberOfRevisions' + ,'CWNumberOfHyperlinks' + ,'CWNumberOfBlogs') + ,1:164)) > y <- array(NA,dim=c(9,164),dimnames=list(c('TotalTime','CourseCompendiumViews','SharedbyotherAuthors','ReviewedCompendiums','PeerReviews','CWnumberOfCharacters','CWNumberOfRevisions','CWNumberOfHyperlinks','CWNumberOfBlogs'),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 = '6' > #'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] "CWnumberOfCharacters" > x[,par1] [1] 140824 110459 105079 112098 43929 76173 187326 22807 144408 66485 [11] 79089 81625 68788 103297 69446 114948 167949 125081 125818 136588 [21] 112431 103037 82317 118906 83515 104581 103129 83243 37110 113344 [31] 139165 86652 112302 69652 119442 69867 101629 70168 31081 103925 [41] 92622 79011 93487 64520 93473 114360 33032 96125 151911 89256 [51] 95676 5950 149695 32551 31701 100087 169707 150491 120192 95893 [61] 151715 176225 59900 104767 114799 72128 143592 89626 131072 126817 [71] 81351 22618 88977 92059 81897 108146 126372 249771 71154 71571 [81] 55918 160141 38692 102812 56622 15986 123534 108535 93879 144551 [91] 56750 127654 65594 59938 146975 165904 169265 183500 165986 184923 [101] 140358 149959 57224 43750 48029 104978 100046 101047 197426 160902 [111] 147172 109432 1168 83248 25162 45724 110529 855 101382 14116 [121] 89506 135356 116066 144244 8773 102153 117440 104128 134238 134047 [131] 279488 79756 66089 102070 146760 154771 165933 64593 92280 67150 [141] 128692 124089 125386 37238 140015 150047 154451 156349 0 6023 [151] 0 0 0 0 84601 68946 0 0 1644 6179 [161] 3926 52789 0 100350 > 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 855 1168 1644 3926 5950 6023 6179 8773 14116 15986 8 1 1 1 1 1 1 1 1 1 1 22618 22807 25162 31081 31701 32551 33032 37110 37238 38692 43750 1 1 1 1 1 1 1 1 1 1 1 43929 45724 48029 52789 55918 56622 56750 57224 59900 59938 64520 1 1 1 1 1 1 1 1 1 1 1 64593 65594 66089 66485 67150 68788 68946 69446 69652 69867 70168 1 1 1 1 1 1 1 1 1 1 1 71154 71571 72128 76173 79011 79089 79756 81351 81625 81897 82317 1 1 1 1 1 1 1 1 1 1 1 83243 83248 83515 84601 86652 88977 89256 89506 89626 92059 92280 1 1 1 1 1 1 1 1 1 1 1 92622 93473 93487 93879 95676 95893 96125 100046 100087 100350 101047 1 1 1 1 1 1 1 1 1 1 1 101382 101629 102070 102153 102812 103037 103129 103297 103925 104128 104581 1 1 1 1 1 1 1 1 1 1 1 104767 104978 105079 108146 108535 109432 110459 110529 112098 112302 112431 1 1 1 1 1 1 1 1 1 1 1 113344 114360 114799 114948 116066 117440 118906 119442 120192 123534 124089 1 1 1 1 1 1 1 1 1 1 1 125081 125386 125818 126372 126817 127654 128692 131072 134047 134238 135356 1 1 1 1 1 1 1 1 1 1 1 136588 139165 140015 140358 140824 143592 144244 144408 144551 146760 146975 1 1 1 1 1 1 1 1 1 1 1 147172 149695 149959 150047 150491 151715 151911 154451 154771 156349 160141 1 1 1 1 1 1 1 1 1 1 1 160902 165904 165933 165986 167949 169265 169707 176225 183500 184923 187326 1 1 1 1 1 1 1 1 1 1 1 197426 249771 279488 1 1 1 > colnames(x) [1] "TotalTime" "CourseCompendiumViews" "SharedbyotherAuthors" [4] "ReviewedCompendiums" "PeerReviews" "CWnumberOfCharacters" [7] "CWNumberOfRevisions" "CWNumberOfHyperlinks" "CWNumberOfBlogs" > colnames(x)[par1] [1] "CWnumberOfCharacters" > x[,par1] [1] 140824 110459 105079 112098 43929 76173 187326 22807 144408 66485 [11] 79089 81625 68788 103297 69446 114948 167949 125081 125818 136588 [21] 112431 103037 82317 118906 83515 104581 103129 83243 37110 113344 [31] 139165 86652 112302 69652 119442 69867 101629 70168 31081 103925 [41] 92622 79011 93487 64520 93473 114360 33032 96125 151911 89256 [51] 95676 5950 149695 32551 31701 100087 169707 150491 120192 95893 [61] 151715 176225 59900 104767 114799 72128 143592 89626 131072 126817 [71] 81351 22618 88977 92059 81897 108146 126372 249771 71154 71571 [81] 55918 160141 38692 102812 56622 15986 123534 108535 93879 144551 [91] 56750 127654 65594 59938 146975 165904 169265 183500 165986 184923 [101] 140358 149959 57224 43750 48029 104978 100046 101047 197426 160902 [111] 147172 109432 1168 83248 25162 45724 110529 855 101382 14116 [121] 89506 135356 116066 144244 8773 102153 117440 104128 134238 134047 [131] 279488 79756 66089 102070 146760 154771 165933 64593 92280 67150 [141] 128692 124089 125386 37238 140015 150047 154451 156349 0 6023 [151] 0 0 0 0 84601 68946 0 0 1644 6179 [161] 3926 52789 0 100350 > 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/1iijz1324657778.tab") + } + } > m Conditional inference tree with 5 terminal nodes Response: CWnumberOfCharacters Inputs: TotalTime, CourseCompendiumViews, SharedbyotherAuthors, ReviewedCompendiums, PeerReviews, CWNumberOfRevisions, CWNumberOfHyperlinks, CWNumberOfBlogs Number of observations: 164 1) CWNumberOfRevisions <= 18213; criterion = 1, statistic = 97.495 2) ReviewedCompendiums <= 27; criterion = 1, statistic = 42.414 3) CWNumberOfHyperlinks <= 13; criterion = 1, statistic = 24.1 4)* weights = 16 3) CWNumberOfHyperlinks > 13 5)* weights = 16 2) ReviewedCompendiums > 27 6)* weights = 33 1) CWNumberOfRevisions > 18213 7) CWNumberOfRevisions <= 41517; criterion = 1, statistic = 21.952 8)* weights = 89 7) CWNumberOfRevisions > 41517 9)* weights = 10 > postscript(file="/var/wessaorg/rcomp/tmp/28vcr1324657778.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/39plt1324657778.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 140824 118015.71 22808.2921 2 110459 118015.71 -7556.7079 3 105079 82172.12 22906.8788 4 112098 118015.71 -5917.7079 5 43929 35349.81 8579.1875 6 76173 82172.12 -5999.1212 7 187326 173801.50 13524.5000 8 22807 3034.50 19772.5000 9 144408 118015.71 26392.2921 10 66485 118015.71 -51530.7079 11 79089 118015.71 -38926.7079 12 81625 118015.71 -36390.7079 13 68788 82172.12 -13384.1212 14 103297 118015.71 -14718.7079 15 69446 82172.12 -12726.1212 16 114948 118015.71 -3067.7079 17 167949 118015.71 49933.2921 18 125081 118015.71 7065.2921 19 125818 118015.71 7802.2921 20 136588 118015.71 18572.2921 21 112431 118015.71 -5584.7079 22 103037 118015.71 -14978.7079 23 82317 35349.81 46967.1875 24 118906 118015.71 890.2921 25 83515 118015.71 -34500.7079 26 104581 118015.71 -13434.7079 27 103129 118015.71 -14886.7079 28 83243 118015.71 -34772.7079 29 37110 82172.12 -45062.1212 30 113344 118015.71 -4671.7079 31 139165 173801.50 -34636.5000 32 86652 82172.12 4479.8788 33 112302 118015.71 -5713.7079 34 69652 82172.12 -12520.1212 35 119442 118015.71 1426.2921 36 69867 82172.12 -12305.1212 37 101629 118015.71 -16386.7079 38 70168 118015.71 -47847.7079 39 31081 35349.81 -4268.8125 40 103925 118015.71 -14090.7079 41 92622 118015.71 -25393.7079 42 79011 82172.12 -3161.1212 43 93487 118015.71 -24528.7079 44 64520 82172.12 -17652.1212 45 93473 82172.12 11300.8788 46 114360 82172.12 32187.8788 47 33032 35349.81 -2317.8125 48 96125 118015.71 -21890.7079 49 151911 118015.71 33895.2921 50 89256 118015.71 -28759.7079 51 95676 118015.71 -22339.7079 52 5950 3034.50 2915.5000 53 149695 118015.71 31679.2921 54 32551 35349.81 -2798.8125 55 31701 35349.81 -3648.8125 56 100087 118015.71 -17928.7079 57 169707 118015.71 51691.2921 58 150491 173801.50 -23310.5000 59 120192 118015.71 2176.2921 60 95893 118015.71 -22122.7079 61 151715 118015.71 33699.2921 62 176225 173801.50 2423.5000 63 59900 82172.12 -22272.1212 64 104767 118015.71 -13248.7079 65 114799 118015.71 -3216.7079 66 72128 118015.71 -45887.7079 67 143592 118015.71 25576.2921 68 89626 118015.71 -28389.7079 69 131072 118015.71 13056.2921 70 126817 118015.71 8801.2921 71 81351 82172.12 -821.1212 72 22618 35349.81 -12731.8125 73 88977 118015.71 -29038.7079 74 92059 118015.71 -25956.7079 75 81897 118015.71 -36118.7079 76 108146 118015.71 -9869.7079 77 126372 118015.71 8356.2921 78 249771 118015.71 131755.2921 79 71154 82172.12 -11018.1212 80 71571 82172.12 -10601.1212 81 55918 82172.12 -26254.1212 82 160141 118015.71 42125.2921 83 38692 35349.81 3342.1875 84 102812 118015.71 -15203.7079 85 56622 35349.81 21272.1875 86 15986 35349.81 -19363.8125 87 123534 118015.71 5518.2921 88 108535 118015.71 -9480.7079 89 93879 118015.71 -24136.7079 90 144551 118015.71 26535.2921 91 56750 82172.12 -25422.1212 92 127654 118015.71 9638.2921 93 65594 82172.12 -16578.1212 94 59938 82172.12 -22234.1212 95 146975 118015.71 28959.2921 96 165904 118015.71 47888.2921 97 169265 118015.71 51249.2921 98 183500 173801.50 9698.5000 99 165986 173801.50 -7815.5000 100 184923 173801.50 11121.5000 101 140358 118015.71 22342.2921 102 149959 118015.71 31943.2921 103 57224 82172.12 -24948.1212 104 43750 35349.81 8400.1875 105 48029 35349.81 12679.1875 106 104978 173801.50 -68823.5000 107 100046 118015.71 -17969.7079 108 101047 118015.71 -16968.7079 109 197426 118015.71 79410.2921 110 160902 82172.12 78729.8788 111 147172 118015.71 29156.2921 112 109432 118015.71 -8583.7079 113 1168 3034.50 -1866.5000 114 83248 118015.71 -34767.7079 115 25162 35349.81 -10187.8125 116 45724 82172.12 -36448.1212 117 110529 118015.71 -7486.7079 118 855 3034.50 -2179.5000 119 101382 82172.12 19209.8788 120 14116 35349.81 -21233.8125 121 89506 118015.71 -28509.7079 122 135356 118015.71 17340.2921 123 116066 82172.12 33893.8788 124 144244 82172.12 62071.8788 125 8773 35349.81 -26576.8125 126 102153 118015.71 -15862.7079 127 117440 118015.71 -575.7079 128 104128 118015.71 -13887.7079 129 134238 118015.71 16222.2921 130 134047 118015.71 16031.2921 131 279488 173801.50 105686.5000 132 79756 118015.71 -38259.7079 133 66089 82172.12 -16083.1212 134 102070 118015.71 -15945.7079 135 146760 118015.71 28744.2921 136 154771 82172.12 72598.8788 137 165933 173801.50 -7868.5000 138 64593 82172.12 -17579.1212 139 92280 118015.71 -25735.7079 140 67150 82172.12 -15022.1212 141 128692 118015.71 10676.2921 142 124089 82172.12 41916.8788 143 125386 118015.71 7370.2921 144 37238 35349.81 1888.1875 145 140015 118015.71 21999.2921 146 150047 118015.71 32031.2921 147 154451 118015.71 36435.2921 148 156349 118015.71 38333.2921 149 0 3034.50 -3034.5000 150 6023 3034.50 2988.5000 151 0 3034.50 -3034.5000 152 0 3034.50 -3034.5000 153 0 3034.50 -3034.5000 154 0 3034.50 -3034.5000 155 84601 118015.71 -33414.7079 156 68946 118015.71 -49069.7079 157 0 3034.50 -3034.5000 158 0 3034.50 -3034.5000 159 1644 3034.50 -1390.5000 160 6179 3034.50 3144.5000 161 3926 3034.50 891.5000 162 52789 82172.12 -29383.1212 163 0 3034.50 -3034.5000 164 100350 82172.12 18177.8788 > 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/4th761324657778.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/5fo8i1324657778.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/6vkjb1324657778.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/7irbe1324657778.tab") + } > > try(system("convert tmp/28vcr1324657778.ps tmp/28vcr1324657778.png",intern=TRUE)) character(0) > try(system("convert tmp/39plt1324657778.ps tmp/39plt1324657778.png",intern=TRUE)) character(0) > try(system("convert tmp/4th761324657778.ps tmp/4th761324657778.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.796 0.297 4.088