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(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 = 'none' > 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 3616 5118 6836 7131 7215 8812 10674 11796 19349 19764 4 1 1 1 1 1 1 1 1 1 1 24889 27676 31970 40248 43410 45448 48188 49176 50800 52197 56252 1 1 1 1 1 1 1 1 1 1 1 58280 59090 60138 60373 63952 64149 70369 71894 71921 71960 76348 1 1 1 1 1 1 1 1 1 1 1 80420 83707 84193 84267 84971 85610 88011 88874 90379 93107 93742 1 1 1 1 1 1 1 1 1 1 1 94127 94341 94940 94982 95704 97181 98575 100728 101181 101560 102057 1 1 1 1 1 1 1 1 1 1 1 102361 103255 103381 106515 107653 108685 109185 109215 111924 115124 115310 1 1 1 1 1 1 1 1 1 1 1 115572 115944 117769 118169 120111 120179 120586 121593 121665 122139 122294 1 1 1 1 1 1 1 1 1 1 1 124493 124626 125650 125941 126602 126905 129352 130414 131184 131263 134153 1 1 1 1 1 1 1 1 1 1 1 134379 134398 135228 136061 136266 139224 139780 139793 140428 141822 143546 1 1 1 1 1 1 1 1 1 1 1 144176 145502 146552 146715 146920 150596 151621 152153 152479 153278 154801 1 1 1 1 1 1 1 1 1 1 1 154806 163147 163784 164516 166096 166919 172071 172100 173884 174876 177063 1 1 1 1 1 1 1 1 1 1 1 179712 181141 181527 184024 188915 188980 196865 197412 200413 211032 212926 1 1 1 1 1 1 1 1 1 1 1 214701 215609 221399 229143 233569 263652 271630 304108 441870 1 1 1 1 1 1 1 1 1 > 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] 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 == '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/17efp1324313150.tab") + } + } > m Conditional inference tree with 8 terminal nodes Response: Time_in_RFC Inputs: Pageviews, X.Logins, blogs, reviews, Submits_.120, Characters, CW_time, Shared Number of observations: 144 1) Pageviews <= 907; criterion = 1, statistic = 112.581 2) Pageviews <= 340; criterion = 1, statistic = 30.316 3)* weights = 15 2) Pageviews > 340 4) CW_time <= 26273; criterion = 0.994, statistic = 11.233 5)* weights = 14 4) CW_time > 26273 6)* weights = 9 1) Pageviews > 907 7) Pageviews <= 1575; criterion = 1, statistic = 65.271 8) CW_time <= 39443; criterion = 1, statistic = 29.579 9)* weights = 20 8) CW_time > 39443 10) CW_time <= 55411; criterion = 0.972, statistic = 8.486 11)* weights = 26 10) CW_time > 55411 12)* weights = 10 7) Pageviews > 1575 13) CW_time <= 94440; criterion = 1, statistic = 28.331 14)* weights = 43 13) CW_time > 94440 15)* weights = 7 > postscript(file="/var/wessaorg/rcomp/tmp/2uait1324313150.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/3nqbd1324313150.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 150596 161273.163 -10677.162791 2 154801 144667.700 10133.300000 3 7215 8818.733 -1603.733333 4 122139 161273.163 -39134.162791 5 221399 161273.163 60125.837209 6 441870 266605.286 175264.714286 7 134379 144667.700 -10288.700000 8 140428 144667.700 -4239.700000 9 103255 94324.250 8930.750000 10 271630 266605.286 5024.714286 11 121593 161273.163 -39680.162791 12 172071 161273.163 10797.837209 13 83707 94324.250 -10617.250000 14 197412 161273.163 36138.837209 15 134398 118704.885 15693.115385 16 139224 118704.885 20519.115385 17 134153 161273.163 -27120.162791 18 64149 94324.250 -30175.250000 19 122294 161273.163 -38979.162791 20 24889 50971.143 -26082.142857 21 52197 50971.143 1225.857143 22 188915 266605.286 -77690.285714 23 163147 161273.163 1873.837209 24 98575 161273.163 -62698.162791 25 143546 161273.163 -17727.162791 26 139780 118704.885 21075.115385 27 163784 161273.163 2510.837209 28 152479 144667.700 7811.300000 29 304108 266605.286 37502.714286 30 184024 161273.163 22750.837209 31 151621 118704.885 32916.115385 32 164516 144667.700 19848.300000 33 120179 161273.163 -41094.162791 34 214701 161273.163 53427.837209 35 196865 161273.163 35591.837209 36 0 8818.733 -8818.733333 37 181527 161273.163 20253.837209 38 93107 94324.250 -1217.250000 39 129352 161273.163 -31921.162791 40 229143 266605.286 -37462.285714 41 177063 161273.163 15789.837209 42 126602 118704.885 7897.115385 43 93742 118704.885 -24962.884615 44 152153 161273.163 -9120.162791 45 95704 94324.250 1379.750000 46 139793 118704.885 21088.115385 47 76348 79796.333 -3448.333333 48 188980 161273.163 27706.837209 49 172100 161273.163 10826.837209 50 146552 161273.163 -14721.162791 51 48188 50971.143 -2783.142857 52 109185 94324.250 14860.750000 53 263652 266605.286 -2953.285714 54 215609 161273.163 54335.837209 55 174876 161273.163 13602.837209 56 115124 118704.885 -3580.884615 57 179712 161273.163 18438.837209 58 70369 79796.333 -9427.333333 59 109215 79796.333 29418.666667 60 166096 161273.163 4822.837209 61 130414 118704.885 11709.115385 62 102057 161273.163 -59216.162791 63 115310 118704.885 -3394.884615 64 101181 118704.885 -17523.884615 65 135228 118704.885 16523.115385 66 94982 118704.885 -23722.884615 67 166919 266605.286 -99686.285714 68 118169 161273.163 -43104.162791 69 102361 118704.885 -16343.884615 70 31970 8818.733 23151.266667 71 200413 161273.163 39139.837209 72 103381 118704.885 -15323.884615 73 94940 94324.250 615.750000 74 101560 94324.250 7235.750000 75 144176 161273.163 -17097.162791 76 71921 94324.250 -22403.250000 77 126905 161273.163 -34368.162791 78 131184 161273.163 -30089.162791 79 60138 50971.143 9166.857143 80 84971 94324.250 -9353.250000 81 80420 79796.333 623.666667 82 233569 161273.163 72295.837209 83 56252 79796.333 -23544.333333 84 97181 118704.885 -21523.884615 85 50800 50971.143 -171.142857 86 125941 118704.885 7236.115385 87 211032 161273.163 49758.837209 88 71960 94324.250 -22364.250000 89 90379 94324.250 -3945.250000 90 125650 118704.885 6945.115385 91 115572 144667.700 -29095.700000 92 136266 161273.163 -25007.162791 93 146715 144667.700 2047.300000 94 124626 118704.885 5921.115385 95 49176 50971.143 -1795.142857 96 212926 161273.163 51652.837209 97 173884 161273.163 12610.837209 98 19349 8818.733 10530.266667 99 181141 161273.163 19867.837209 100 145502 161273.163 -15771.162791 101 45448 50971.143 -5523.142857 102 58280 79796.333 -21516.333333 103 115944 94324.250 21619.750000 104 94341 94324.250 16.750000 105 59090 50971.143 8118.857143 106 27676 50971.143 -23295.142857 107 120586 118704.885 1881.115385 108 88011 50971.143 37039.857143 109 0 8818.733 -8818.733333 110 85610 94324.250 -8714.250000 111 84193 94324.250 -10131.250000 112 117769 118704.885 -935.884615 113 107653 94324.250 13328.750000 114 71894 79796.333 -7902.333333 115 3616 8818.733 -5202.733333 116 0 8818.733 -8818.733333 117 154806 144667.700 10138.300000 118 136061 144667.700 -8606.700000 119 141822 161273.163 -19451.162791 120 106515 79796.333 26718.666667 121 43410 50971.143 -7561.142857 122 146920 144667.700 2252.300000 123 88874 79796.333 9077.666667 124 111924 161273.163 -49349.162791 125 60373 50971.143 9401.857143 126 19764 8818.733 10945.266667 127 121665 118704.885 2960.115385 128 108685 94324.250 14360.750000 129 124493 94324.250 30168.750000 130 11796 8818.733 2977.266667 131 10674 8818.733 1855.266667 132 131263 118704.885 12558.115385 133 6836 8818.733 -1982.733333 134 153278 161273.163 -7995.162791 135 5118 8818.733 -3700.733333 136 40248 50971.143 -10723.142857 137 0 8818.733 -8818.733333 138 100728 94324.250 6403.750000 139 84267 118704.885 -34437.884615 140 7131 8818.733 -1687.733333 141 8812 8818.733 -6.733333 142 63952 50971.143 12980.857143 143 120111 118704.885 1406.115385 144 94127 118704.885 -24577.884615 > 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/4ha5e1324313150.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/5up541324313150.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/6ojw21324313150.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/7jv9j1324313150.tab") + } > > try(system("convert tmp/2uait1324313150.ps tmp/2uait1324313150.png",intern=TRUE)) character(0) > try(system("convert tmp/3nqbd1324313150.ps tmp/3nqbd1324313150.png",intern=TRUE)) character(0) > try(system("convert tmp/4ha5e1324313150.ps tmp/4ha5e1324313150.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.599 0.262 3.862