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(1418 + ,210907 + ,79 + ,30 + ,869 + ,120982 + ,58 + ,28 + ,1530 + ,176508 + ,60 + ,38 + ,2172 + ,179321 + ,108 + ,30 + ,901 + ,123185 + ,49 + ,22 + ,463 + ,52746 + ,0 + ,26 + ,3201 + ,385534 + ,121 + ,25 + ,371 + ,33170 + ,1 + ,18 + ,1192 + ,101645 + ,20 + ,11 + ,1583 + ,149061 + ,43 + ,26 + ,1439 + ,165446 + ,69 + ,25 + ,1764 + ,237213 + ,78 + ,38 + ,1495 + ,173326 + ,86 + ,44 + ,1373 + ,133131 + ,44 + ,30 + ,2187 + ,258873 + ,104 + ,40 + ,1491 + ,180083 + ,63 + ,34 + ,4041 + ,324799 + ,158 + ,47 + ,1706 + ,230964 + ,102 + ,30 + ,2152 + ,236785 + ,77 + ,31 + ,1036 + ,135473 + ,82 + ,23 + ,1882 + ,202925 + ,115 + ,36 + ,1929 + ,215147 + ,101 + ,36 + ,2242 + ,344297 + ,80 + ,30 + ,1220 + ,153935 + ,50 + ,25 + ,1289 + ,132943 + ,83 + ,39 + ,2515 + ,174724 + ,123 + ,34 + ,2147 + ,174415 + ,73 + ,31 + ,2352 + ,225548 + ,81 + ,31 + ,1638 + ,223632 + ,105 + ,33 + ,1222 + ,124817 + ,47 + ,25 + ,1812 + ,221698 + ,105 + ,33 + ,1677 + ,210767 + ,94 + ,35 + ,1579 + ,170266 + ,44 + ,42 + ,1731 + ,260561 + ,114 + ,43 + ,807 + ,84853 + ,38 + ,30 + ,2452 + ,294424 + ,107 + ,33 + ,829 + ,101011 + ,30 + ,13 + ,1940 + ,215641 + ,71 + ,32 + ,2662 + ,325107 + ,84 + ,36 + ,186 + ,7176 + ,0 + ,0 + ,1499 + ,167542 + ,59 + ,28 + ,865 + ,106408 + ,33 + ,14 + ,1793 + ,96560 + ,42 + ,17 + ,2527 + ,265769 + ,96 + ,32 + ,2747 + ,269651 + ,106 + ,30 + ,1324 + ,149112 + ,56 + ,35 + ,2702 + ,175824 + ,57 + ,20 + ,1383 + ,152871 + ,59 + ,28 + ,1179 + ,111665 + ,39 + ,28 + ,2099 + ,116408 + ,34 + ,39 + ,4308 + ,362301 + ,76 + ,34 + ,918 + ,78800 + ,20 + ,26 + ,1831 + ,183167 + ,91 + ,39 + ,3373 + ,277965 + ,115 + ,39 + ,1713 + ,150629 + ,85 + ,33 + ,1438 + ,168809 + ,76 + ,28 + ,496 + ,24188 + ,8 + ,4 + ,2253 + ,329267 + ,79 + ,39 + ,744 + ,65029 + ,21 + ,18 + ,1161 + ,101097 + ,30 + ,14 + ,2352 + ,218946 + ,76 + ,29 + ,2144 + ,244052 + ,101 + ,44 + ,4691 + ,341570 + ,94 + ,21 + ,1112 + ,103597 + ,27 + ,16 + ,2694 + ,233328 + ,92 + ,28 + ,1973 + ,256462 + ,123 + ,35 + ,1769 + ,206161 + ,75 + ,28 + ,3148 + ,311473 + ,128 + ,38 + ,2474 + ,235800 + ,105 + ,23 + ,2084 + ,177939 + ,55 + ,36 + ,1954 + ,207176 + ,56 + ,32 + ,1226 + ,196553 + ,41 + ,29 + ,1389 + ,174184 + ,72 + ,25 + ,1496 + ,143246 + ,67 + ,27 + ,2269 + ,187559 + ,75 + ,36 + ,1833 + ,187681 + ,114 + ,28 + ,1268 + ,119016 + ,118 + ,23 + ,1943 + ,182192 + ,77 + ,40 + ,893 + ,73566 + ,22 + ,23 + ,1762 + ,194979 + ,66 + ,40 + ,1403 + ,167488 + ,69 + ,28 + ,1425 + ,143756 + ,105 + ,34 + ,1857 + ,275541 + ,116 + ,33 + ,1840 + ,243199 + ,88 + ,28 + ,1502 + ,182999 + ,73 + ,34 + ,1441 + ,135649 + ,99 + ,30 + ,1420 + ,152299 + ,62 + ,33 + ,1416 + ,120221 + ,53 + ,22 + ,2970 + ,346485 + ,118 + ,38 + ,1317 + ,145790 + ,30 + ,26 + ,1644 + ,193339 + ,100 + ,35 + ,870 + ,80953 + ,49 + ,8 + ,1654 + ,122774 + ,24 + ,24 + ,1054 + ,130585 + ,67 + ,29 + ,937 + ,112611 + ,46 + ,20 + ,3004 + ,286468 + ,57 + ,29 + ,2008 + ,241066 + ,75 + ,45 + ,2547 + ,148446 + ,135 + ,37 + ,1885 + ,204713 + ,68 + ,33 + ,1626 + ,182079 + ,124 + ,33 + ,1468 + ,140344 + ,33 + ,25 + ,2445 + ,220516 + ,98 + ,32 + ,1964 + ,243060 + ,58 + ,29 + ,1381 + ,162765 + ,68 + ,28 + ,1369 + ,182613 + ,81 + ,28 + ,1659 + ,232138 + ,131 + ,31 + ,2888 + ,265318 + ,110 + ,52 + ,1290 + ,85574 + ,37 + ,21 + ,2845 + ,310839 + ,130 + ,24 + ,1982 + ,225060 + ,93 + ,41 + ,1904 + ,232317 + ,118 + ,33 + ,1391 + ,144966 + ,39 + ,32 + ,602 + ,43287 + ,13 + ,19 + ,1743 + ,155754 + ,74 + ,20 + ,1559 + ,164709 + ,81 + ,31 + ,2014 + ,201940 + ,109 + ,31 + ,2143 + ,235454 + ,151 + ,32 + ,2146 + ,220801 + ,51 + ,18 + ,874 + ,99466 + ,28 + ,23 + ,1590 + ,92661 + ,40 + ,17 + ,1590 + ,133328 + ,56 + ,20 + ,1210 + ,61361 + ,27 + ,12 + ,2072 + ,125930 + ,37 + ,17 + ,1281 + ,100750 + ,83 + ,30 + ,1401 + ,224549 + ,54 + ,31 + ,834 + ,82316 + ,27 + ,10 + ,1105 + ,102010 + ,28 + ,13 + ,1272 + ,101523 + ,59 + ,22 + ,1944 + ,243511 + ,133 + ,42 + ,391 + ,22938 + ,12 + ,1 + ,761 + ,41566 + ,0 + ,9 + ,1605 + ,152474 + ,106 + ,32 + ,530 + ,61857 + ,23 + ,11 + ,1988 + ,99923 + ,44 + ,25 + ,1386 + ,132487 + ,71 + ,36 + ,2395 + ,317394 + ,116 + ,31 + ,387 + ,21054 + ,4 + ,0 + ,1742 + ,209641 + ,62 + ,24 + ,620 + ,22648 + ,12 + ,13 + ,449 + ,31414 + ,18 + ,8 + ,800 + ,46698 + ,14 + ,13 + ,1684 + ,131698 + ,60 + ,19 + ,1050 + ,91735 + ,7 + ,18 + ,2699 + ,244749 + ,98 + ,33 + ,1606 + ,184510 + ,64 + ,40 + ,1502 + ,79863 + ,29 + ,22 + ,1204 + ,128423 + ,32 + ,38 + ,1138 + ,97839 + ,25 + ,24 + ,568 + ,38214 + ,16 + ,8 + ,1459 + ,151101 + ,48 + ,35 + ,2158 + ,272458 + ,100 + ,43 + ,1111 + ,172494 + ,46 + ,43 + ,1421 + ,108043 + ,45 + ,14 + ,2833 + ,328107 + ,129 + ,41 + ,1955 + ,250579 + ,130 + ,38 + ,2922 + ,351067 + ,136 + ,45 + ,1002 + ,158015 + ,59 + ,31 + ,1060 + ,98866 + ,25 + ,13 + ,956 + ,85439 + ,32 + ,28 + ,2186 + ,229242 + ,63 + ,31 + ,3604 + ,351619 + ,95 + ,40 + ,1035 + ,84207 + ,14 + ,30 + ,1417 + ,120445 + ,36 + ,16 + ,3261 + ,324598 + ,113 + ,37 + ,1587 + ,131069 + ,47 + ,30 + ,1424 + ,204271 + ,92 + ,35 + ,1701 + ,165543 + ,70 + ,32 + ,1249 + ,141722 + ,19 + ,27 + ,946 + ,116048 + ,50 + ,20 + ,1926 + ,250047 + ,41 + ,18 + ,3352 + ,299775 + ,91 + ,31 + ,1641 + ,195838 + ,111 + ,31 + ,2035 + ,173260 + ,41 + ,21 + ,2312 + ,254488 + ,120 + ,39 + ,1369 + ,104389 + ,135 + ,41 + ,1577 + ,136084 + ,27 + ,13 + ,2201 + ,199476 + ,87 + ,32 + ,961 + ,92499 + ,25 + ,18 + ,1900 + ,224330 + ,131 + ,39 + ,1254 + ,135781 + ,45 + ,14 + ,1335 + ,74408 + ,29 + ,7 + ,1597 + ,81240 + ,58 + ,17 + ,207 + ,14688 + ,4 + ,0 + ,1645 + ,181633 + ,47 + ,30 + ,2429 + ,271856 + ,109 + ,37 + ,151 + ,7199 + ,7 + ,0 + ,474 + ,46660 + ,12 + ,5 + ,141 + ,17547 + ,0 + ,1 + ,1639 + ,133368 + ,37 + ,16 + ,872 + ,95227 + ,37 + ,32 + ,1318 + ,152601 + ,46 + ,24 + ,1018 + ,98146 + ,15 + ,17 + ,1383 + ,79619 + ,42 + ,11 + ,1314 + ,59194 + ,7 + ,24 + ,1335 + ,139942 + ,54 + ,22 + ,1403 + ,118612 + ,54 + ,12 + ,910 + ,72880 + ,14 + ,19 + ,616 + ,65475 + ,16 + ,13 + ,1407 + ,99643 + ,33 + ,17 + ,771 + ,71965 + ,32 + ,15 + ,766 + ,77272 + ,21 + ,16 + ,473 + ,49289 + ,15 + ,24 + ,1376 + ,135131 + ,38 + ,15 + ,1232 + ,108446 + ,22 + ,17 + ,1521 + ,89746 + ,28 + ,18 + ,572 + ,44296 + ,10 + ,20 + ,1059 + ,77648 + ,31 + ,16 + ,1544 + ,181528 + ,32 + ,16 + ,1230 + ,134019 + ,32 + ,18 + ,1206 + ,124064 + ,43 + ,22 + ,1205 + ,92630 + ,27 + ,8 + ,1255 + ,121848 + ,37 + ,17 + ,613 + ,52915 + ,20 + ,18 + ,721 + ,81872 + ,32 + ,16 + ,1109 + ,58981 + ,0 + ,23 + ,740 + ,53515 + ,5 + ,22 + ,1126 + ,60812 + ,26 + ,13 + ,728 + ,56375 + ,10 + ,13 + ,689 + ,65490 + ,27 + ,16 + ,592 + ,80949 + ,11 + ,16 + ,995 + ,76302 + ,29 + ,20 + ,1613 + ,104011 + ,25 + ,22 + ,2048 + ,98104 + ,55 + ,17 + ,705 + ,67989 + ,23 + ,18 + ,301 + ,30989 + ,5 + ,17 + ,1803 + ,135458 + ,43 + ,12 + ,799 + ,73504 + ,23 + ,7 + ,861 + ,63123 + ,34 + ,17 + ,1186 + ,61254 + ,36 + ,14 + ,1451 + ,74914 + ,35 + ,23 + ,628 + ,31774 + ,0 + ,17 + ,1161 + ,81437 + ,37 + ,14 + ,1463 + ,87186 + ,28 + ,15 + ,742 + ,50090 + ,16 + ,17 + ,979 + ,65745 + ,26 + ,21 + ,675 + ,56653 + ,38 + ,18 + ,1241 + ,158399 + ,23 + ,18 + ,676 + ,46455 + ,22 + ,17 + ,1049 + ,73624 + ,30 + ,17 + ,620 + ,38395 + ,16 + ,16 + ,1081 + ,91899 + ,18 + ,15 + ,1688 + ,139526 + ,28 + ,21 + ,736 + ,52164 + ,32 + ,16 + ,617 + ,51567 + ,21 + ,14 + ,812 + ,70551 + ,23 + ,15 + ,1051 + ,84856 + ,29 + ,17 + ,1656 + ,102538 + ,50 + ,15 + ,705 + ,86678 + ,12 + ,15 + ,945 + ,85709 + ,21 + ,10 + ,554 + ,34662 + ,18 + ,6 + ,1597 + ,150580 + ,27 + ,22 + ,982 + ,99611 + ,41 + ,21 + ,222 + ,19349 + ,13 + ,1 + ,1212 + ,99373 + ,12 + ,18 + ,1143 + ,86230 + ,21 + ,17 + ,435 + ,30837 + ,8 + ,4 + ,532 + ,31706 + ,26 + ,10 + ,882 + ,89806 + ,27 + ,16 + ,608 + ,62088 + ,13 + ,16 + ,459 + ,40151 + ,16 + ,9 + ,578 + ,27634 + ,2 + ,16 + ,826 + ,76990 + ,42 + ,17 + ,509 + ,37460 + ,5 + ,7 + ,717 + ,54157 + ,37 + ,15 + ,637 + ,49862 + ,17 + ,14 + ,857 + ,84337 + ,38 + ,14 + ,830 + ,64175 + ,37 + ,18 + ,652 + ,59382 + ,29 + ,12 + ,707 + ,119308 + ,32 + ,16 + ,954 + ,76702 + ,35 + ,21 + ,1461 + ,103425 + ,17 + ,19 + ,672 + ,70344 + ,20 + ,16 + ,778 + ,43410 + ,7 + ,1 + ,1141 + ,104838 + ,46 + ,16 + ,680 + ,62215 + ,24 + ,10 + ,1090 + ,69304 + ,40 + ,19 + ,616 + ,53117 + ,3 + ,12 + ,285 + ,19764 + ,10 + ,2 + ,1145 + ,86680 + ,37 + ,14 + ,733 + ,84105 + ,17 + ,17 + ,888 + ,77945 + ,28 + ,19 + ,849 + ,89113 + ,19 + ,14 + ,1182 + ,91005 + ,29 + ,11 + ,528 + ,40248 + ,8 + ,4 + ,642 + ,64187 + ,10 + ,16 + ,947 + ,50857 + ,15 + ,20 + ,819 + ,56613 + ,15 + ,12 + ,757 + ,62792 + ,28 + ,15 + ,894 + ,72535 + ,17 + ,16) + ,dim=c(4 + ,289) + ,dimnames=list(c('pageviews' + ,'time_in_rfc' + ,'blogged_computations' + ,'compendiums_reviewed') + ,1:289)) > y <- array(NA,dim=c(4,289),dimnames=list(c('pageviews','time_in_rfc','blogged_computations','compendiums_reviewed'),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] "pageviews" > x[,par1] [1] 1418 869 1530 2172 901 463 3201 371 1192 1583 1439 1764 1495 1373 2187 [16] 1491 4041 1706 2152 1036 1882 1929 2242 1220 1289 2515 2147 2352 1638 1222 [31] 1812 1677 1579 1731 807 2452 829 1940 2662 186 1499 865 1793 2527 2747 [46] 1324 2702 1383 1179 2099 4308 918 1831 3373 1713 1438 496 2253 744 1161 [61] 2352 2144 4691 1112 2694 1973 1769 3148 2474 2084 1954 1226 1389 1496 2269 [76] 1833 1268 1943 893 1762 1403 1425 1857 1840 1502 1441 1420 1416 2970 1317 [91] 1644 870 1654 1054 937 3004 2008 2547 1885 1626 1468 2445 1964 1381 1369 [106] 1659 2888 1290 2845 1982 1904 1391 602 1743 1559 2014 2143 2146 874 1590 [121] 1590 1210 2072 1281 1401 834 1105 1272 1944 391 761 1605 530 1988 1386 [136] 2395 387 1742 620 449 800 1684 1050 2699 1606 1502 1204 1138 568 1459 [151] 2158 1111 1421 2833 1955 2922 1002 1060 956 2186 3604 1035 1417 3261 1587 [166] 1424 1701 1249 946 1926 3352 1641 2035 2312 1369 1577 2201 961 1900 1254 [181] 1335 1597 207 1645 2429 151 474 141 1639 872 1318 1018 1383 1314 1335 [196] 1403 910 616 1407 771 766 473 1376 1232 1521 572 1059 1544 1230 1206 [211] 1205 1255 613 721 1109 740 1126 728 689 592 995 1613 2048 705 301 [226] 1803 799 861 1186 1451 628 1161 1463 742 979 675 1241 676 1049 620 [241] 1081 1688 736 617 812 1051 1656 705 945 554 1597 982 222 1212 1143 [256] 435 532 882 608 459 578 826 509 717 637 857 830 652 707 954 [271] 1461 672 778 1141 680 1090 616 285 1145 733 888 849 1182 528 642 [286] 947 819 757 894 > 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]) 141 151 186 207 222 285 301 371 387 391 435 449 459 463 473 474 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 496 509 528 530 532 554 568 572 578 592 602 608 613 616 617 620 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 628 637 642 652 672 675 676 680 689 705 707 717 721 728 733 736 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 740 742 744 757 761 766 771 778 799 800 807 812 819 826 829 830 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 834 849 857 861 865 869 870 872 874 882 888 893 894 901 910 918 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 937 945 946 947 954 956 961 979 982 995 1002 1018 1035 1036 1049 1050 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1051 1054 1059 1060 1081 1090 1105 1109 1111 1112 1126 1138 1141 1143 1145 1161 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1179 1182 1186 1192 1204 1205 1206 1210 1212 1220 1222 1226 1230 1232 1241 1249 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1254 1255 1268 1272 1281 1289 1290 1314 1317 1318 1324 1335 1369 1373 1376 1381 1 1 1 1 1 1 1 1 1 1 1 2 2 1 1 1 1383 1386 1389 1391 1401 1403 1407 1416 1417 1418 1420 1421 1424 1425 1438 1439 2 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1441 1451 1459 1461 1463 1468 1491 1495 1496 1499 1502 1521 1530 1544 1559 1577 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1579 1583 1587 1590 1597 1605 1606 1613 1626 1638 1639 1641 1644 1645 1654 1656 1 1 1 2 2 1 1 1 1 1 1 1 1 1 1 1 1659 1677 1684 1688 1701 1706 1713 1731 1742 1743 1762 1764 1769 1793 1803 1812 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1831 1833 1840 1857 1882 1885 1900 1904 1926 1929 1940 1943 1944 1954 1955 1964 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1973 1982 1988 2008 2014 2035 2048 2072 2084 2099 2143 2144 2146 2147 2152 2158 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2172 2186 2187 2201 2242 2253 2269 2312 2352 2395 2429 2445 2452 2474 2515 2527 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 2547 2662 2694 2699 2702 2747 2833 2845 2888 2922 2970 3004 3148 3201 3261 3352 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3373 3604 4041 4308 4691 1 1 1 1 1 > colnames(x) [1] "pageviews" "time_in_rfc" "blogged_computations" [4] "compendiums_reviewed" > colnames(x)[par1] [1] "pageviews" > x[,par1] [1] 1418 869 1530 2172 901 463 3201 371 1192 1583 1439 1764 1495 1373 2187 [16] 1491 4041 1706 2152 1036 1882 1929 2242 1220 1289 2515 2147 2352 1638 1222 [31] 1812 1677 1579 1731 807 2452 829 1940 2662 186 1499 865 1793 2527 2747 [46] 1324 2702 1383 1179 2099 4308 918 1831 3373 1713 1438 496 2253 744 1161 [61] 2352 2144 4691 1112 2694 1973 1769 3148 2474 2084 1954 1226 1389 1496 2269 [76] 1833 1268 1943 893 1762 1403 1425 1857 1840 1502 1441 1420 1416 2970 1317 [91] 1644 870 1654 1054 937 3004 2008 2547 1885 1626 1468 2445 1964 1381 1369 [106] 1659 2888 1290 2845 1982 1904 1391 602 1743 1559 2014 2143 2146 874 1590 [121] 1590 1210 2072 1281 1401 834 1105 1272 1944 391 761 1605 530 1988 1386 [136] 2395 387 1742 620 449 800 1684 1050 2699 1606 1502 1204 1138 568 1459 [151] 2158 1111 1421 2833 1955 2922 1002 1060 956 2186 3604 1035 1417 3261 1587 [166] 1424 1701 1249 946 1926 3352 1641 2035 2312 1369 1577 2201 961 1900 1254 [181] 1335 1597 207 1645 2429 151 474 141 1639 872 1318 1018 1383 1314 1335 [196] 1403 910 616 1407 771 766 473 1376 1232 1521 572 1059 1544 1230 1206 [211] 1205 1255 613 721 1109 740 1126 728 689 592 995 1613 2048 705 301 [226] 1803 799 861 1186 1451 628 1161 1463 742 979 675 1241 676 1049 620 [241] 1081 1688 736 617 812 1051 1656 705 945 554 1597 982 222 1212 1143 [256] 435 532 882 608 459 578 826 509 717 637 857 830 652 707 954 [271] 1461 672 778 1141 680 1090 616 285 1145 733 888 849 1182 528 642 [286] 947 819 757 894 > 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/1ahsv1324677854.tab") + } + } > m Conditional inference tree with 9 terminal nodes Response: pageviews Inputs: time_in_rfc, blogged_computations, compendiums_reviewed Number of observations: 289 1) time_in_rfc <= 172494; criterion = 1, statistic = 229.566 2) time_in_rfc <= 73566; criterion = 1, statistic = 119.407 3) time_in_rfc <= 40248; criterion = 1, statistic = 38.822 4) time_in_rfc <= 21054; criterion = 0.999, statistic = 12.464 5)* weights = 7 4) time_in_rfc > 21054 6)* weights = 16 3) time_in_rfc > 40248 7)* weights = 47 2) time_in_rfc > 73566 8) time_in_rfc <= 92630; criterion = 1, statistic = 26.826 9)* weights = 38 8) time_in_rfc > 92630 10) blogged_computations <= 33; criterion = 0.969, statistic = 6.534 11)* weights = 26 10) blogged_computations > 33 12)* weights = 64 1) time_in_rfc > 172494 13) time_in_rfc <= 275541; criterion = 1, statistic = 49.714 14) time_in_rfc <= 232317; criterion = 0.999, statistic = 12.325 15)* weights = 49 14) time_in_rfc > 232317 16)* weights = 23 13) time_in_rfc > 275541 17)* weights = 19 > postscript(file="/var/wessaorg/rcomp/tmp/2p92h1324677854.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/3rdc31324677854.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 1418 1843.2449 -425.2448980 2 869 1424.8281 -555.8281250 3 1530 1843.2449 -313.2448980 4 2172 1843.2449 328.7551020 5 901 1424.8281 -523.8281250 6 463 771.5957 -308.5957447 7 3201 3134.5789 66.4210526 8 371 502.4375 -131.4375000 9 1192 1238.8846 -46.8846154 10 1583 1424.8281 158.1718750 11 1439 1424.8281 14.1718750 12 1764 2196.3478 -432.3478261 13 1495 1843.2449 -348.2448980 14 1373 1424.8281 -51.8281250 15 2187 2196.3478 -9.3478261 16 1491 1843.2449 -352.2448980 17 4041 3134.5789 906.4210526 18 1706 1843.2449 -137.2448980 19 2152 2196.3478 -44.3478261 20 1036 1424.8281 -388.8281250 21 1882 1843.2449 38.7551020 22 1929 1843.2449 85.7551020 23 2242 3134.5789 -892.5789474 24 1220 1424.8281 -204.8281250 25 1289 1424.8281 -135.8281250 26 2515 1843.2449 671.7551020 27 2147 1843.2449 303.7551020 28 2352 1843.2449 508.7551020 29 1638 1843.2449 -205.2448980 30 1222 1424.8281 -202.8281250 31 1812 1843.2449 -31.2448980 32 1677 1843.2449 -166.2448980 33 1579 1424.8281 154.1718750 34 1731 2196.3478 -465.3478261 35 807 1046.3684 -239.3684211 36 2452 3134.5789 -682.5789474 37 829 1238.8846 -409.8846154 38 1940 1843.2449 96.7551020 39 2662 3134.5789 -472.5789474 40 186 225.5714 -39.5714286 41 1499 1424.8281 74.1718750 42 865 1238.8846 -373.8846154 43 1793 1424.8281 368.1718750 44 2527 2196.3478 330.6521739 45 2747 2196.3478 550.6521739 46 1324 1424.8281 -100.8281250 47 2702 1843.2449 858.7551020 48 1383 1424.8281 -41.8281250 49 1179 1424.8281 -245.8281250 50 2099 1424.8281 674.1718750 51 4308 3134.5789 1173.4210526 52 918 1046.3684 -128.3684211 53 1831 1843.2449 -12.2448980 54 3373 3134.5789 238.4210526 55 1713 1424.8281 288.1718750 56 1438 1424.8281 13.1718750 57 496 502.4375 -6.4375000 58 2253 3134.5789 -881.5789474 59 744 771.5957 -27.5957447 60 1161 1238.8846 -77.8846154 61 2352 1843.2449 508.7551020 62 2144 2196.3478 -52.3478261 63 4691 3134.5789 1556.4210526 64 1112 1238.8846 -126.8846154 65 2694 2196.3478 497.6521739 66 1973 2196.3478 -223.3478261 67 1769 1843.2449 -74.2448980 68 3148 3134.5789 13.4210526 69 2474 2196.3478 277.6521739 70 2084 1843.2449 240.7551020 71 1954 1843.2449 110.7551020 72 1226 1843.2449 -617.2448980 73 1389 1843.2449 -454.2448980 74 1496 1424.8281 71.1718750 75 2269 1843.2449 425.7551020 76 1833 1843.2449 -10.2448980 77 1268 1424.8281 -156.8281250 78 1943 1843.2449 99.7551020 79 893 771.5957 121.4042553 80 1762 1843.2449 -81.2448980 81 1403 1424.8281 -21.8281250 82 1425 1424.8281 0.1718750 83 1857 2196.3478 -339.3478261 84 1840 2196.3478 -356.3478261 85 1502 1843.2449 -341.2448980 86 1441 1424.8281 16.1718750 87 1420 1424.8281 -4.8281250 88 1416 1424.8281 -8.8281250 89 2970 3134.5789 -164.5789474 90 1317 1238.8846 78.1153846 91 1644 1843.2449 -199.2448980 92 870 1046.3684 -176.3684211 93 1654 1238.8846 415.1153846 94 1054 1424.8281 -370.8281250 95 937 1424.8281 -487.8281250 96 3004 3134.5789 -130.5789474 97 2008 2196.3478 -188.3478261 98 2547 1424.8281 1122.1718750 99 1885 1843.2449 41.7551020 100 1626 1843.2449 -217.2448980 101 1468 1238.8846 229.1153846 102 2445 1843.2449 601.7551020 103 1964 2196.3478 -232.3478261 104 1381 1424.8281 -43.8281250 105 1369 1843.2449 -474.2448980 106 1659 1843.2449 -184.2448980 107 2888 2196.3478 691.6521739 108 1290 1046.3684 243.6315789 109 2845 3134.5789 -289.5789474 110 1982 1843.2449 138.7551020 111 1904 1843.2449 60.7551020 112 1391 1424.8281 -33.8281250 113 602 771.5957 -169.5957447 114 1743 1424.8281 318.1718750 115 1559 1424.8281 134.1718750 116 2014 1843.2449 170.7551020 117 2143 2196.3478 -53.3478261 118 2146 1843.2449 302.7551020 119 874 1238.8846 -364.8846154 120 1590 1424.8281 165.1718750 121 1590 1424.8281 165.1718750 122 1210 771.5957 438.4042553 123 2072 1424.8281 647.1718750 124 1281 1424.8281 -143.8281250 125 1401 1843.2449 -442.2448980 126 834 1046.3684 -212.3684211 127 1105 1238.8846 -133.8846154 128 1272 1424.8281 -152.8281250 129 1944 2196.3478 -252.3478261 130 391 502.4375 -111.4375000 131 761 771.5957 -10.5957447 132 1605 1424.8281 180.1718750 133 530 771.5957 -241.5957447 134 1988 1424.8281 563.1718750 135 1386 1424.8281 -38.8281250 136 2395 3134.5789 -739.5789474 137 387 225.5714 161.4285714 138 1742 1843.2449 -101.2448980 139 620 502.4375 117.5625000 140 449 502.4375 -53.4375000 141 800 771.5957 28.4042553 142 1684 1424.8281 259.1718750 143 1050 1046.3684 3.6315789 144 2699 2196.3478 502.6521739 145 1606 1843.2449 -237.2448980 146 1502 1046.3684 455.6315789 147 1204 1238.8846 -34.8846154 148 1138 1238.8846 -100.8846154 149 568 502.4375 65.5625000 150 1459 1424.8281 34.1718750 151 2158 2196.3478 -38.3478261 152 1111 1424.8281 -313.8281250 153 1421 1424.8281 -3.8281250 154 2833 3134.5789 -301.5789474 155 1955 2196.3478 -241.3478261 156 2922 3134.5789 -212.5789474 157 1002 1424.8281 -422.8281250 158 1060 1238.8846 -178.8846154 159 956 1046.3684 -90.3684211 160 2186 1843.2449 342.7551020 161 3604 3134.5789 469.4210526 162 1035 1046.3684 -11.3684211 163 1417 1424.8281 -7.8281250 164 3261 3134.5789 126.4210526 165 1587 1424.8281 162.1718750 166 1424 1843.2449 -419.2448980 167 1701 1424.8281 276.1718750 168 1249 1238.8846 10.1153846 169 946 1424.8281 -478.8281250 170 1926 2196.3478 -270.3478261 171 3352 3134.5789 217.4210526 172 1641 1843.2449 -202.2448980 173 2035 1843.2449 191.7551020 174 2312 2196.3478 115.6521739 175 1369 1424.8281 -55.8281250 176 1577 1238.8846 338.1153846 177 2201 1843.2449 357.7551020 178 961 1046.3684 -85.3684211 179 1900 1843.2449 56.7551020 180 1254 1424.8281 -170.8281250 181 1335 1046.3684 288.6315789 182 1597 1046.3684 550.6315789 183 207 225.5714 -18.5714286 184 1645 1843.2449 -198.2448980 185 2429 2196.3478 232.6521739 186 151 225.5714 -74.5714286 187 474 771.5957 -297.5957447 188 141 225.5714 -84.5714286 189 1639 1424.8281 214.1718750 190 872 1424.8281 -552.8281250 191 1318 1424.8281 -106.8281250 192 1018 1238.8846 -220.8846154 193 1383 1046.3684 336.6315789 194 1314 771.5957 542.4042553 195 1335 1424.8281 -89.8281250 196 1403 1424.8281 -21.8281250 197 910 771.5957 138.4042553 198 616 771.5957 -155.5957447 199 1407 1238.8846 168.1153846 200 771 771.5957 -0.5957447 201 766 1046.3684 -280.3684211 202 473 771.5957 -298.5957447 203 1376 1424.8281 -48.8281250 204 1232 1238.8846 -6.8846154 205 1521 1046.3684 474.6315789 206 572 771.5957 -199.5957447 207 1059 1046.3684 12.6315789 208 1544 1843.2449 -299.2448980 209 1230 1238.8846 -8.8846154 210 1206 1424.8281 -218.8281250 211 1205 1046.3684 158.6315789 212 1255 1424.8281 -169.8281250 213 613 771.5957 -158.5957447 214 721 1046.3684 -325.3684211 215 1109 771.5957 337.4042553 216 740 771.5957 -31.5957447 217 1126 771.5957 354.4042553 218 728 771.5957 -43.5957447 219 689 771.5957 -82.5957447 220 592 1046.3684 -454.3684211 221 995 1046.3684 -51.3684211 222 1613 1238.8846 374.1153846 223 2048 1424.8281 623.1718750 224 705 771.5957 -66.5957447 225 301 502.4375 -201.4375000 226 1803 1424.8281 378.1718750 227 799 771.5957 27.4042553 228 861 771.5957 89.4042553 229 1186 771.5957 414.4042553 230 1451 1046.3684 404.6315789 231 628 502.4375 125.5625000 232 1161 1046.3684 114.6315789 233 1463 1046.3684 416.6315789 234 742 771.5957 -29.5957447 235 979 771.5957 207.4042553 236 675 771.5957 -96.5957447 237 1241 1238.8846 2.1153846 238 676 771.5957 -95.5957447 239 1049 1046.3684 2.6315789 240 620 502.4375 117.5625000 241 1081 1046.3684 34.6315789 242 1688 1238.8846 449.1153846 243 736 771.5957 -35.5957447 244 617 771.5957 -154.5957447 245 812 771.5957 40.4042553 246 1051 1046.3684 4.6315789 247 1656 1424.8281 231.1718750 248 705 1046.3684 -341.3684211 249 945 1046.3684 -101.3684211 250 554 502.4375 51.5625000 251 1597 1238.8846 358.1153846 252 982 1424.8281 -442.8281250 253 222 225.5714 -3.5714286 254 1212 1238.8846 -26.8846154 255 1143 1046.3684 96.6315789 256 435 502.4375 -67.4375000 257 532 502.4375 29.5625000 258 882 1046.3684 -164.3684211 259 608 771.5957 -163.5957447 260 459 502.4375 -43.4375000 261 578 502.4375 75.5625000 262 826 1046.3684 -220.3684211 263 509 502.4375 6.5625000 264 717 771.5957 -54.5957447 265 637 771.5957 -134.5957447 266 857 1046.3684 -189.3684211 267 830 771.5957 58.4042553 268 652 771.5957 -119.5957447 269 707 1238.8846 -531.8846154 270 954 1046.3684 -92.3684211 271 1461 1238.8846 222.1153846 272 672 771.5957 -99.5957447 273 778 771.5957 6.4042553 274 1141 1424.8281 -283.8281250 275 680 771.5957 -91.5957447 276 1090 771.5957 318.4042553 277 616 771.5957 -155.5957447 278 285 225.5714 59.4285714 279 1145 1046.3684 98.6315789 280 733 1046.3684 -313.3684211 281 888 1046.3684 -158.3684211 282 849 1046.3684 -197.3684211 283 1182 1046.3684 135.6315789 284 528 502.4375 25.5625000 285 642 771.5957 -129.5957447 286 947 771.5957 175.4042553 287 819 771.5957 47.4042553 288 757 771.5957 -14.5957447 289 894 771.5957 122.4042553 > 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/43ghd1324677854.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/54i031324677854.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/63xe41324677854.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/70z241324677854.tab") + } > > try(system("convert tmp/2p92h1324677854.ps tmp/2p92h1324677854.png",intern=TRUE)) character(0) > try(system("convert tmp/3rdc31324677854.ps tmp/3rdc31324677854.png",intern=TRUE)) character(0) > try(system("convert tmp/43ghd1324677854.ps tmp/43ghd1324677854.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.611 0.273 4.924