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 = '' > par2 = 'none' > par1 = '5' > #'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] "PeerReviews" > x[,par1] [1] 126 127 111 133 64 89 122 22 117 82 147 192 113 171 87 207 153 92 [19] 95 193 160 144 84 223 154 139 142 148 99 135 179 149 187 137 163 127 [37] 151 89 46 156 128 111 114 148 45 134 66 180 177 146 137 7 157 61 [55] 41 123 228 137 150 141 181 73 97 142 125 87 140 148 116 89 160 67 [73] 179 90 144 144 135 125 146 121 109 138 99 92 27 77 137 140 122 159 [91] 97 144 90 135 147 155 127 104 248 116 176 133 59 64 40 98 125 135 [109] 83 138 149 115 0 103 30 119 102 0 77 9 143 163 146 94 21 151 [127] 187 171 170 145 198 137 100 162 163 153 161 112 135 124 45 144 126 78 [145] 149 196 118 159 0 0 0 0 0 0 88 129 0 0 0 13 4 82 [163] 0 71 > 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 4 7 9 13 21 22 27 30 40 41 45 46 59 61 64 66 67 71 73 12 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 1 1 77 78 82 83 84 87 88 89 90 92 94 95 97 98 99 100 102 103 104 109 2 1 2 1 1 2 1 3 2 2 1 1 2 1 2 1 1 1 1 1 111 112 113 114 115 116 117 118 119 121 122 123 124 125 126 127 128 129 133 134 2 1 1 1 1 2 1 1 1 1 2 1 1 3 2 3 1 1 2 1 135 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 153 154 155 156 5 5 2 1 2 1 2 1 5 1 3 2 3 3 1 2 2 1 1 1 157 159 160 161 162 163 170 171 176 177 179 180 181 187 192 193 196 198 207 223 1 2 2 1 1 3 1 2 1 1 2 1 1 2 1 1 1 1 1 1 228 248 1 1 > colnames(x) [1] "TotalTime" "CourseCompendiumViews" "SharedbyotherAuthors" [4] "ReviewedCompendiums" "PeerReviews" "CWnumberOfCharacters" [7] "CWNumberOfRevisions" "CWNumberOfHyperlinks" "CWNumberOfBlogs" > colnames(x)[par1] [1] "PeerReviews" > x[,par1] [1] 126 127 111 133 64 89 122 22 117 82 147 192 113 171 87 207 153 92 [19] 95 193 160 144 84 223 154 139 142 148 99 135 179 149 187 137 163 127 [37] 151 89 46 156 128 111 114 148 45 134 66 180 177 146 137 7 157 61 [55] 41 123 228 137 150 141 181 73 97 142 125 87 140 148 116 89 160 67 [73] 179 90 144 144 135 125 146 121 109 138 99 92 27 77 137 140 122 159 [91] 97 144 90 135 147 155 127 104 248 116 176 133 59 64 40 98 125 135 [109] 83 138 149 115 0 103 30 119 102 0 77 9 143 163 146 94 21 151 [127] 187 171 170 145 198 137 100 162 163 153 161 112 135 124 45 144 126 78 [145] 149 196 118 159 0 0 0 0 0 0 88 129 0 0 0 13 4 82 [163] 0 71 > 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/1buyh1324379948.tab") + } + } > m Conditional inference tree with 8 terminal nodes Response: PeerReviews Inputs: TotalTime, CourseCompendiumViews, SharedbyotherAuthors, ReviewedCompendiums, CWnumberOfCharacters, CWNumberOfRevisions, CWNumberOfHyperlinks, CWNumberOfBlogs Number of observations: 164 1) ReviewedCompendiums <= 32; criterion = 1, statistic = 138.527 2) ReviewedCompendiums <= 11; criterion = 1, statistic = 36.683 3)* weights = 19 2) ReviewedCompendiums > 11 4) ReviewedCompendiums <= 25; criterion = 0.982, statistic = 9.367 5)* weights = 9 4) ReviewedCompendiums > 25 6)* weights = 14 1) ReviewedCompendiums > 32 7) ReviewedCompendiums <= 46; criterion = 1, statistic = 63.471 8) TotalTime <= 300526; criterion = 0.995, statistic = 11.761 9)* weights = 63 8) TotalTime > 300526 10) ReviewedCompendiums <= 39; criterion = 0.993, statistic = 10.952 11)* weights = 8 10) ReviewedCompendiums > 39 12)* weights = 21 7) ReviewedCompendiums > 46 13) ReviewedCompendiums <= 55; criterion = 0.998, statistic = 13.184 14)* weights = 23 13) ReviewedCompendiums > 55 15)* weights = 7 > postscript(file="/var/wessaorg/rcomp/tmp/2inpw1324379948.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/3nk7l1324379948.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 126 119.761905 6.2380952 2 127 119.761905 7.2380952 3 111 119.761905 -8.7619048 4 133 119.761905 13.2380952 5 64 81.285714 -17.2857143 6 89 119.761905 -30.7619048 7 122 123.500000 -1.5000000 8 22 55.888889 -33.8888889 9 117 119.761905 -2.7619048 10 82 119.761905 -37.7619048 11 147 147.285714 -0.2857143 12 192 202.571429 -10.5714286 13 113 119.761905 -6.7619048 14 171 167.608696 3.3913043 15 87 119.761905 -32.7619048 16 207 202.571429 4.4285714 17 153 147.285714 5.7142857 18 92 123.500000 -31.5000000 19 95 81.285714 13.7142857 20 193 167.608696 25.3913043 21 160 167.608696 -7.6086957 22 144 123.500000 20.5000000 23 84 55.888889 28.1111111 24 223 202.571429 20.4285714 25 154 119.761905 34.2380952 26 139 119.761905 19.2380952 27 142 119.761905 22.2380952 28 148 119.761905 28.2380952 29 99 81.285714 17.7142857 30 135 147.285714 -12.2857143 31 179 167.608696 11.3913043 32 149 167.608696 -18.6086957 33 187 167.608696 19.3913043 34 137 119.761905 17.2380952 35 163 147.285714 15.7142857 36 127 119.761905 7.2380952 37 151 147.285714 3.7142857 38 89 119.761905 -30.7619048 39 46 55.888889 -9.8888889 40 156 147.285714 8.7142857 41 128 147.285714 -19.2857143 42 111 119.761905 -8.7619048 43 114 119.761905 -5.7619048 44 148 167.608696 -19.6086957 45 45 119.761905 -74.7619048 46 134 147.285714 -13.2857143 47 66 81.285714 -15.2857143 48 180 167.608696 12.3913043 49 177 167.608696 9.3913043 50 146 119.761905 26.2380952 51 137 119.761905 17.2380952 52 7 5.842105 1.1578947 53 157 147.285714 9.7142857 54 61 55.888889 5.1111111 55 41 55.888889 -14.8888889 56 123 119.761905 3.2380952 57 228 202.571429 25.4285714 58 137 123.500000 13.5000000 59 150 147.285714 2.7142857 60 141 119.761905 21.2380952 61 181 167.608696 13.3913043 62 73 81.285714 -8.2857143 63 97 119.761905 -22.7619048 64 142 119.761905 22.2380952 65 125 119.761905 5.2380952 66 87 81.285714 5.7142857 67 140 119.761905 20.2380952 68 148 119.761905 28.2380952 69 116 119.761905 -3.7619048 70 89 81.285714 7.7142857 71 160 167.608696 -7.6086957 72 67 55.888889 11.1111111 73 179 167.608696 11.3913043 74 90 119.761905 -29.7619048 75 144 119.761905 24.2380952 76 144 147.285714 -3.2857143 77 135 123.500000 11.5000000 78 125 119.761905 5.2380952 79 146 119.761905 26.2380952 80 121 119.761905 1.2380952 81 109 119.761905 -10.7619048 82 138 147.285714 -9.2857143 83 99 81.285714 17.7142857 84 92 119.761905 -27.7619048 85 27 5.842105 21.1578947 86 77 81.285714 -4.2857143 87 137 119.761905 17.2380952 88 140 123.500000 16.5000000 89 122 202.571429 -80.5714286 90 159 119.761905 39.2380952 91 97 119.761905 -22.7619048 92 144 119.761905 24.2380952 93 90 81.285714 8.7142857 94 135 119.761905 15.2380952 95 147 147.285714 -0.2857143 96 155 119.761905 35.2380952 97 127 119.761905 7.2380952 98 104 119.761905 -15.7619048 99 248 202.571429 45.4285714 100 116 123.500000 -7.5000000 101 176 167.608696 8.3913043 102 133 147.285714 -14.2857143 103 59 119.761905 -60.7619048 104 64 55.888889 8.1111111 105 40 55.888889 -15.8888889 106 98 119.761905 -21.7619048 107 125 119.761905 5.2380952 108 135 147.285714 -12.2857143 109 83 81.285714 1.7142857 110 138 119.761905 18.2380952 111 149 147.285714 1.7142857 112 115 119.761905 -4.7619048 113 0 5.842105 -5.8421053 114 103 119.761905 -16.7619048 115 30 5.842105 24.1578947 116 119 119.761905 -0.7619048 117 102 123.500000 -21.5000000 118 0 5.842105 -5.8421053 119 77 81.285714 -4.2857143 120 9 5.842105 3.1578947 121 143 147.285714 -4.2857143 122 163 167.608696 -4.6086957 123 146 167.608696 -21.6086957 124 94 81.285714 12.7142857 125 21 5.842105 15.1578947 126 151 119.761905 31.2380952 127 187 167.608696 19.3913043 128 171 167.608696 3.3913043 129 170 167.608696 2.3913043 130 145 167.608696 -22.6086957 131 198 202.571429 -4.5714286 132 137 119.761905 17.2380952 133 100 119.761905 -19.7619048 134 162 147.285714 14.7142857 135 163 147.285714 15.7142857 136 153 119.761905 33.2380952 137 161 147.285714 13.7142857 138 112 119.761905 -7.7619048 139 135 119.761905 15.2380952 140 124 119.761905 4.2380952 141 45 81.285714 -36.2857143 142 144 147.285714 -3.2857143 143 126 119.761905 6.2380952 144 78 55.888889 22.1111111 145 149 167.608696 -18.6086957 146 196 167.608696 28.3913043 147 118 119.761905 -1.7619048 148 159 167.608696 -8.6086957 149 0 5.842105 -5.8421053 150 0 5.842105 -5.8421053 151 0 5.842105 -5.8421053 152 0 5.842105 -5.8421053 153 0 5.842105 -5.8421053 154 0 5.842105 -5.8421053 155 88 119.761905 -31.7619048 156 129 167.608696 -38.6086957 157 0 5.842105 -5.8421053 158 0 5.842105 -5.8421053 159 0 5.842105 -5.8421053 160 13 5.842105 7.1578947 161 4 5.842105 -1.8421053 162 82 119.761905 -37.7619048 163 0 5.842105 -5.8421053 164 71 119.761905 -48.7619048 > 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/4jd2m1324379948.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/5et0f1324379948.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/6p6sc1324379948.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/7nwil1324379949.tab") + } > > try(system("convert tmp/2inpw1324379948.ps tmp/2inpw1324379948.png",intern=TRUE)) character(0) > try(system("convert tmp/3nk7l1324379948.ps tmp/3nk7l1324379948.png",intern=TRUE)) character(0) > try(system("convert tmp/4jd2m1324379948.ps tmp/4jd2m1324379948.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.287 0.278 4.562