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(38 + ,1724 + ,270018 + ,90 + ,476 + ,140824 + ,165 + ,3 + ,34 + ,1209 + ,179444 + ,63 + ,429 + ,110459 + ,135 + ,4 + ,42 + ,1844 + ,222373 + ,59 + ,673 + ,105079 + ,121 + ,16 + ,38 + ,2683 + ,218443 + ,135 + ,1137 + ,112098 + ,148 + ,2 + ,27 + ,1149 + ,162874 + ,48 + ,348 + ,43929 + ,73 + ,1 + ,35 + ,631 + ,70849 + ,46 + ,179 + ,76173 + ,49 + ,3 + ,33 + ,4513 + ,498732 + ,109 + ,2201 + ,187326 + ,185 + ,0 + ,18 + ,381 + ,33186 + ,46 + ,111 + ,22807 + ,5 + ,0 + ,34 + ,1997 + ,207822 + ,75 + ,735 + ,144408 + ,125 + ,7 + ,33 + ,1758 + ,213274 + ,72 + ,595 + ,66485 + ,93 + ,0 + ,44 + ,2079 + ,298841 + ,80 + ,780 + ,79089 + ,154 + ,0 + ,55 + ,2128 + ,237633 + ,61 + ,660 + ,81625 + ,98 + ,7 + ,37 + ,1659 + ,164107 + ,60 + ,633 + ,68788 + ,70 + ,8 + ,52 + ,2934 + ,358752 + ,114 + ,1163 + ,103297 + ,148 + ,4 + ,43 + ,1944 + ,222781 + ,46 + ,622 + ,69446 + ,100 + ,10 + ,59 + ,4764 + ,369889 + ,127 + ,1650 + ,114948 + ,150 + ,0 + ,36 + ,2122 + ,305704 + ,58 + ,746 + ,167949 + ,197 + ,6 + ,39 + ,2956 + ,322896 + ,90 + ,1157 + ,125081 + ,114 + ,4 + ,29 + ,1438 + ,176082 + ,41 + ,507 + ,125818 + ,169 + ,3 + ,49 + ,2320 + ,263411 + ,62 + ,683 + ,136588 + ,200 + ,8 + ,45 + ,2471 + ,271965 + ,99 + ,828 + ,112431 + ,148 + ,0 + ,39 + ,2769 + ,425544 + ,101 + ,1203 + ,103037 + ,140 + ,1 + ,25 + ,1442 + ,179306 + ,62 + ,461 + ,82317 + ,74 + ,5 + ,52 + ,1717 + ,189897 + ,65 + ,601 + ,118906 + ,128 + ,9 + ,41 + ,3220 + ,220665 + ,150 + ,1201 + ,83515 + ,140 + ,1 + ,38 + ,2733 + ,214779 + ,72 + ,990 + ,104581 + ,116 + ,0 + ,41 + ,2824 + ,267198 + ,91 + ,1061 + ,103129 + ,147 + ,5 + ,43 + ,1968 + ,270750 + ,73 + ,617 + ,83243 + ,132 + ,0 + ,32 + ,1495 + ,155915 + ,53 + ,559 + ,37110 + ,70 + ,0 + ,41 + ,2745 + ,330118 + ,140 + ,1031 + ,113344 + ,144 + ,0 + ,46 + ,2290 + ,281588 + ,50 + ,911 + ,139165 + ,155 + ,3 + ,49 + ,1830 + ,204039 + ,83 + ,615 + ,86652 + ,165 + ,6 + ,48 + ,2090 + ,318563 + ,53 + ,779 + ,112302 + ,161 + ,1 + ,37 + ,945 + ,97717 + ,40 + ,310 + ,69652 + ,31 + ,4 + ,39 + ,3092 + ,369331 + ,72 + ,1198 + ,119442 + ,199 + ,4 + ,42 + ,2764 + ,273950 + ,87 + ,1186 + ,69867 + ,78 + ,0 + ,43 + ,3658 + ,422946 + ,74 + ,1317 + ,101629 + ,121 + ,0 + ,36 + ,1842 + ,215710 + ,67 + ,611 + ,70168 + ,112 + ,2 + ,17 + ,934 + ,115469 + ,36 + ,276 + ,31081 + ,41 + ,1 + ,39 + ,3342 + ,343095 + ,45 + ,1185 + ,103925 + ,158 + ,2 + ,39 + ,3246 + ,324178 + ,42 + ,1490 + ,92622 + ,123 + ,10 + ,41 + ,1629 + ,170369 + ,75 + ,646 + ,79011 + ,104 + ,9 + ,36 + ,1735 + ,195153 + ,82 + ,635 + ,93487 + ,94 + ,5 + ,42 + ,1714 + ,173510 + ,85 + ,470 + ,64520 + ,73 + ,6 + ,45 + ,2496 + ,153778 + ,82 + ,1022 + ,93473 + ,52 + ,1 + ,41 + ,5501 + ,455168 + ,848 + ,2068 + ,114360 + ,71 + ,2 + ,26 + ,918 + ,78800 + ,57 + ,330 + ,33032 + ,21 + ,2 + ,52 + ,2228 + ,208051 + ,80 + ,648 + ,96125 + ,155 + ,0 + ,47 + ,3942 + ,334657 + ,116 + ,1342 + ,151911 + ,174 + ,10 + ,45 + ,2081 + ,175523 + ,68 + ,868 + ,89256 + ,136 + ,3 + ,40 + ,1816 + ,213060 + ,48 + ,559 + ,95671 + ,128 + ,0 + ,4 + ,496 + ,24188 + ,20 + ,218 + ,5950 + ,7 + ,0 + ,44 + ,2533 + ,372238 + ,81 + ,833 + ,149695 + ,165 + ,8 + ,18 + ,744 + ,65029 + ,21 + ,255 + ,32551 + ,21 + ,5 + ,14 + ,1161 + ,101097 + ,70 + ,454 + ,31701 + ,35 + ,3 + ,37 + ,3027 + ,279012 + ,125 + ,1108 + ,100087 + ,137 + ,1 + ,56 + ,2433 + ,302218 + ,80 + ,642 + ,169707 + ,174 + ,5 + ,39 + ,3576 + ,323514 + ,220 + ,1079 + ,150491 + ,257 + ,5 + ,42 + ,2606 + ,339837 + ,63 + ,1046 + ,120192 + ,207 + ,0 + ,36 + ,2175 + ,252529 + ,77 + ,822 + ,95893 + ,103 + ,12 + ,46 + ,3937 + ,370483 + ,65 + ,1298 + ,151715 + ,171 + ,10 + ,28 + ,3161 + ,303406 + ,146 + ,1143 + ,176225 + ,279 + ,12 + ,43 + ,2790 + ,250858 + ,72 + ,1124 + ,59900 + ,83 + ,11 + ,42 + ,2610 + ,264889 + ,59 + ,931 + ,104767 + ,130 + ,8 + ,37 + ,1426 + ,228595 + ,58 + ,557 + ,114799 + ,131 + ,2 + ,30 + ,1646 + ,216027 + ,58 + ,436 + ,72128 + ,126 + ,0 + ,35 + ,1867 + ,188780 + ,54 + ,566 + ,143592 + ,158 + ,6 + ,44 + ,2736 + ,237856 + ,89 + ,832 + ,89626 + ,138 + ,9 + ,36 + ,2277 + ,232765 + ,78 + ,834 + ,131072 + ,200 + ,2 + ,28 + ,1675 + ,175699 + ,62 + ,621 + ,126817 + ,104 + ,5 + ,45 + ,2537 + ,239314 + ,64 + ,865 + ,81351 + ,111 + ,13 + ,23 + ,893 + ,73566 + ,39 + ,385 + ,22618 + ,26 + ,6 + ,45 + ,2190 + ,242585 + ,58 + ,716 + ,88977 + ,115 + ,7 + ,38 + ,1694 + ,187167 + ,94 + ,705 + ,92059 + ,127 + ,2 + ,38 + ,1948 + ,191920 + ,61 + ,683 + ,81897 + ,140 + ,1 + ,45 + ,2314 + ,359644 + ,95 + ,982 + ,108146 + ,121 + ,4 + ,36 + ,2645 + ,341637 + ,48 + ,1056 + ,126372 + ,183 + ,3 + ,41 + ,1804 + ,206059 + ,50 + ,522 + ,249771 + ,68 + ,6 + ,38 + ,2250 + ,201783 + ,58 + ,690 + ,71154 + ,112 + ,2 + ,37 + ,1787 + ,182231 + ,67 + ,644 + ,71571 + ,103 + ,0 + ,28 + ,1678 + ,153613 + ,41 + ,622 + ,55918 + ,63 + ,1 + ,45 + ,4009 + ,454794 + ,114 + ,1226 + ,160141 + ,166 + ,0 + ,26 + ,1369 + ,145943 + ,45 + ,653 + ,38692 + ,38 + ,5 + ,44 + ,2306 + ,280343 + ,57 + ,656 + ,102812 + ,163 + ,2 + ,8 + ,870 + ,80953 + ,31 + ,437 + ,56622 + ,59 + ,0 + ,27 + ,1966 + ,150216 + ,175 + ,822 + ,15986 + ,27 + ,0 + ,36 + ,1338 + ,156923 + ,68 + ,390 + ,123534 + ,108 + ,6 + ,37 + ,3731 + ,365448 + ,278 + ,1467 + ,108535 + ,88 + ,1 + ,57 + ,2617 + ,318651 + ,91 + ,907 + ,93879 + ,92 + ,0 + ,45 + ,3085 + ,179797 + ,72 + ,1044 + ,144551 + ,170 + ,1 + ,37 + ,2312 + ,251466 + ,58 + ,786 + ,56750 + ,98 + ,1 + ,38 + ,2136 + ,254506 + ,71 + ,655 + ,127654 + ,205 + ,3 + ,31 + ,1808 + ,185890 + ,86 + ,590 + ,65594 + ,96 + ,9 + ,36 + ,2992 + ,263577 + ,89 + ,1072 + ,59938 + ,107 + ,1 + ,36 + ,2474 + ,314255 + ,134 + ,947 + ,146975 + ,150 + ,4 + ,36 + ,1624 + ,189252 + ,64 + ,555 + ,143372 + ,123 + ,3 + ,35 + ,1606 + ,222504 + ,72 + ,552 + ,168553 + ,176 + ,5 + ,39 + ,2091 + ,285198 + ,61 + ,771 + ,183500 + ,213 + ,0 + ,65 + ,3930 + ,376927 + ,130 + ,1291 + ,165986 + ,208 + ,12 + ,30 + ,3705 + ,397681 + ,73 + ,1415 + ,184923 + ,307 + ,13 + ,51 + ,2676 + ,287015 + ,83 + ,846 + ,140358 + ,125 + ,8 + ,41 + ,2296 + ,285330 + ,85 + ,838 + ,149959 + ,208 + ,0 + ,36 + ,1997 + ,186856 + ,116 + ,640 + ,57224 + ,73 + ,0 + ,19 + ,602 + ,43287 + ,43 + ,214 + ,43750 + ,49 + ,4 + ,23 + ,2146 + ,185468 + ,85 + ,716 + ,48029 + ,82 + ,4 + ,40 + ,2157 + ,222268 + ,72 + ,755 + ,104978 + ,206 + ,0 + ,40 + ,2549 + ,259692 + ,110 + ,1140 + ,100046 + ,112 + ,0 + ,40 + ,2649 + ,301614 + ,55 + ,1030 + ,101047 + ,139 + ,0 + ,30 + ,1110 + ,121726 + ,44 + ,356 + ,197426 + ,60 + ,0 + ,41 + ,3102 + ,154165 + ,79 + ,906 + ,160902 + ,70 + ,0 + ,40 + ,1861 + ,306952 + ,58 + ,606 + ,147172 + ,112 + ,4 + ,45 + ,2295 + ,297982 + ,70 + ,684 + ,109432 + ,142 + ,0 + ,1 + ,398 + ,23623 + ,9 + ,156 + ,1168 + ,11 + ,0 + ,40 + ,2205 + ,195817 + ,54 + ,779 + ,83248 + ,130 + ,0 + ,11 + ,530 + ,61857 + ,25 + ,192 + ,25162 + ,31 + ,4 + ,45 + ,1596 + ,163766 + ,107 + ,457 + ,45724 + ,132 + ,0 + ,38 + ,2949 + ,384053 + ,63 + ,1162 + ,110529 + ,219 + ,1 + ,0 + ,387 + ,21054 + ,2 + ,146 + ,855 + ,4 + ,0 + ,30 + ,2137 + ,252805 + ,67 + ,866 + ,101382 + ,102 + ,5 + ,8 + ,492 + ,31961 + ,22 + ,200 + ,14116 + ,39 + ,0 + ,39 + ,3397 + ,311281 + ,153 + ,1211 + ,89506 + ,125 + ,3 + ,48 + ,2089 + ,240153 + ,79 + ,696 + ,135356 + ,121 + ,7 + ,48 + ,1638 + ,174892 + ,112 + ,485 + ,116066 + ,42 + ,13 + ,29 + ,1685 + ,152043 + ,47 + ,670 + ,144244 + ,111 + ,3 + ,8 + ,568 + ,38214 + ,52 + ,276 + ,8773 + ,16 + ,0 + ,43 + ,1917 + ,199336 + ,113 + ,662 + ,102153 + ,70 + ,2 + ,52 + ,2759 + ,353021 + ,115 + ,1010 + ,117440 + ,162 + ,0 + ,53 + ,1288 + ,196269 + ,64 + ,445 + ,104128 + ,173 + ,0 + ,48 + ,3554 + ,403932 + ,134 + ,1564 + ,134238 + ,171 + ,4 + ,48 + ,2387 + ,316105 + ,120 + ,820 + ,134047 + ,172 + ,0 + ,50 + ,3328 + ,396725 + ,111 + ,1151 + ,279488 + ,254 + ,3 + ,40 + ,1250 + ,187992 + ,49 + ,473 + ,79756 + ,90 + ,0 + ,36 + ,1121 + ,102424 + ,55 + ,401 + ,66089 + ,50 + ,0 + ,40 + ,2867 + ,284271 + ,149 + ,949 + ,102070 + ,113 + ,4 + ,46 + ,4024 + ,401260 + ,155 + ,1429 + ,146760 + ,187 + ,4 + ,40 + ,1721 + ,137843 + ,104 + ,534 + ,154771 + ,16 + ,15 + ,46 + ,4061 + ,383703 + ,146 + ,1698 + ,165933 + ,175 + ,0 + ,39 + ,1830 + ,157429 + ,76 + ,689 + ,64593 + ,90 + ,4 + ,41 + ,1627 + ,236370 + ,83 + ,528 + ,92280 + ,140 + ,1 + ,46 + ,2535 + ,282399 + ,192 + ,897 + ,67150 + ,145 + ,1 + ,32 + ,1808 + ,217478 + ,69 + ,610 + ,128692 + ,141 + ,0 + ,39 + ,3873 + ,366774 + ,117 + ,1548 + ,124089 + ,125 + ,9 + ,39 + ,2181 + ,236660 + ,67 + ,759 + ,125386 + ,241 + ,1 + ,21 + ,2035 + ,173260 + ,37 + ,716 + ,37238 + ,16 + ,3 + ,45 + ,2960 + ,323545 + ,56 + ,955 + ,140015 + ,175 + ,11 + ,50 + ,1915 + ,168994 + ,122 + ,720 + ,150047 + ,132 + ,5 + ,36 + ,2604 + ,246745 + ,52 + ,1011 + ,154451 + ,154 + ,2 + ,44 + ,2633 + ,301703 + ,64 + ,818 + ,156349 + ,198 + ,1 + ,0 + ,2 + ,1 + ,0 + ,0 + ,0 + ,0 + ,9 + ,0 + ,207 + ,14688 + ,0 + ,85 + ,6023 + ,5 + ,0 + ,0 + ,5 + ,98 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,8 + ,455 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,37 + ,2030 + ,233143 + ,58 + ,699 + ,84601 + ,125 + ,2 + ,47 + ,3179 + ,372078 + ,118 + ,1052 + ,68946 + ,174 + ,3 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,4 + ,203 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,151 + ,7199 + ,0 + ,74 + ,1644 + ,6 + ,0 + ,5 + ,474 + ,46660 + ,7 + ,259 + ,6179 + ,13 + ,0 + ,1 + ,141 + ,17547 + ,3 + ,69 + ,3926 + ,3 + ,0 + ,43 + ,1047 + ,116678 + ,89 + ,285 + ,52789 + ,35 + ,0 + ,0 + ,29 + ,969 + ,0 + ,0 + ,0 + ,0 + ,0 + ,32 + ,1767 + ,201582 + ,48 + ,582 + ,100350 + ,80 + ,2) + ,dim=c(8 + ,164) + ,dimnames=list(c('Revieuw' + ,'Pagevieuws' + ,'Time' + ,'Compendiumvieuws_pr' + ,'Coursecompendium' + ,'CompendiumCharacters' + ,'Hyperlinks' + ,'shared') + ,1:164)) > y <- array(NA,dim=c(8,164),dimnames=list(c('Revieuw','Pagevieuws','Time','Compendiumvieuws_pr','Coursecompendium','CompendiumCharacters','Hyperlinks','shared'),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 = 'yes' > par3 = '2' > par2 = 'quantiles' > par1 = '1' > library(party) Loading required package: survival Loading required package: splines Loading required package: grid Loading required package: modeltools Loading required package: stats4 Loading required package: coin Loading required package: mvtnorm Loading required package: zoo Loading required package: sandwich Loading required package: strucchange Loading required package: vcd Loading required package: MASS Loading required package: colorspace > library(Hmisc) Attaching package: 'Hmisc' The following object(s) are masked from 'package:survival': untangle.specials The following object(s) are masked from 'package:base': format.pval, round.POSIXt, trunc.POSIXt, units > par1 <- as.numeric(par1) > par3 <- as.numeric(par3) > x <- data.frame(t(y)) > is.data.frame(x) [1] TRUE > x <- x[!is.na(x[,par1]),] > k <- length(x[1,]) > n <- length(x[,1]) > colnames(x)[par1] [1] "Revieuw" > x[,par1] [1] 38 34 42 38 27 35 33 18 34 33 44 55 37 52 43 59 36 39 29 49 45 39 25 52 41 [26] 38 41 43 32 41 46 49 48 37 39 42 43 36 17 39 39 41 36 42 45 41 26 52 47 45 [51] 40 4 44 18 14 37 56 39 42 36 46 28 43 42 37 30 35 44 36 28 45 23 45 38 38 [76] 45 36 41 38 37 28 45 26 44 8 27 36 37 57 45 37 38 31 36 36 36 35 39 65 30 [101] 51 41 36 19 23 40 40 40 30 41 40 45 1 40 11 45 38 0 30 8 39 48 48 29 8 [126] 43 52 53 48 48 50 40 36 40 46 40 46 39 41 46 32 39 39 21 45 50 36 44 0 0 [151] 0 0 0 0 37 47 0 0 0 5 1 43 0 32 > 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,40) [40,65] 92 72 > colnames(x) [1] "Revieuw" "Pagevieuws" "Time" [4] "Compendiumvieuws_pr" "Coursecompendium" "CompendiumCharacters" [7] "Hyperlinks" "shared" > colnames(x)[par1] [1] "Revieuw" > x[,par1] [1] [ 0,40) [ 0,40) [40,65] [ 0,40) [ 0,40) [ 0,40) [ 0,40) [ 0,40) [ 0,40) [10] [ 0,40) [40,65] [40,65] [ 0,40) [40,65] [40,65] [40,65] [ 0,40) [ 0,40) [19] [ 0,40) [40,65] [40,65] [ 0,40) [ 0,40) [40,65] [40,65] [ 0,40) [40,65] [28] [40,65] [ 0,40) [40,65] [40,65] [40,65] [40,65] [ 0,40) [ 0,40) [40,65] [37] [40,65] [ 0,40) [ 0,40) [ 0,40) [ 0,40) [40,65] [ 0,40) [40,65] [40,65] [46] [40,65] [ 0,40) [40,65] [40,65] [40,65] [40,65] [ 0,40) [40,65] [ 0,40) [55] [ 0,40) [ 0,40) [40,65] [ 0,40) [40,65] [ 0,40) [40,65] [ 0,40) [40,65] [64] [40,65] [ 0,40) [ 0,40) [ 0,40) [40,65] [ 0,40) [ 0,40) [40,65] [ 0,40) [73] [40,65] [ 0,40) [ 0,40) [40,65] [ 0,40) [40,65] [ 0,40) [ 0,40) [ 0,40) [82] [40,65] [ 0,40) [40,65] [ 0,40) [ 0,40) [ 0,40) [ 0,40) [40,65] [40,65] [91] [ 0,40) [ 0,40) [ 0,40) [ 0,40) [ 0,40) [ 0,40) [ 0,40) [ 0,40) [40,65] [100] [ 0,40) [40,65] [40,65] [ 0,40) [ 0,40) [ 0,40) [40,65] [40,65] [40,65] [109] [ 0,40) [40,65] [40,65] [40,65] [ 0,40) [40,65] [ 0,40) [40,65] [ 0,40) [118] [ 0,40) [ 0,40) [ 0,40) [ 0,40) [40,65] [40,65] [ 0,40) [ 0,40) [40,65] [127] [40,65] [40,65] [40,65] [40,65] [40,65] [40,65] [ 0,40) [40,65] [40,65] [136] [40,65] [40,65] [ 0,40) [40,65] [40,65] [ 0,40) [ 0,40) [ 0,40) [ 0,40) [145] [40,65] [40,65] [ 0,40) [40,65] [ 0,40) [ 0,40) [ 0,40) [ 0,40) [ 0,40) [154] [ 0,40) [ 0,40) [40,65] [ 0,40) [ 0,40) [ 0,40) [ 0,40) [ 0,40) [40,65] [163] [ 0,40) [ 0,40) Levels: [ 0,40) [40,65] > 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/1mbhe1324156070.tab") + } + } m.ct.i.pred m.ct.i.actu 1 2 1 369 456 2 35 614 [1] 0.4472727 [1] 0.9460709 [1] 0.6668928 m.ct.x.pred m.ct.x.actu 1 2 1 33 62 2 10 61 [1] 0.3473684 [1] 0.859155 [1] 0.5662651 > m Conditional inference tree with 2 terminal nodes Response: as.factor(Revieuw) Inputs: Pagevieuws, Time, Compendiumvieuws_pr, Coursecompendium, CompendiumCharacters, Hyperlinks, shared Number of observations: 164 1) Time <= 115469; criterion = 1, statistic = 28.934 2)* weights = 29 1) Time > 115469 3)* weights = 135 > postscript(file="/var/www/rcomp/tmp/2712a1324156070.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/3aijf1324156070.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x[,par1] ~ as.factor(where(m)),main='Response by Terminal Node',xlab='Terminal Node',ylab='Response') > dev.off() null device 1 > if (par2 == 'none') { + forec <- predict(m) + result <- as.data.frame(cbind(x[,par1],forec,x[,par1]-forec)) + colnames(result) <- c('Actuals','Forecasts','Residuals') + print(result) + } > if (par2 != 'none') { + print(cbind(as.factor(x[,par1]),predict(m))) + myt <- table(as.factor(x[,par1]),predict(m)) + print(myt) + } [,1] [,2] [1,] 1 2 [2,] 1 2 [3,] 2 2 [4,] 1 2 [5,] 1 2 [6,] 1 1 [7,] 1 2 [8,] 1 1 [9,] 1 2 [10,] 1 2 [11,] 2 2 [12,] 2 2 [13,] 1 2 [14,] 2 2 [15,] 2 2 [16,] 2 2 [17,] 1 2 [18,] 1 2 [19,] 1 2 [20,] 2 2 [21,] 2 2 [22,] 1 2 [23,] 1 2 [24,] 2 2 [25,] 2 2 [26,] 1 2 [27,] 2 2 [28,] 2 2 [29,] 1 2 [30,] 2 2 [31,] 2 2 [32,] 2 2 [33,] 2 2 [34,] 1 1 [35,] 1 2 [36,] 2 2 [37,] 2 2 [38,] 1 2 [39,] 1 1 [40,] 1 2 [41,] 1 2 [42,] 2 2 [43,] 1 2 [44,] 2 2 [45,] 2 2 [46,] 2 2 [47,] 1 1 [48,] 2 2 [49,] 2 2 [50,] 2 2 [51,] 2 2 [52,] 1 1 [53,] 2 2 [54,] 1 1 [55,] 1 1 [56,] 1 2 [57,] 2 2 [58,] 1 2 [59,] 2 2 [60,] 1 2 [61,] 2 2 [62,] 1 2 [63,] 2 2 [64,] 2 2 [65,] 1 2 [66,] 1 2 [67,] 1 2 [68,] 2 2 [69,] 1 2 [70,] 1 2 [71,] 2 2 [72,] 1 1 [73,] 2 2 [74,] 1 2 [75,] 1 2 [76,] 2 2 [77,] 1 2 [78,] 2 2 [79,] 1 2 [80,] 1 2 [81,] 1 2 [82,] 2 2 [83,] 1 2 [84,] 2 2 [85,] 1 1 [86,] 1 2 [87,] 1 2 [88,] 1 2 [89,] 2 2 [90,] 2 2 [91,] 1 2 [92,] 1 2 [93,] 1 2 [94,] 1 2 [95,] 1 2 [96,] 1 2 [97,] 1 2 [98,] 1 2 [99,] 2 2 [100,] 1 2 [101,] 2 2 [102,] 2 2 [103,] 1 2 [104,] 1 1 [105,] 1 2 [106,] 2 2 [107,] 2 2 [108,] 2 2 [109,] 1 2 [110,] 2 2 [111,] 2 2 [112,] 2 2 [113,] 1 1 [114,] 2 2 [115,] 1 1 [116,] 2 2 [117,] 1 2 [118,] 1 1 [119,] 1 2 [120,] 1 1 [121,] 1 2 [122,] 2 2 [123,] 2 2 [124,] 1 2 [125,] 1 1 [126,] 2 2 [127,] 2 2 [128,] 2 2 [129,] 2 2 [130,] 2 2 [131,] 2 2 [132,] 2 2 [133,] 1 1 [134,] 2 2 [135,] 2 2 [136,] 2 2 [137,] 2 2 [138,] 1 2 [139,] 2 2 [140,] 2 2 [141,] 1 2 [142,] 1 2 [143,] 1 2 [144,] 1 2 [145,] 2 2 [146,] 2 2 [147,] 1 2 [148,] 2 2 [149,] 1 1 [150,] 1 1 [151,] 1 1 [152,] 1 1 [153,] 1 1 [154,] 1 1 [155,] 1 2 [156,] 2 2 [157,] 1 1 [158,] 1 1 [159,] 1 1 [160,] 1 1 [161,] 1 1 [162,] 2 2 [163,] 1 1 [164,] 1 2 [ 0,40) [40,65] [ 0,40) 29 63 [40,65] 0 72 > postscript(file="/var/www/rcomp/tmp/427yl1324156070.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/5b99g1324156070.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/67fvl1324156070.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/7p91s1324156070.tab") + } > > try(system("convert tmp/2712a1324156070.ps tmp/2712a1324156070.png",intern=TRUE)) character(0) > try(system("convert tmp/3aijf1324156070.ps tmp/3aijf1324156070.png",intern=TRUE)) character(0) > try(system("convert tmp/427yl1324156070.ps tmp/427yl1324156070.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.460 0.190 3.633