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(1683 + ,150596 + ,84 + ,37 + ,18 + ,63 + ,20465 + ,23975 + ,0 + ,1323 + ,154801 + ,50 + ,42 + ,20 + ,56 + ,33629 + ,85634 + ,1 + ,192 + ,7215 + ,18 + ,0 + ,0 + ,0 + ,1423 + ,1929 + ,0 + ,2172 + ,122139 + ,91 + ,49 + ,26 + ,60 + ,25629 + ,36294 + ,0 + ,3335 + ,221399 + ,129 + ,76 + ,30 + ,112 + ,54002 + ,72255 + ,0 + ,6310 + ,441870 + ,237 + ,118 + ,34 + ,130 + ,151036 + ,189748 + ,1 + ,1478 + ,134379 + ,52 + ,42 + ,23 + ,71 + ,33287 + ,61834 + ,1 + ,1324 + ,140428 + ,53 + ,57 + ,30 + ,107 + ,31172 + ,68167 + ,0 + ,1488 + ,103255 + ,40 + ,45 + ,30 + ,50 + ,28113 + ,38462 + ,0 + ,2756 + ,271630 + ,91 + ,67 + ,26 + ,79 + ,57803 + ,101219 + ,1 + ,1931 + ,121593 + ,71 + ,50 + ,24 + ,58 + ,49830 + ,43270 + ,2 + ,1966 + ,172071 + ,63 + ,71 + ,30 + ,91 + ,52143 + ,76183 + ,0 + ,1575 + ,83707 + ,94 + ,41 + ,19 + ,36 + ,21055 + ,31476 + ,0 + ,2855 + ,197412 + ,98 + ,66 + ,25 + ,91 + ,47007 + ,62157 + ,4 + ,1263 + ,134398 + ,48 + ,42 + ,17 + ,58 + ,28735 + ,46261 + ,4 + ,1479 + ,139224 + ,73 + ,54 + ,19 + ,65 + ,59147 + ,50063 + ,3 + ,1636 + ,134153 + ,52 + ,75 + ,33 + ,131 + ,78950 + ,64483 + ,0 + ,1076 + ,64149 + ,52 + ,0 + ,15 + ,45 + ,13497 + ,2341 + ,5 + ,2376 + ,122294 + ,82 + ,54 + ,34 + ,110 + ,46154 + ,48149 + ,0 + ,678 + ,24889 + ,22 + ,13 + ,15 + ,33 + ,53249 + ,12743 + ,0 + ,902 + ,52197 + ,52 + ,16 + ,15 + ,37 + ,10726 + ,18743 + ,0 + ,2308 + ,188915 + ,89 + ,77 + ,27 + ,78 + ,83700 + ,97057 + ,0 + ,1590 + ,163147 + ,66 + ,34 + ,25 + ,67 + ,40400 + ,17675 + ,0 + ,1863 + ,98575 + ,48 + ,38 + ,34 + ,69 + ,33797 + ,33106 + ,1 + ,1799 + ,143546 + ,80 + ,50 + ,21 + ,58 + ,36205 + ,53311 + ,1 + ,1385 + ,139780 + ,25 + ,39 + ,21 + ,60 + ,30165 + ,42754 + ,0 + ,1870 + ,163784 + ,146 + ,54 + ,25 + ,88 + ,58534 + ,59056 + ,0 + ,1161 + ,152479 + ,75 + ,67 + ,28 + ,71 + ,44663 + ,101621 + ,0 + ,2417 + ,304108 + ,109 + ,55 + ,26 + ,85 + ,92556 + ,118120 + ,0 + ,1952 + ,184024 + ,40 + ,52 + ,20 + ,67 + ,40078 + ,79572 + ,0 + ,1514 + ,151621 + ,41 + ,50 + ,28 + ,84 + ,34711 + ,42744 + ,0 + ,1487 + ,164516 + ,41 + ,54 + ,20 + ,58 + ,31076 + ,65931 + ,2 + ,2051 + ,120179 + ,94 + ,53 + ,17 + ,35 + ,74608 + ,38575 + ,4 + ,2843 + ,214701 + ,116 + ,76 + ,25 + ,74 + ,58092 + ,28795 + ,0 + ,2216 + ,196865 + ,48 + ,52 + ,24 + ,89 + ,42009 + ,94440 + ,1 + ,1 + ,0 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1830 + ,181527 + ,57 + ,46 + ,27 + ,75 + ,36022 + ,38229 + ,0 + ,1563 + ,93107 + ,49 + ,44 + ,14 + ,39 + ,23333 + ,31972 + ,3 + ,2046 + ,129352 + ,45 + ,35 + ,32 + ,93 + ,53349 + ,40071 + ,9 + ,2005 + ,229143 + ,58 + ,82 + ,31 + ,123 + ,92596 + ,132480 + ,0 + ,1934 + ,177063 + ,67 + ,70 + ,21 + ,73 + ,49598 + ,62797 + ,2 + ,1572 + ,126602 + ,53 + ,31 + ,34 + ,118 + ,44093 + ,40429 + ,0 + ,950 + ,93742 + ,29 + ,25 + ,23 + ,76 + ,84205 + ,45545 + ,2 + ,1877 + ,152153 + ,72 + ,48 + ,24 + ,65 + ,63369 + ,57568 + ,1 + ,1036 + ,95704 + ,42 + ,44 + ,22 + ,82 + ,60132 + ,39019 + ,2 + ,1097 + ,139793 + ,84 + ,40 + ,22 + ,67 + ,37403 + ,53866 + ,2 + ,730 + ,76348 + ,30 + ,23 + ,35 + ,63 + ,24460 + ,38345 + ,1 + ,1918 + ,188980 + ,86 + ,63 + ,21 + ,84 + ,46456 + ,50210 + ,0 + ,1826 + ,172100 + ,79 + ,43 + ,31 + ,112 + ,66616 + ,80947 + ,1 + ,2444 + ,146552 + ,54 + ,62 + ,26 + ,75 + ,41554 + ,43461 + ,7 + ,658 + ,48188 + ,28 + ,12 + ,22 + ,39 + ,22346 + ,14812 + ,0 + ,1425 + ,109185 + ,60 + ,63 + ,21 + ,63 + ,30874 + ,37819 + ,0 + ,2246 + ,263652 + ,68 + ,60 + ,27 + ,93 + ,68701 + ,102738 + ,0 + ,1899 + ,215609 + ,75 + ,53 + ,26 + ,69 + ,35728 + ,54509 + ,0 + ,1630 + ,174876 + ,54 + ,53 + ,33 + ,117 + ,29010 + ,62956 + ,1 + ,1496 + ,115124 + ,49 + ,35 + ,11 + ,30 + ,23110 + ,55411 + ,6 + ,1681 + ,179712 + ,60 + ,49 + ,26 + ,65 + ,38844 + ,50611 + ,0 + ,816 + ,70369 + ,20 + ,25 + ,26 + ,78 + ,27084 + ,26692 + ,0 + ,902 + ,109215 + ,58 + ,47 + ,21 + ,80 + ,35139 + ,60056 + ,0 + ,2606 + ,166096 + ,85 + ,30 + ,38 + ,85 + ,57476 + ,25155 + ,10 + ,1557 + ,130414 + ,51 + ,50 + ,29 + ,107 + ,33277 + ,42840 + ,6 + ,1780 + ,102057 + ,71 + ,36 + ,19 + ,60 + ,31141 + ,39358 + ,0 + ,1265 + ,115310 + ,56 + ,43 + ,19 + ,53 + ,61281 + ,47241 + ,11 + ,1117 + ,101181 + ,32 + ,44 + ,24 + ,62 + ,25820 + ,49611 + ,3 + ,1069 + ,135228 + ,31 + ,14 + ,26 + ,90 + ,23284 + ,41833 + ,0 + ,1229 + ,94982 + ,37 + ,38 + ,29 + ,89 + ,35378 + ,48930 + ,0 + ,2155 + ,166919 + ,67 + ,58 + ,34 + ,127 + ,74990 + ,110600 + ,8 + ,2500 + ,118169 + ,64 + ,68 + ,25 + ,71 + ,29653 + ,52235 + ,2 + ,1003 + ,102361 + ,36 + ,48 + ,24 + ,75 + ,64622 + ,53986 + ,0 + ,340 + ,31970 + ,15 + ,5 + ,21 + ,42 + ,4157 + ,4105 + ,0 + ,2586 + ,200413 + ,107 + ,53 + ,19 + ,42 + ,29245 + ,59331 + ,3 + ,1119 + ,103381 + ,58 + ,36 + ,12 + ,8 + ,50008 + ,47796 + ,1 + ,1251 + ,94940 + ,61 + ,62 + ,28 + ,82 + ,52338 + ,38302 + ,2 + ,1516 + ,101560 + ,65 + ,46 + ,21 + ,41 + ,13310 + ,14063 + ,1 + ,2473 + ,144176 + ,60 + ,67 + ,34 + ,118 + ,92901 + ,54414 + ,0 + ,1288 + ,71921 + ,37 + ,2 + ,32 + ,91 + ,10956 + ,9903 + ,2 + ,1911 + ,126905 + ,54 + ,64 + ,27 + ,96 + ,34241 + ,53987 + ,1 + ,2279 + ,131184 + ,87 + ,59 + ,26 + ,81 + ,75043 + ,88937 + ,0 + ,816 + ,60138 + ,23 + ,16 + ,21 + ,46 + ,21152 + ,21928 + ,0 + ,1234 + ,84971 + ,71 + ,34 + ,31 + ,60 + ,42249 + ,29487 + ,0 + ,907 + ,80420 + ,64 + ,54 + ,26 + ,69 + ,42005 + ,35334 + ,0 + ,1827 + ,233569 + ,57 + ,39 + ,26 + ,85 + ,41152 + ,57596 + ,0 + ,841 + ,56252 + ,25 + ,26 + ,23 + ,17 + ,14399 + ,29750 + ,0 + ,1309 + ,97181 + ,32 + ,37 + ,25 + ,61 + ,28263 + ,41029 + ,0 + ,764 + ,50800 + ,41 + ,17 + ,22 + ,55 + ,17215 + ,12416 + ,0 + ,1439 + ,125941 + ,45 + ,32 + ,26 + ,55 + ,48140 + ,51158 + ,0 + ,2500 + ,211032 + ,210 + ,55 + ,33 + ,124 + ,62897 + ,79935 + ,0 + ,974 + ,71960 + ,92 + ,39 + ,22 + ,65 + ,22883 + ,26552 + ,0 + ,1152 + ,90379 + ,53 + ,39 + ,24 + ,73 + ,41622 + ,25807 + ,6 + ,1261 + ,125650 + ,47 + ,28 + ,21 + ,67 + ,40715 + ,50620 + ,0 + ,1508 + ,115572 + ,36 + ,45 + ,28 + ,66 + ,65897 + ,61467 + ,5 + ,2005 + ,136266 + ,67 + ,66 + ,22 + ,61 + ,76542 + ,65292 + ,1 + ,1191 + ,146715 + ,55 + ,39 + ,22 + ,74 + ,37477 + ,55516 + ,0 + ,1265 + ,124626 + ,57 + ,27 + ,15 + ,55 + ,53216 + ,42006 + ,0 + ,761 + ,49176 + ,33 + ,22 + ,13 + ,27 + ,40911 + ,26273 + ,0 + ,2156 + ,212926 + ,102 + ,43 + ,36 + ,115 + ,57021 + ,90248 + ,0 + ,1689 + ,173884 + ,55 + ,88 + ,24 + ,76 + ,73116 + ,61476 + ,0 + ,223 + ,19349 + ,12 + ,13 + ,1 + ,0 + ,3895 + ,9604 + ,0 + ,2074 + ,181141 + ,95 + ,23 + ,24 + ,83 + ,46609 + ,45108 + ,3 + ,1879 + ,145502 + ,70 + ,40 + ,31 + ,90 + ,29351 + ,47232 + ,0 + ,566 + ,45448 + ,26 + ,8 + ,4 + ,4 + ,2325 + ,3439 + ,0 + ,802 + ,58280 + ,20 + ,41 + ,20 + ,56 + ,31747 + ,30553 + ,0 + ,1131 + ,115944 + ,44 + ,51 + ,23 + ,63 + ,32665 + ,24751 + ,0 + ,981 + ,94341 + ,52 + ,24 + ,23 + ,52 + ,19249 + ,34458 + ,1 + ,591 + ,59090 + ,37 + ,23 + ,12 + ,24 + ,15292 + ,24649 + ,0 + ,596 + ,27676 + ,22 + ,2 + ,16 + ,17 + ,5842 + ,2342 + ,0 + ,1261 + ,120586 + ,41 + ,78 + ,28 + ,101 + ,33994 + ,52739 + ,0 + ,861 + ,88011 + ,31 + ,12 + ,10 + ,20 + ,13018 + ,6245 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1030 + ,85610 + ,31 + ,46 + ,25 + ,51 + ,98177 + ,35381 + ,0 + ,991 + ,84193 + ,58 + ,22 + ,21 + ,76 + ,37941 + ,19595 + ,0 + ,1178 + ,117769 + ,39 + ,49 + ,21 + ,55 + ,31032 + ,50848 + ,0 + ,1200 + ,107653 + ,56 + ,52 + ,21 + ,70 + ,32683 + ,39443 + ,0 + ,849 + ,71894 + ,57 + ,36 + ,21 + ,38 + ,34545 + ,27023 + ,0 + ,78 + ,3616 + ,5 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,924 + ,154806 + ,38 + ,35 + ,23 + ,81 + ,27525 + ,61022 + ,0 + ,1480 + ,136061 + ,73 + ,68 + ,29 + ,64 + ,66856 + ,63528 + ,0 + ,1870 + ,141822 + ,89 + ,26 + ,27 + ,66 + ,28549 + ,34835 + ,1 + ,861 + ,106515 + ,37 + ,32 + ,23 + ,89 + ,38610 + ,37172 + ,0 + ,778 + ,43410 + ,19 + ,7 + ,1 + ,3 + ,2781 + ,13 + ,0 + ,1533 + ,146920 + ,64 + ,67 + ,25 + ,76 + ,41211 + ,62548 + ,1 + ,889 + ,88874 + ,38 + ,30 + ,17 + ,48 + ,22698 + ,31334 + ,0 + ,1705 + ,111924 + ,49 + ,55 + ,29 + ,62 + ,41194 + ,20839 + ,8 + ,700 + ,60373 + ,39 + ,3 + ,12 + ,32 + ,32689 + ,5084 + ,3 + ,285 + ,19764 + ,12 + ,10 + ,2 + ,4 + ,5752 + ,9927 + ,1 + ,1490 + ,121665 + ,46 + ,46 + ,18 + ,61 + ,26757 + ,53229 + ,2 + ,981 + ,108685 + ,26 + ,23 + ,25 + ,90 + ,22527 + ,29877 + ,0 + ,1368 + ,124493 + ,37 + ,43 + ,29 + ,91 + ,44810 + ,37310 + ,0 + ,256 + ,11796 + ,9 + ,1 + ,2 + ,1 + ,0 + ,0 + ,0 + ,98 + ,10674 + ,9 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1317 + ,131263 + ,52 + ,33 + ,18 + ,39 + ,100674 + ,50067 + ,0 + ,41 + ,6836 + ,3 + ,0 + ,1 + ,0 + ,0 + ,0 + ,0 + ,1768 + ,153278 + ,55 + ,48 + ,21 + ,45 + ,57786 + ,47708 + ,5 + ,42 + ,5118 + ,3 + ,5 + ,0 + ,0 + ,0 + ,0 + ,0 + ,528 + ,40248 + ,16 + ,8 + ,4 + ,7 + ,5444 + ,6012 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,938 + ,100728 + ,42 + ,25 + ,25 + ,75 + ,28470 + ,27749 + ,0 + ,1245 + ,84267 + ,36 + ,21 + ,26 + ,52 + ,61849 + ,47555 + ,0 + ,81 + ,7131 + ,4 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1 + ,257 + ,8812 + ,13 + ,0 + ,4 + ,1 + ,2179 + ,1336 + ,0 + ,891 + ,63952 + ,22 + ,15 + ,17 + ,49 + ,8019 + ,11017 + ,1 + ,1114 + ,120111 + ,47 + ,47 + ,21 + ,69 + ,39644 + ,55184 + ,0 + ,1079 + ,94127 + ,18 + ,17 + ,22 + ,56 + ,23494 + ,43485 + ,1) + ,dim=c(9 + ,144) + ,dimnames=list(c('Pageviews' + ,'Time_in_RFC' + ,'#Logins' + ,'blogs' + ,'reviews' + ,'Submits_+120' + ,'Characters' + ,'CW_time' + ,'Shared') + ,1:144)) > y <- array(NA,dim=c(9,144),dimnames=list(c('Pageviews','Time_in_RFC','#Logins','blogs','reviews','Submits_+120','Characters','CW_time','Shared'),1:144)) > 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 = 'quantiles' > par1 = '2' > #'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] 150596 154801 7215 122139 221399 441870 134379 140428 103255 271630 [11] 121593 172071 83707 197412 134398 139224 134153 64149 122294 24889 [21] 52197 188915 163147 98575 143546 139780 163784 152479 304108 184024 [31] 151621 164516 120179 214701 196865 0 181527 93107 129352 229143 [41] 177063 126602 93742 152153 95704 139793 76348 188980 172100 146552 [51] 48188 109185 263652 215609 174876 115124 179712 70369 109215 166096 [61] 130414 102057 115310 101181 135228 94982 166919 118169 102361 31970 [71] 200413 103381 94940 101560 144176 71921 126905 131184 60138 84971 [81] 80420 233569 56252 97181 50800 125941 211032 71960 90379 125650 [91] 115572 136266 146715 124626 49176 212926 173884 19349 181141 145502 [101] 45448 58280 115944 94341 59090 27676 120586 88011 0 85610 [111] 84193 117769 107653 71894 3616 0 154806 136061 141822 106515 [121] 43410 146920 88874 111924 60373 19764 121665 108685 124493 11796 [131] 10674 131263 6836 153278 5118 40248 0 100728 84267 7131 [141] 8812 63952 120111 94127 > 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, 94341) [ 94341,139224) [139224,441870] 48 48 48 > colnames(x) [1] "Pageviews" "Time_in_RFC" "X.Logins" "blogs" "reviews" [6] "Submits_.120" "Characters" "CW_time" "Shared" > colnames(x)[par1] [1] "Time_in_RFC" > x[,par1] [1] [139224,441870] [139224,441870] [ 0, 94341) [ 94341,139224) [5] [139224,441870] [139224,441870] [ 94341,139224) [139224,441870] [9] [ 94341,139224) [139224,441870] [ 94341,139224) [139224,441870] [13] [ 0, 94341) [139224,441870] [ 94341,139224) [139224,441870] [17] [ 94341,139224) [ 0, 94341) [ 94341,139224) [ 0, 94341) [21] [ 0, 94341) [139224,441870] [139224,441870] [ 94341,139224) [25] [139224,441870] [139224,441870] [139224,441870] [139224,441870] [29] [139224,441870] [139224,441870] [139224,441870] [139224,441870] [33] [ 94341,139224) [139224,441870] [139224,441870] [ 0, 94341) [37] [139224,441870] [ 0, 94341) [ 94341,139224) [139224,441870] [41] [139224,441870] [ 94341,139224) [ 0, 94341) [139224,441870] [45] [ 94341,139224) [139224,441870] [ 0, 94341) [139224,441870] [49] [139224,441870] [139224,441870] [ 0, 94341) [ 94341,139224) [53] [139224,441870] [139224,441870] [139224,441870] [ 94341,139224) [57] [139224,441870] [ 0, 94341) [ 94341,139224) [139224,441870] [61] [ 94341,139224) [ 94341,139224) [ 94341,139224) [ 94341,139224) [65] [ 94341,139224) [ 94341,139224) [139224,441870] [ 94341,139224) [69] [ 94341,139224) [ 0, 94341) [139224,441870] [ 94341,139224) [73] [ 94341,139224) [ 94341,139224) [139224,441870] [ 0, 94341) [77] [ 94341,139224) [ 94341,139224) [ 0, 94341) [ 0, 94341) [81] [ 0, 94341) [139224,441870] [ 0, 94341) [ 94341,139224) [85] [ 0, 94341) [ 94341,139224) [139224,441870] [ 0, 94341) [89] [ 0, 94341) [ 94341,139224) [ 94341,139224) [ 94341,139224) [93] [139224,441870] [ 94341,139224) [ 0, 94341) [139224,441870] [97] [139224,441870] [ 0, 94341) [139224,441870] [139224,441870] [101] [ 0, 94341) [ 0, 94341) [ 94341,139224) [ 94341,139224) [105] [ 0, 94341) [ 0, 94341) [ 94341,139224) [ 0, 94341) [109] [ 0, 94341) [ 0, 94341) [ 0, 94341) [ 94341,139224) [113] [ 94341,139224) [ 0, 94341) [ 0, 94341) [ 0, 94341) [117] [139224,441870] [ 94341,139224) [139224,441870] [ 94341,139224) [121] [ 0, 94341) [139224,441870] [ 0, 94341) [ 94341,139224) [125] [ 0, 94341) [ 0, 94341) [ 94341,139224) [ 94341,139224) [129] [ 94341,139224) [ 0, 94341) [ 0, 94341) [ 94341,139224) [133] [ 0, 94341) [139224,441870] [ 0, 94341) [ 0, 94341) [137] [ 0, 94341) [ 94341,139224) [ 0, 94341) [ 0, 94341) [141] [ 0, 94341) [ 0, 94341) [ 94341,139224) [ 0, 94341) Levels: [ 0, 94341) [ 94341,139224) [139224,441870] > 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/1kz951324313370.tab") + } + } > m Conditional inference tree with 5 terminal nodes Response: as.factor(Time_in_RFC) Inputs: Pageviews, X.Logins, blogs, reviews, Submits_.120, Characters, CW_time, Shared Number of observations: 144 1) blogs <= 22; criterion = 1, statistic = 76.047 2)* weights = 34 1) blogs > 22 3) Pageviews <= 974; criterion = 1, statistic = 29.682 4)* weights = 14 3) Pageviews > 974 5) CW_time <= 35381; criterion = 0.999, statistic = 19.249 6)* weights = 16 5) CW_time > 35381 7) CW_time <= 55411; criterion = 1, statistic = 16.377 8)* weights = 46 7) CW_time > 55411 9)* weights = 34 > postscript(file="/var/www/rcomp/tmp/2lafi1324313370.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/3b4ls1324313370.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,] 3 2 [2,] 3 3 [3,] 1 1 [4,] 2 2 [5,] 3 3 [6,] 3 3 [7,] 2 3 [8,] 3 3 [9,] 2 2 [10,] 3 3 [11,] 2 2 [12,] 3 3 [13,] 1 2 [14,] 3 3 [15,] 2 2 [16,] 3 2 [17,] 2 3 [18,] 1 1 [19,] 2 2 [20,] 1 1 [21,] 1 1 [22,] 3 3 [23,] 3 2 [24,] 2 2 [25,] 3 2 [26,] 3 2 [27,] 3 3 [28,] 3 3 [29,] 3 3 [30,] 3 3 [31,] 3 2 [32,] 3 3 [33,] 2 2 [34,] 3 2 [35,] 3 3 [36,] 1 1 [37,] 3 2 [38,] 1 2 [39,] 2 2 [40,] 3 3 [41,] 3 3 [42,] 2 2 [43,] 1 1 [44,] 3 3 [45,] 2 2 [46,] 3 2 [47,] 1 1 [48,] 3 2 [49,] 3 3 [50,] 3 2 [51,] 1 1 [52,] 2 2 [53,] 3 3 [54,] 3 2 [55,] 3 3 [56,] 2 2 [57,] 3 2 [58,] 1 1 [59,] 2 1 [60,] 3 2 [61,] 2 2 [62,] 2 2 [63,] 2 2 [64,] 2 2 [65,] 2 1 [66,] 2 2 [67,] 3 3 [68,] 2 2 [69,] 2 2 [70,] 1 1 [71,] 3 3 [72,] 2 2 [73,] 2 2 [74,] 2 2 [75,] 3 2 [76,] 1 1 [77,] 2 2 [78,] 2 3 [79,] 1 1 [80,] 1 2 [81,] 1 1 [82,] 3 3 [83,] 1 1 [84,] 2 2 [85,] 1 1 [86,] 2 2 [87,] 3 3 [88,] 1 1 [89,] 1 2 [90,] 2 2 [91,] 2 3 [92,] 2 3 [93,] 3 3 [94,] 2 2 [95,] 1 1 [96,] 3 3 [97,] 3 3 [98,] 1 1 [99,] 3 2 [100,] 3 2 [101,] 1 1 [102,] 1 1 [103,] 2 2 [104,] 2 2 [105,] 1 1 [106,] 1 1 [107,] 2 2 [108,] 1 1 [109,] 1 1 [110,] 1 2 [111,] 1 1 [112,] 2 2 [113,] 2 2 [114,] 1 1 [115,] 1 1 [116,] 1 1 [117,] 3 1 [118,] 2 3 [119,] 3 2 [120,] 2 1 [121,] 1 1 [122,] 3 3 [123,] 1 1 [124,] 2 2 [125,] 1 1 [126,] 1 1 [127,] 2 2 [128,] 2 2 [129,] 2 2 [130,] 1 1 [131,] 1 1 [132,] 2 2 [133,] 1 1 [134,] 3 2 [135,] 1 1 [136,] 1 1 [137,] 1 1 [138,] 2 1 [139,] 1 1 [140,] 1 1 [141,] 1 1 [142,] 1 1 [143,] 2 2 [144,] 1 1 [ 0, 94341) [ 94341,139224) [139224,441870] [ 0, 94341) 43 5 0 [ 94341,139224) 4 38 6 [139224,441870] 1 19 28 > postscript(file="/var/www/rcomp/tmp/4l1v71324313370.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/5fdxq1324313370.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/6fhx61324313370.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/7db2l1324313370.tab") + } > > try(system("convert tmp/2lafi1324313370.ps tmp/2lafi1324313370.png",intern=TRUE)) character(0) > try(system("convert tmp/3b4ls1324313370.ps tmp/3b4ls1324313370.png",intern=TRUE)) character(0) > try(system("convert tmp/4l1v71324313370.ps tmp/4l1v71324313370.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.700 0.170 2.849