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(210907 + ,1418 + ,30 + ,94 + ,120982 + ,869 + ,28 + ,103 + ,176508 + ,1530 + ,38 + ,93 + ,179321 + ,2172 + ,30 + ,103 + ,123185 + ,901 + ,22 + ,51 + ,52746 + ,463 + ,26 + ,70 + ,385534 + ,3201 + ,25 + ,91 + ,33170 + ,371 + ,18 + ,22 + ,101645 + ,1192 + ,11 + ,38 + ,149061 + ,1583 + ,26 + ,93 + ,165446 + ,1439 + ,25 + ,60 + ,237213 + ,1764 + ,38 + ,123 + ,173326 + ,1495 + ,44 + ,148 + ,133131 + ,1373 + ,30 + ,90 + ,258873 + ,2187 + ,40 + ,124 + ,180083 + ,1491 + ,34 + ,70 + ,324799 + ,4041 + ,47 + ,168 + ,230964 + ,1706 + ,30 + ,115 + ,236785 + ,2152 + ,31 + ,71 + ,135473 + ,1036 + ,23 + ,66 + ,202925 + ,1882 + ,36 + ,134 + ,215147 + ,1929 + ,36 + ,117 + ,344297 + ,2242 + ,30 + ,108 + ,153935 + ,1220 + ,25 + ,84 + ,132943 + ,1289 + ,39 + ,156 + ,174724 + ,2515 + ,34 + ,120 + ,174415 + ,2147 + ,31 + ,114 + ,225548 + ,2352 + ,31 + ,94 + ,223632 + ,1638 + ,33 + ,120 + ,124817 + ,1222 + ,25 + ,81 + ,221698 + ,1812 + ,33 + ,110 + ,210767 + ,1677 + ,35 + ,133 + ,170266 + ,1579 + ,42 + ,122 + ,260561 + ,1731 + ,43 + ,158 + ,84853 + ,807 + ,30 + ,109 + ,294424 + ,2452 + ,33 + ,124 + ,101011 + ,829 + ,13 + ,39 + ,215641 + ,1940 + ,32 + ,92 + ,325107 + ,2662 + ,36 + ,126 + ,7176 + ,186 + ,0 + ,0 + ,167542 + ,1499 + ,28 + ,70 + ,106408 + ,865 + ,14 + ,37 + ,96560 + ,1793 + ,17 + ,38 + ,265769 + ,2527 + ,32 + ,120 + ,269651 + ,2747 + ,30 + ,93 + ,149112 + ,1324 + ,35 + ,95 + ,175824 + ,2702 + ,20 + ,77 + ,152871 + ,1383 + ,28 + ,90 + ,111665 + ,1179 + ,28 + ,80 + ,116408 + ,2099 + ,39 + ,31 + ,362301 + ,4308 + ,34 + ,110 + ,78800 + ,918 + ,26 + ,66 + ,183167 + ,1831 + ,39 + ,138 + ,277965 + ,3373 + ,39 + ,133 + ,150629 + ,1713 + ,33 + ,113 + ,168809 + ,1438 + ,28 + ,100 + ,24188 + ,496 + ,4 + ,7 + ,329267 + ,2253 + ,39 + ,140 + ,65029 + ,744 + ,18 + ,61 + ,101097 + ,1161 + ,14 + ,41 + ,218946 + ,2352 + ,29 + ,96 + ,244052 + ,2144 + ,44 + ,164 + ,341570 + ,4691 + ,21 + ,78 + ,103597 + ,1112 + ,16 + ,49 + ,233328 + ,2694 + ,28 + ,102 + ,256462 + ,1973 + ,35 + ,124 + ,206161 + ,1769 + ,28 + ,99 + ,311473 + ,3148 + ,38 + ,129 + ,235800 + ,2474 + ,23 + ,62 + ,177939 + ,2084 + ,36 + ,73 + ,207176 + ,1954 + ,32 + ,114 + ,196553 + ,1226 + ,29 + ,99 + ,174184 + ,1389 + ,25 + ,70 + ,143246 + ,1496 + ,27 + ,104 + ,187559 + ,2269 + ,36 + ,116 + ,187681 + ,1833 + ,28 + ,91 + ,119016 + ,1268 + ,23 + ,74 + ,182192 + ,1943 + ,40 + ,138 + ,73566 + ,893 + ,23 + ,67 + ,194979 + ,1762 + ,40 + ,151 + ,167488 + ,1403 + ,28 + ,72 + ,143756 + ,1425 + ,34 + ,120 + ,275541 + ,1857 + ,33 + ,115 + ,243199 + ,1840 + ,28 + ,105 + ,182999 + ,1502 + ,34 + ,104 + ,135649 + ,1441 + ,30 + ,108 + ,152299 + ,1420 + ,33 + ,98 + ,120221 + ,1416 + ,22 + ,69 + ,346485 + ,2970 + ,38 + ,111 + ,145790 + ,1317 + ,26 + ,99 + ,193339 + ,1644 + ,35 + ,71 + ,80953 + ,870 + ,8 + ,27 + ,122774 + ,1654 + ,24 + ,69 + ,130585 + ,1054 + ,29 + ,107 + ,112611 + ,937 + ,20 + ,73 + ,286468 + ,3004 + ,29 + ,107 + ,241066 + ,2008 + ,45 + ,93 + ,148446 + ,2547 + ,37 + ,129 + ,204713 + ,1885 + ,33 + ,69 + ,182079 + ,1626 + ,33 + ,118 + ,140344 + ,1468 + ,25 + ,73 + ,220516 + ,2445 + ,32 + ,119 + ,243060 + ,1964 + ,29 + ,104 + ,162765 + ,1381 + ,28 + ,107 + ,182613 + ,1369 + ,28 + ,99 + ,232138 + ,1659 + ,31 + ,90 + ,265318 + ,2888 + ,52 + ,197 + ,85574 + ,1290 + ,21 + ,36 + ,310839 + ,2845 + ,24 + ,85 + ,225060 + ,1982 + ,41 + ,139 + ,232317 + ,1904 + ,33 + ,106 + ,144966 + ,1391 + ,32 + ,50 + ,43287 + ,602 + ,19 + ,64 + ,155754 + ,1743 + ,20 + ,31 + ,164709 + ,1559 + ,31 + ,63 + ,201940 + ,2014 + ,31 + ,92 + ,235454 + ,2143 + ,32 + ,106 + ,220801 + ,2146 + ,18 + ,63 + ,99466 + ,874 + ,23 + ,69 + ,92661 + ,1590 + ,17 + ,41 + ,133328 + ,1590 + ,20 + ,56 + ,61361 + ,1210 + ,12 + ,25 + ,125930 + ,2072 + ,17 + ,65 + ,100750 + ,1281 + ,30 + ,93 + ,224549 + ,1401 + ,31 + ,114 + ,82316 + ,834 + ,10 + ,38 + ,102010 + ,1105 + ,13 + ,44 + ,101523 + ,1272 + ,22 + ,87 + ,243511 + ,1944 + ,42 + ,110 + ,22938 + ,391 + ,1 + ,0 + ,41566 + ,761 + ,9 + ,27 + ,152474 + ,1605 + ,32 + ,83 + ,61857 + ,530 + ,11 + ,30 + ,99923 + ,1988 + ,25 + ,80 + ,132487 + ,1386 + ,36 + ,98 + ,317394 + ,2395 + ,31 + ,82 + ,21054 + ,387 + ,0 + ,0 + ,209641 + ,1742 + ,24 + ,60 + ,22648 + ,620 + ,13 + ,28 + ,31414 + ,449 + ,8 + ,9 + ,46698 + ,800 + ,13 + ,33 + ,131698 + ,1684 + ,19 + ,59 + ,91735 + ,1050 + ,18 + ,49 + ,244749 + ,2699 + ,33 + ,115 + ,184510 + ,1606 + ,40 + ,140 + ,79863 + ,1502 + ,22 + ,49 + ,128423 + ,1204 + ,38 + ,120 + ,97839 + ,1138 + ,24 + ,66 + ,38214 + ,568 + ,8 + ,21 + ,151101 + ,1459 + ,35 + ,124 + ,272458 + ,2158 + ,43 + ,152 + ,172494 + ,1111 + ,43 + ,139 + ,108043 + ,1421 + ,14 + ,38 + ,328107 + ,2833 + ,41 + ,144 + ,250579 + ,1955 + ,38 + ,120 + ,351067 + ,2922 + ,45 + ,160 + ,158015 + ,1002 + ,31 + ,114 + ,98866 + ,1060 + ,13 + ,39 + ,85439 + ,956 + ,28 + ,78 + ,229242 + ,2186 + ,31 + ,119 + ,351619 + ,3604 + ,40 + ,141 + ,84207 + ,1035 + ,30 + ,101 + ,120445 + ,1417 + ,16 + ,56 + ,324598 + ,3261 + ,37 + ,133 + ,131069 + ,1587 + ,30 + ,83 + ,204271 + ,1424 + ,35 + ,116 + ,165543 + ,1701 + ,32 + ,90 + ,141722 + ,1249 + ,27 + ,36 + ,116048 + ,946 + ,20 + ,50 + ,250047 + ,1926 + ,18 + ,61 + ,299775 + ,3352 + ,31 + ,97 + ,195838 + ,1641 + ,31 + ,98 + ,173260 + ,2035 + ,21 + ,78 + ,254488 + ,2312 + ,39 + ,117 + ,104389 + ,1369 + ,41 + ,148 + ,136084 + ,1577 + ,13 + ,41 + ,199476 + ,2201 + ,32 + ,105 + ,92499 + ,961 + ,18 + ,55 + ,224330 + ,1900 + ,39 + ,132 + ,135781 + ,1254 + ,14 + ,44 + ,74408 + ,1335 + ,7 + ,21 + ,81240 + ,1597 + ,17 + ,50 + ,14688 + ,207 + ,0 + ,0 + ,181633 + ,1645 + ,30 + ,73 + ,271856 + ,2429 + ,37 + ,86 + ,7199 + ,151 + ,0 + ,0 + ,46660 + ,474 + ,5 + ,13 + ,17547 + ,141 + ,1 + ,4 + ,133368 + ,1639 + ,16 + ,57 + ,95227 + ,872 + ,32 + ,48 + ,152601 + ,1318 + ,24 + ,46 + ,98146 + ,1018 + ,17 + ,48 + ,79619 + ,1383 + ,11 + ,32 + ,59194 + ,1314 + ,24 + ,68 + ,139942 + ,1335 + ,22 + ,87 + ,118612 + ,1403 + ,12 + ,43 + ,72880 + ,910 + ,19 + ,67 + ,65475 + ,616 + ,13 + ,46 + ,99643 + ,1407 + ,17 + ,46 + ,71965 + ,771 + ,15 + ,56 + ,77272 + ,766 + ,16 + ,48 + ,49289 + ,473 + ,24 + ,44 + ,135131 + ,1376 + ,15 + ,60 + ,108446 + ,1232 + ,17 + ,65 + ,89746 + ,1521 + ,18 + ,55 + ,44296 + ,572 + ,20 + ,38 + ,77648 + ,1059 + ,16 + ,52 + ,181528 + ,1544 + ,16 + ,60 + ,134019 + ,1230 + ,18 + ,54 + ,124064 + ,1206 + ,22 + ,86 + ,92630 + ,1205 + ,8 + ,24 + ,121848 + ,1255 + ,17 + ,52 + ,52915 + ,613 + ,18 + ,49 + ,81872 + ,721 + ,16 + ,61 + ,58981 + ,1109 + ,23 + ,61 + ,53515 + ,740 + ,22 + ,81 + ,60812 + ,1126 + ,13 + ,43 + ,56375 + ,728 + ,13 + ,40 + ,65490 + ,689 + ,16 + ,40 + ,80949 + ,592 + ,16 + ,56 + ,76302 + ,995 + ,20 + ,68 + ,104011 + ,1613 + ,22 + ,79 + ,98104 + ,2048 + ,17 + ,47 + ,67989 + ,705 + ,18 + ,57 + ,30989 + ,301 + ,17 + ,41 + ,135458 + ,1803 + ,12 + ,29 + ,73504 + ,799 + ,7 + ,3 + ,63123 + ,861 + ,17 + ,60 + ,61254 + ,1186 + ,14 + ,30 + ,74914 + ,1451 + ,23 + ,79 + ,31774 + ,628 + ,17 + ,47 + ,81437 + ,1161 + ,14 + ,40 + ,87186 + ,1463 + ,15 + ,48 + ,50090 + ,742 + ,17 + ,36 + ,65745 + ,979 + ,21 + ,42 + ,56653 + ,675 + ,18 + ,49 + ,158399 + ,1241 + ,18 + ,57 + ,46455 + ,676 + ,17 + ,12 + ,73624 + ,1049 + ,17 + ,40 + ,38395 + ,620 + ,16 + ,43 + ,91899 + ,1081 + ,15 + ,33 + ,139526 + ,1688 + ,21 + ,77 + ,52164 + ,736 + ,16 + ,43 + ,51567 + ,617 + ,14 + ,45 + ,70551 + ,812 + ,15 + ,47 + ,84856 + ,1051 + ,17 + ,43 + ,102538 + ,1656 + ,15 + ,45 + ,86678 + ,705 + ,15 + ,50 + ,85709 + ,945 + ,10 + ,35 + ,34662 + ,554 + ,6 + ,7 + ,150580 + ,1597 + ,22 + ,71 + ,99611 + ,982 + ,21 + ,67 + ,19349 + ,222 + ,1 + ,0 + ,99373 + ,1212 + ,18 + ,62 + ,86230 + ,1143 + ,17 + ,54 + ,30837 + ,435 + ,4 + ,4 + ,31706 + ,532 + ,10 + ,25 + ,89806 + ,882 + ,16 + ,40 + ,62088 + ,608 + ,16 + ,38 + ,40151 + ,459 + ,9 + ,19 + ,27634 + ,578 + ,16 + ,17 + ,76990 + ,826 + ,17 + ,67 + ,37460 + ,509 + ,7 + ,14 + ,54157 + ,717 + ,15 + ,30 + ,49862 + ,637 + ,14 + ,54 + ,84337 + ,857 + ,14 + ,35 + ,64175 + ,830 + ,18 + ,59 + ,59382 + ,652 + ,12 + ,24 + ,119308 + ,707 + ,16 + ,58 + ,76702 + ,954 + ,21 + ,42 + ,103425 + ,1461 + ,19 + ,46 + ,70344 + ,672 + ,16 + ,61 + ,43410 + ,778 + ,1 + ,3 + ,104838 + ,1141 + ,16 + ,52 + ,62215 + ,680 + ,10 + ,25 + ,69304 + ,1090 + ,19 + ,40 + ,53117 + ,616 + ,12 + ,32 + ,19764 + ,285 + ,2 + ,4 + ,86680 + ,1145 + ,14 + ,49 + ,84105 + ,733 + ,17 + ,63 + ,77945 + ,888 + ,19 + ,67 + ,89113 + ,849 + ,14 + ,32 + ,91005 + ,1182 + ,11 + ,23 + ,40248 + ,528 + ,4 + ,7 + ,64187 + ,642 + ,16 + ,54 + ,50857 + ,947 + ,20 + ,37 + ,56613 + ,819 + ,12 + ,35 + ,62792 + ,757 + ,15 + ,51 + ,72535 + ,894 + ,16 + ,39) + ,dim=c(4 + ,289) + ,dimnames=list(c('time_in_rfc' + ,'pageviews' + ,'compendiums_reviewed' + ,'feedback_messages_p120 ') + ,1:289)) > y <- array(NA,dim=c(4,289),dimnames=list(c('time_in_rfc','pageviews','compendiums_reviewed','feedback_messages_p120 '),1:289)) > 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] "time_in_rfc" > x[,par1] [1] 210907 120982 176508 179321 123185 52746 385534 33170 101645 149061 [11] 165446 237213 173326 133131 258873 180083 324799 230964 236785 135473 [21] 202925 215147 344297 153935 132943 174724 174415 225548 223632 124817 [31] 221698 210767 170266 260561 84853 294424 101011 215641 325107 7176 [41] 167542 106408 96560 265769 269651 149112 175824 152871 111665 116408 [51] 362301 78800 183167 277965 150629 168809 24188 329267 65029 101097 [61] 218946 244052 341570 103597 233328 256462 206161 311473 235800 177939 [71] 207176 196553 174184 143246 187559 187681 119016 182192 73566 194979 [81] 167488 143756 275541 243199 182999 135649 152299 120221 346485 145790 [91] 193339 80953 122774 130585 112611 286468 241066 148446 204713 182079 [101] 140344 220516 243060 162765 182613 232138 265318 85574 310839 225060 [111] 232317 144966 43287 155754 164709 201940 235454 220801 99466 92661 [121] 133328 61361 125930 100750 224549 82316 102010 101523 243511 22938 [131] 41566 152474 61857 99923 132487 317394 21054 209641 22648 31414 [141] 46698 131698 91735 244749 184510 79863 128423 97839 38214 151101 [151] 272458 172494 108043 328107 250579 351067 158015 98866 85439 229242 [161] 351619 84207 120445 324598 131069 204271 165543 141722 116048 250047 [171] 299775 195838 173260 254488 104389 136084 199476 92499 224330 135781 [181] 74408 81240 14688 181633 271856 7199 46660 17547 133368 95227 [191] 152601 98146 79619 59194 139942 118612 72880 65475 99643 71965 [201] 77272 49289 135131 108446 89746 44296 77648 181528 134019 124064 [211] 92630 121848 52915 81872 58981 53515 60812 56375 65490 80949 [221] 76302 104011 98104 67989 30989 135458 73504 63123 61254 74914 [231] 31774 81437 87186 50090 65745 56653 158399 46455 73624 38395 [241] 91899 139526 52164 51567 70551 84856 102538 86678 85709 34662 [251] 150580 99611 19349 99373 86230 30837 31706 89806 62088 40151 [261] 27634 76990 37460 54157 49862 84337 64175 59382 119308 76702 [271] 103425 70344 43410 104838 62215 69304 53117 19764 86680 84105 [281] 77945 89113 91005 40248 64187 50857 56613 62792 72535 > 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]) 7176 7199 14688 17547 19349 19764 21054 22648 22938 24188 27634 1 1 1 1 1 1 1 1 1 1 1 30837 30989 31414 31706 31774 33170 34662 37460 38214 38395 40151 1 1 1 1 1 1 1 1 1 1 1 40248 41566 43287 43410 44296 46455 46660 46698 49289 49862 50090 1 1 1 1 1 1 1 1 1 1 1 50857 51567 52164 52746 52915 53117 53515 54157 56375 56613 56653 1 1 1 1 1 1 1 1 1 1 1 58981 59194 59382 60812 61254 61361 61857 62088 62215 62792 63123 1 1 1 1 1 1 1 1 1 1 1 64175 64187 65029 65475 65490 65745 67989 69304 70344 70551 71965 1 1 1 1 1 1 1 1 1 1 1 72535 72880 73504 73566 73624 74408 74914 76302 76702 76990 77272 1 1 1 1 1 1 1 1 1 1 1 77648 77945 78800 79619 79863 80949 80953 81240 81437 81872 82316 1 1 1 1 1 1 1 1 1 1 1 84105 84207 84337 84853 84856 85439 85574 85709 86230 86678 86680 1 1 1 1 1 1 1 1 1 1 1 87186 89113 89746 89806 91005 91735 91899 92499 92630 92661 95227 1 1 1 1 1 1 1 1 1 1 1 96560 97839 98104 98146 98866 99373 99466 99611 99643 99923 100750 1 1 1 1 1 1 1 1 1 1 1 101011 101097 101523 101645 102010 102538 103425 103597 104011 104389 104838 1 1 1 1 1 1 1 1 1 1 1 106408 108043 108446 111665 112611 116048 116408 118612 119016 119308 120221 1 1 1 1 1 1 1 1 1 1 1 120445 120982 121848 122774 123185 124064 124817 125930 128423 130585 131069 1 1 1 1 1 1 1 1 1 1 1 131698 132487 132943 133131 133328 133368 134019 135131 135458 135473 135649 1 1 1 1 1 1 1 1 1 1 1 135781 136084 139526 139942 140344 141722 143246 143756 144966 145790 148446 1 1 1 1 1 1 1 1 1 1 1 149061 149112 150580 150629 151101 152299 152474 152601 152871 153935 155754 1 1 1 1 1 1 1 1 1 1 1 158015 158399 162765 164709 165446 165543 167488 167542 168809 170266 172494 1 1 1 1 1 1 1 1 1 1 1 173260 173326 174184 174415 174724 175824 176508 177939 179321 180083 181528 1 1 1 1 1 1 1 1 1 1 1 181633 182079 182192 182613 182999 183167 184510 187559 187681 193339 194979 1 1 1 1 1 1 1 1 1 1 1 195838 196553 199476 201940 202925 204271 204713 206161 207176 209641 210767 1 1 1 1 1 1 1 1 1 1 1 210907 215147 215641 218946 220516 220801 221698 223632 224330 224549 225060 1 1 1 1 1 1 1 1 1 1 1 225548 229242 230964 232138 232317 233328 235454 235800 236785 237213 241066 1 1 1 1 1 1 1 1 1 1 1 243060 243199 243511 244052 244749 250047 250579 254488 256462 258873 260561 1 1 1 1 1 1 1 1 1 1 1 265318 265769 269651 271856 272458 275541 277965 286468 294424 299775 310839 1 1 1 1 1 1 1 1 1 1 1 311473 317394 324598 324799 325107 328107 329267 341570 344297 346485 351067 1 1 1 1 1 1 1 1 1 1 1 351619 362301 385534 1 1 1 > colnames(x) [1] "time_in_rfc" "pageviews" [3] "compendiums_reviewed" "feedback_messages_p120." > colnames(x)[par1] [1] "time_in_rfc" > x[,par1] [1] 210907 120982 176508 179321 123185 52746 385534 33170 101645 149061 [11] 165446 237213 173326 133131 258873 180083 324799 230964 236785 135473 [21] 202925 215147 344297 153935 132943 174724 174415 225548 223632 124817 [31] 221698 210767 170266 260561 84853 294424 101011 215641 325107 7176 [41] 167542 106408 96560 265769 269651 149112 175824 152871 111665 116408 [51] 362301 78800 183167 277965 150629 168809 24188 329267 65029 101097 [61] 218946 244052 341570 103597 233328 256462 206161 311473 235800 177939 [71] 207176 196553 174184 143246 187559 187681 119016 182192 73566 194979 [81] 167488 143756 275541 243199 182999 135649 152299 120221 346485 145790 [91] 193339 80953 122774 130585 112611 286468 241066 148446 204713 182079 [101] 140344 220516 243060 162765 182613 232138 265318 85574 310839 225060 [111] 232317 144966 43287 155754 164709 201940 235454 220801 99466 92661 [121] 133328 61361 125930 100750 224549 82316 102010 101523 243511 22938 [131] 41566 152474 61857 99923 132487 317394 21054 209641 22648 31414 [141] 46698 131698 91735 244749 184510 79863 128423 97839 38214 151101 [151] 272458 172494 108043 328107 250579 351067 158015 98866 85439 229242 [161] 351619 84207 120445 324598 131069 204271 165543 141722 116048 250047 [171] 299775 195838 173260 254488 104389 136084 199476 92499 224330 135781 [181] 74408 81240 14688 181633 271856 7199 46660 17547 133368 95227 [191] 152601 98146 79619 59194 139942 118612 72880 65475 99643 71965 [201] 77272 49289 135131 108446 89746 44296 77648 181528 134019 124064 [211] 92630 121848 52915 81872 58981 53515 60812 56375 65490 80949 [221] 76302 104011 98104 67989 30989 135458 73504 63123 61254 74914 [231] 31774 81437 87186 50090 65745 56653 158399 46455 73624 38395 [241] 91899 139526 52164 51567 70551 84856 102538 86678 85709 34662 [251] 150580 99611 19349 99373 86230 30837 31706 89806 62088 40151 [261] 27634 76990 37460 54157 49862 84337 64175 59382 119308 76702 [271] 103425 70344 43410 104838 62215 69304 53117 19764 86680 84105 [281] 77945 89113 91005 40248 64187 50857 56613 62792 72535 > 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/1l3po1324668091.tab") + } + } > m Conditional inference tree with 11 terminal nodes Response: time_in_rfc Inputs: pageviews, compendiums_reviewed, feedback_messages_p120. Number of observations: 289 1) pageviews <= 1613; criterion = 1, statistic = 229.566 2) pageviews <= 1212; criterion = 1, statistic = 126.863 3) pageviews <= 800; criterion = 1, statistic = 72.955 4) pageviews <= 578; criterion = 1, statistic = 31.889 5) pageviews <= 391; criterion = 0.999, statistic = 13.203 6)* weights = 10 5) pageviews > 391 7)* weights = 15 4) pageviews > 578 8)* weights = 36 3) pageviews > 800 9) feedback_messages_p120. <= 78; criterion = 1, statistic = 21.715 10)* weights = 55 9) feedback_messages_p120. > 78 11)* weights = 9 2) pageviews > 1212 12) compendiums_reviewed <= 24; criterion = 1, statistic = 20.512 13)* weights = 31 12) compendiums_reviewed > 24 14)* weights = 39 1) pageviews > 1613 15) pageviews <= 2702; criterion = 1, statistic = 42.52 16) feedback_messages_p120. <= 80; criterion = 1, statistic = 22.554 17)* weights = 23 16) feedback_messages_p120. > 80 18) pageviews <= 2201; criterion = 0.963, statistic = 6.226 19)* weights = 39 18) pageviews > 2201 20)* weights = 16 15) pageviews > 2702 21)* weights = 16 > postscript(file="/var/wessaorg/rcomp/tmp/26lf21324668091.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/3e0h81324668091.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 210907 158293.33 52613.6667 2 120982 123920.89 -2938.8889 3 176508 158293.33 18214.6667 4 179321 218884.28 -39563.2821 5 123185 86052.05 37132.9455 6 52746 39424.13 13321.8667 7 385534 321098.06 64435.9375 8 33170 19387.40 13782.6000 9 101645 86052.05 15592.9455 10 149061 158293.33 -9232.3333 11 165446 158293.33 7152.6667 12 237213 218884.28 18328.7179 13 173326 158293.33 15032.6667 14 133131 158293.33 -25162.3333 15 258873 218884.28 39988.7179 16 180083 158293.33 21789.6667 17 324799 321098.06 3700.9375 18 230964 218884.28 12079.7179 19 236785 161644.48 75140.5217 20 135473 86052.05 49420.9455 21 202925 218884.28 -15959.2821 22 215147 218884.28 -3737.2821 23 344297 253526.12 90770.8750 24 153935 158293.33 -4358.3333 25 132943 158293.33 -25350.3333 26 174724 253526.12 -78802.1250 27 174415 218884.28 -44469.2821 28 225548 253526.12 -27978.1250 29 223632 218884.28 4747.7179 30 124817 158293.33 -33476.3333 31 221698 218884.28 2813.7179 32 210767 218884.28 -8117.2821 33 170266 158293.33 11972.6667 34 260561 218884.28 41676.7179 35 84853 123920.89 -39067.8889 36 294424 253526.12 40897.8750 37 101011 86052.05 14958.9455 38 215641 218884.28 -3243.2821 39 325107 253526.12 71580.8750 40 7176 19387.40 -12211.4000 41 167542 158293.33 9248.6667 42 106408 86052.05 20355.9455 43 96560 161644.48 -65084.4783 44 265769 253526.12 12242.8750 45 269651 321098.06 -51447.0625 46 149112 158293.33 -9181.3333 47 175824 161644.48 14179.5217 48 152871 158293.33 -5422.3333 49 111665 123920.89 -12255.8889 50 116408 161644.48 -45236.4783 51 362301 321098.06 41202.9375 52 78800 86052.05 -7252.0545 53 183167 218884.28 -35717.2821 54 277965 321098.06 -43133.0625 55 150629 218884.28 -68255.2821 56 168809 158293.33 10515.6667 57 24188 39424.13 -15236.1333 58 329267 253526.12 75740.8750 59 65029 60147.00 4882.0000 60 101097 86052.05 15044.9455 61 218946 253526.12 -34580.1250 62 244052 218884.28 25167.7179 63 341570 321098.06 20471.9375 64 103597 86052.05 17544.9455 65 233328 253526.12 -20198.1250 66 256462 218884.28 37577.7179 67 206161 218884.28 -12723.2821 68 311473 321098.06 -9625.0625 69 235800 161644.48 74155.5217 70 177939 161644.48 16294.5217 71 207176 218884.28 -11708.2821 72 196553 158293.33 38259.6667 73 174184 158293.33 15890.6667 74 143246 158293.33 -15047.3333 75 187559 253526.12 -65967.1250 76 187681 218884.28 -31203.2821 77 119016 112484.87 6531.1290 78 182192 218884.28 -36692.2821 79 73566 86052.05 -12486.0545 80 194979 218884.28 -23905.2821 81 167488 158293.33 9194.6667 82 143756 158293.33 -14537.3333 83 275541 218884.28 56656.7179 84 243199 218884.28 24314.7179 85 182999 158293.33 24705.6667 86 135649 158293.33 -22644.3333 87 152299 158293.33 -5994.3333 88 120221 112484.87 7736.1290 89 346485 321098.06 25386.9375 90 145790 158293.33 -12503.3333 91 193339 161644.48 31694.5217 92 80953 86052.05 -5099.0545 93 122774 161644.48 -38870.4783 94 130585 123920.89 6664.1111 95 112611 86052.05 26558.9455 96 286468 321098.06 -34630.0625 97 241066 218884.28 22181.7179 98 148446 253526.12 -105080.1250 99 204713 161644.48 43068.5217 100 182079 218884.28 -36805.2821 101 140344 158293.33 -17949.3333 102 220516 253526.12 -33010.1250 103 243060 218884.28 24175.7179 104 162765 158293.33 4471.6667 105 182613 158293.33 24319.6667 106 232138 218884.28 13253.7179 107 265318 321098.06 -55780.0625 108 85574 112484.87 -26910.8710 109 310839 321098.06 -10259.0625 110 225060 218884.28 6175.7179 111 232317 218884.28 13432.7179 112 144966 158293.33 -13327.3333 113 43287 60147.00 -16860.0000 114 155754 161644.48 -5890.4783 115 164709 158293.33 6415.6667 116 201940 218884.28 -16944.2821 117 235454 218884.28 16569.7179 118 220801 161644.48 59156.5217 119 99466 86052.05 13413.9455 120 92661 112484.87 -19823.8710 121 133328 112484.87 20843.1290 122 61361 86052.05 -24691.0545 123 125930 161644.48 -35714.4783 124 100750 158293.33 -57543.3333 125 224549 158293.33 66255.6667 126 82316 86052.05 -3736.0545 127 102010 86052.05 15957.9455 128 101523 112484.87 -10961.8710 129 243511 218884.28 24626.7179 130 22938 19387.40 3550.6000 131 41566 60147.00 -18581.0000 132 152474 158293.33 -5819.3333 133 61857 39424.13 22432.8667 134 99923 161644.48 -61721.4783 135 132487 158293.33 -25806.3333 136 317394 253526.12 63867.8750 137 21054 19387.40 1666.6000 138 209641 161644.48 47996.5217 139 22648 60147.00 -37499.0000 140 31414 39424.13 -8010.1333 141 46698 60147.00 -13449.0000 142 131698 161644.48 -29946.4783 143 91735 86052.05 5682.9455 144 244749 253526.12 -8777.1250 145 184510 158293.33 26216.6667 146 79863 112484.87 -32621.8710 147 128423 123920.89 4502.1111 148 97839 86052.05 11786.9455 149 38214 39424.13 -1210.1333 150 151101 158293.33 -7192.3333 151 272458 218884.28 53573.7179 152 172494 123920.89 48573.1111 153 108043 112484.87 -4441.8710 154 328107 321098.06 7008.9375 155 250579 218884.28 31694.7179 156 351067 321098.06 29968.9375 157 158015 123920.89 34094.1111 158 98866 86052.05 12813.9455 159 85439 86052.05 -613.0545 160 229242 218884.28 10357.7179 161 351619 321098.06 30520.9375 162 84207 123920.89 -39713.8889 163 120445 112484.87 7960.1290 164 324598 321098.06 3499.9375 165 131069 158293.33 -27224.3333 166 204271 158293.33 45977.6667 167 165543 218884.28 -53341.2821 168 141722 158293.33 -16571.3333 169 116048 86052.05 29995.9455 170 250047 161644.48 88402.5217 171 299775 321098.06 -21323.0625 172 195838 218884.28 -23046.2821 173 173260 161644.48 11615.5217 174 254488 253526.12 961.8750 175 104389 158293.33 -53904.3333 176 136084 112484.87 23599.1290 177 199476 218884.28 -19408.2821 178 92499 86052.05 6446.9455 179 224330 218884.28 5445.7179 180 135781 112484.87 23296.1290 181 74408 112484.87 -38076.8710 182 81240 112484.87 -31244.8710 183 14688 19387.40 -4699.4000 184 181633 161644.48 19988.5217 185 271856 253526.12 18329.8750 186 7199 19387.40 -12188.4000 187 46660 39424.13 7235.8667 188 17547 19387.40 -1840.4000 189 133368 161644.48 -28276.4783 190 95227 86052.05 9174.9455 191 152601 112484.87 40116.1290 192 98146 86052.05 12093.9455 193 79619 112484.87 -32865.8710 194 59194 112484.87 -53290.8710 195 139942 112484.87 27457.1290 196 118612 112484.87 6127.1290 197 72880 86052.05 -13172.0545 198 65475 60147.00 5328.0000 199 99643 112484.87 -12841.8710 200 71965 60147.00 11818.0000 201 77272 60147.00 17125.0000 202 49289 39424.13 9864.8667 203 135131 112484.87 22646.1290 204 108446 112484.87 -4038.8710 205 89746 112484.87 -22738.8710 206 44296 39424.13 4871.8667 207 77648 86052.05 -8404.0545 208 181528 112484.87 69043.1290 209 134019 112484.87 21534.1290 210 124064 123920.89 143.1111 211 92630 86052.05 6577.9455 212 121848 112484.87 9363.1290 213 52915 60147.00 -7232.0000 214 81872 60147.00 21725.0000 215 58981 86052.05 -27071.0545 216 53515 60147.00 -6632.0000 217 60812 86052.05 -25240.0545 218 56375 60147.00 -3772.0000 219 65490 60147.00 5343.0000 220 80949 60147.00 20802.0000 221 76302 86052.05 -9750.0545 222 104011 112484.87 -8473.8710 223 98104 161644.48 -63540.4783 224 67989 60147.00 7842.0000 225 30989 19387.40 11601.6000 226 135458 161644.48 -26186.4783 227 73504 60147.00 13357.0000 228 63123 86052.05 -22929.0545 229 61254 86052.05 -24798.0545 230 74914 112484.87 -37570.8710 231 31774 60147.00 -28373.0000 232 81437 86052.05 -4615.0545 233 87186 112484.87 -25298.8710 234 50090 60147.00 -10057.0000 235 65745 86052.05 -20307.0545 236 56653 60147.00 -3494.0000 237 158399 112484.87 45914.1290 238 46455 60147.00 -13692.0000 239 73624 86052.05 -12428.0545 240 38395 60147.00 -21752.0000 241 91899 86052.05 5846.9455 242 139526 161644.48 -22118.4783 243 52164 60147.00 -7983.0000 244 51567 60147.00 -8580.0000 245 70551 86052.05 -15501.0545 246 84856 86052.05 -1196.0545 247 102538 161644.48 -59106.4783 248 86678 60147.00 26531.0000 249 85709 86052.05 -343.0545 250 34662 39424.13 -4762.1333 251 150580 112484.87 38095.1290 252 99611 86052.05 13558.9455 253 19349 19387.40 -38.4000 254 99373 86052.05 13320.9455 255 86230 86052.05 177.9455 256 30837 39424.13 -8587.1333 257 31706 39424.13 -7718.1333 258 89806 86052.05 3753.9455 259 62088 60147.00 1941.0000 260 40151 39424.13 726.8667 261 27634 39424.13 -11790.1333 262 76990 86052.05 -9062.0545 263 37460 39424.13 -1964.1333 264 54157 60147.00 -5990.0000 265 49862 60147.00 -10285.0000 266 84337 86052.05 -1715.0545 267 64175 86052.05 -21877.0545 268 59382 60147.00 -765.0000 269 119308 60147.00 59161.0000 270 76702 86052.05 -9350.0545 271 103425 112484.87 -9059.8710 272 70344 60147.00 10197.0000 273 43410 60147.00 -16737.0000 274 104838 86052.05 18785.9455 275 62215 60147.00 2068.0000 276 69304 86052.05 -16748.0545 277 53117 60147.00 -7030.0000 278 19764 19387.40 376.6000 279 86680 86052.05 627.9455 280 84105 60147.00 23958.0000 281 77945 86052.05 -8107.0545 282 89113 86052.05 3060.9455 283 91005 86052.05 4952.9455 284 40248 39424.13 823.8667 285 64187 60147.00 4040.0000 286 50857 86052.05 -35195.0545 287 56613 86052.05 -29439.0545 288 62792 60147.00 2645.0000 289 72535 86052.05 -13517.0545 > 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/4hqcp1324668091.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/5pny51324668091.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/65kb91324668091.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/7beim1324668091.tab") + } > > try(system("convert tmp/26lf21324668091.ps tmp/26lf21324668091.png",intern=TRUE)) character(0) > try(system("convert tmp/3e0h81324668091.ps tmp/3e0h81324668091.png",intern=TRUE)) character(0) > try(system("convert tmp/4hqcp1324668091.ps tmp/4hqcp1324668091.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.18 0.29 5.47