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 + ,535 + ,109 + ,0 + ,37 + ,18 + ,1323 + ,154801 + ,50 + ,396 + ,73 + ,1 + ,42 + ,20 + ,192 + ,7215 + ,18 + ,72 + ,1 + ,0 + ,0 + ,0 + ,2172 + ,122139 + ,91 + ,617 + ,154 + ,0 + ,49 + ,26 + ,3335 + ,221399 + ,129 + ,1118 + ,124 + ,0 + ,76 + ,30 + ,6310 + ,441870 + ,237 + ,1755 + ,276 + ,1 + ,118 + ,34 + ,1478 + ,134379 + ,52 + ,498 + ,89 + ,1 + ,42 + ,23 + ,1324 + ,140428 + ,53 + ,355 + ,54 + ,0 + ,57 + ,30 + ,1488 + ,103255 + ,40 + ,413 + ,87 + ,0 + ,45 + ,30 + ,2756 + ,271630 + ,91 + ,891 + ,129 + ,1 + ,67 + ,26 + ,1931 + ,121593 + ,71 + ,629 + ,158 + ,2 + ,50 + ,24 + ,1966 + ,172071 + ,63 + ,611 + ,113 + ,0 + ,71 + ,30 + ,1575 + ,83707 + ,94 + ,564 + ,75 + ,0 + ,41 + ,19 + ,2855 + ,197412 + ,98 + ,964 + ,255 + ,4 + ,66 + ,25 + ,1263 + ,134398 + ,48 + ,362 + ,50 + ,4 + ,42 + ,17 + ,1479 + ,139224 + ,73 + ,442 + ,81 + ,3 + ,54 + ,19 + ,1636 + ,134153 + ,52 + ,391 + ,92 + ,0 + ,75 + ,33 + ,1076 + ,64149 + ,52 + ,305 + ,72 + ,5 + ,0 + ,15 + ,2376 + ,122294 + ,82 + ,721 + ,142 + ,0 + ,54 + ,34 + ,678 + ,24889 + ,22 + ,206 + ,47 + ,0 + ,13 + ,15 + ,902 + ,52197 + ,52 + ,310 + ,40 + ,0 + ,16 + ,15 + ,2308 + ,188915 + ,89 + ,686 + ,94 + ,0 + ,77 + ,27 + ,1590 + ,163147 + ,66 + ,572 + ,127 + ,0 + ,34 + ,25 + ,1863 + ,98575 + ,48 + ,558 + ,164 + ,1 + ,38 + ,34 + ,1799 + ,143546 + ,80 + ,569 + ,41 + ,1 + ,50 + ,21 + ,1385 + ,139780 + ,25 + ,513 + ,160 + ,0 + ,39 + ,21 + ,1870 + ,163784 + ,146 + ,602 + ,90 + ,0 + ,54 + ,25 + ,1161 + ,152479 + ,75 + ,276 + ,55 + ,0 + ,67 + ,28 + ,2417 + ,304108 + ,109 + ,791 + ,78 + ,0 + ,55 + ,26 + ,1952 + ,184024 + ,40 + ,815 + ,90 + ,0 + ,52 + ,20 + ,1514 + ,151621 + ,41 + ,427 + ,76 + ,0 + ,50 + ,28 + ,1487 + ,164516 + ,41 + ,496 + ,111 + ,2 + ,54 + ,20 + ,2051 + ,120179 + ,94 + ,653 + ,87 + ,4 + ,53 + ,17 + ,2843 + ,214701 + ,116 + ,857 + ,302 + ,0 + ,76 + ,25 + ,2216 + ,196865 + ,48 + ,736 + ,84 + ,1 + ,52 + ,24 + ,1 + ,0 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1830 + ,181527 + ,57 + ,862 + ,58 + ,0 + ,46 + ,27 + ,1563 + ,93107 + ,49 + ,483 + ,137 + ,3 + ,44 + ,14 + ,2046 + ,129352 + ,45 + ,495 + ,267 + ,9 + ,35 + ,32 + ,2005 + ,229143 + ,58 + ,749 + ,56 + ,0 + ,82 + ,31 + ,1934 + ,177063 + ,67 + ,627 + ,94 + ,2 + ,70 + ,21 + ,1572 + ,126602 + ,53 + ,597 + ,62 + ,0 + ,31 + ,34 + ,950 + ,93742 + ,29 + ,348 + ,35 + ,2 + ,25 + ,23 + ,1877 + ,152153 + ,72 + ,711 + ,59 + ,1 + ,48 + ,24 + ,1036 + ,95704 + ,42 + ,322 + ,46 + ,2 + ,44 + ,22 + ,1097 + ,139793 + ,84 + ,280 + ,40 + ,2 + ,40 + ,22 + ,730 + ,76348 + ,30 + ,205 + ,49 + ,1 + ,23 + ,35 + ,1918 + ,188980 + ,86 + ,648 + ,114 + ,0 + ,63 + ,21 + ,1826 + ,172100 + ,79 + ,580 + ,113 + ,1 + ,43 + ,31 + ,2444 + ,146552 + ,54 + ,875 + ,171 + ,7 + ,62 + ,26 + ,658 + ,48188 + ,28 + ,205 + ,37 + ,0 + ,12 + ,22 + ,1425 + ,109185 + ,60 + ,363 + ,51 + ,0 + ,63 + ,21 + ,2246 + ,263652 + ,68 + ,757 + ,89 + ,0 + ,60 + ,27 + ,1899 + ,215609 + ,75 + ,647 + ,67 + ,0 + ,53 + ,26 + ,1630 + ,174876 + ,54 + ,584 + ,49 + ,1 + ,53 + ,33 + ,1496 + ,115124 + ,49 + ,457 + ,74 + ,6 + ,35 + ,11 + ,1681 + ,179712 + ,60 + ,438 + ,58 + ,0 + ,49 + ,26 + ,816 + ,70369 + ,20 + ,235 + ,72 + ,0 + ,25 + ,26 + ,902 + ,109215 + ,58 + ,312 + ,30 + ,0 + ,47 + ,21 + ,2606 + ,166096 + ,85 + ,877 + ,59 + ,10 + ,30 + ,38 + ,1557 + ,130414 + ,51 + ,454 + ,65 + ,6 + ,50 + ,29 + ,1780 + ,102057 + ,71 + ,668 + ,81 + ,0 + ,36 + ,19 + ,1265 + ,115310 + ,56 + ,346 + ,84 + ,11 + ,43 + ,19 + ,1117 + ,101181 + ,32 + ,377 + ,46 + ,3 + ,44 + ,24 + ,1069 + ,135228 + ,31 + ,365 + ,56 + ,0 + ,14 + ,26 + ,1229 + ,94982 + ,37 + ,391 + ,36 + ,0 + ,38 + ,29 + ,2155 + ,166919 + ,67 + ,476 + ,84 + ,8 + ,58 + ,34 + ,2500 + ,118169 + ,64 + ,747 + ,152 + ,2 + ,68 + ,25 + ,1003 + ,102361 + ,36 + ,246 + ,48 + ,0 + ,48 + ,24 + ,340 + ,31970 + ,15 + ,101 + ,40 + ,0 + ,5 + ,21 + ,2586 + ,200413 + ,107 + ,901 + ,135 + ,3 + ,53 + ,19 + ,1119 + ,103381 + ,58 + ,334 + ,80 + ,1 + ,36 + ,12 + ,1251 + ,94940 + ,61 + ,404 + ,60 + ,2 + ,62 + ,28 + ,1516 + ,101560 + ,65 + ,442 + ,89 + ,1 + ,46 + ,21 + ,2473 + ,144176 + ,60 + ,627 + ,89 + ,0 + ,67 + ,34 + ,1288 + ,71921 + ,37 + ,345 + ,79 + ,2 + ,2 + ,32 + ,1911 + ,126905 + ,54 + ,538 + ,111 + ,1 + ,64 + ,27 + ,2279 + ,131184 + ,87 + ,741 + ,67 + ,0 + ,59 + ,26 + ,816 + ,60138 + ,23 + ,253 + ,76 + ,0 + ,16 + ,21 + ,1234 + ,84971 + ,71 + ,395 + ,105 + ,0 + ,34 + ,31 + ,907 + ,80420 + ,64 + ,211 + ,49 + ,0 + ,54 + ,26 + ,1827 + ,233569 + ,57 + ,670 + ,57 + ,0 + ,39 + ,26 + ,841 + ,56252 + ,25 + ,244 + ,49 + ,0 + ,26 + ,23 + ,1309 + ,97181 + ,32 + ,438 + ,132 + ,0 + ,37 + ,25 + ,764 + ,50800 + ,41 + ,255 + ,49 + ,0 + ,17 + ,22 + ,1439 + ,125941 + ,45 + ,434 + ,71 + ,0 + ,32 + ,26 + ,2500 + ,211032 + ,210 + ,613 + ,100 + ,0 + ,55 + ,33 + ,974 + ,71960 + ,92 + ,233 + ,71 + ,0 + ,39 + ,22 + ,1152 + ,90379 + ,53 + ,360 + ,49 + ,6 + ,39 + ,24 + ,1261 + ,125650 + ,47 + ,486 + ,72 + ,0 + ,28 + ,21 + ,1508 + ,115572 + ,36 + ,535 + ,59 + ,5 + ,45 + ,28 + ,2005 + ,136266 + ,67 + ,585 + ,86 + ,1 + ,66 + ,22 + ,1191 + ,146715 + ,55 + ,402 + ,65 + ,0 + ,39 + ,22 + ,1265 + ,124626 + ,57 + ,466 + ,81 + ,0 + ,27 + ,15 + ,761 + ,49176 + ,33 + ,291 + ,30 + ,0 + ,22 + ,13 + ,2156 + ,212926 + ,102 + ,691 + ,166 + ,0 + ,43 + ,36 + ,1689 + ,173884 + ,55 + ,515 + ,89 + ,0 + ,88 + ,24 + ,223 + ,19349 + ,12 + ,67 + ,15 + ,0 + ,13 + ,1 + ,2074 + ,181141 + ,95 + ,712 + ,104 + ,3 + ,23 + ,24 + ,1879 + ,145502 + ,70 + ,770 + ,61 + ,0 + ,40 + ,31 + ,566 + ,45448 + ,26 + ,247 + ,11 + ,0 + ,8 + ,4 + ,802 + ,58280 + ,20 + ,240 + ,44 + ,0 + ,41 + ,20 + ,1131 + ,115944 + ,44 + ,360 + ,84 + ,0 + ,51 + ,23 + ,981 + ,94341 + ,52 + ,249 + ,66 + ,1 + ,24 + ,23 + ,591 + ,59090 + ,37 + ,138 + ,27 + ,0 + ,23 + ,12 + ,596 + ,27676 + ,22 + ,194 + ,59 + ,0 + ,2 + ,16 + ,1261 + ,120586 + ,41 + ,285 + ,126 + ,0 + ,78 + ,28 + ,861 + ,88011 + ,31 + ,227 + ,32 + ,0 + ,12 + ,10 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1030 + ,85610 + ,31 + ,306 + ,58 + ,0 + ,46 + ,25 + ,991 + ,84193 + ,58 + ,328 + ,52 + ,0 + ,22 + ,21 + ,1178 + ,117769 + ,39 + ,397 + ,49 + ,0 + ,49 + ,21 + ,1200 + ,107653 + ,56 + ,369 + ,64 + ,0 + ,52 + ,21 + ,849 + ,71894 + ,57 + ,287 + ,71 + ,0 + ,36 + ,21 + ,78 + ,3616 + ,5 + ,14 + ,5 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,924 + ,154806 + ,38 + ,301 + ,70 + ,0 + ,35 + ,23 + ,1480 + ,136061 + ,73 + ,535 + ,72 + ,0 + ,68 + ,29 + ,1870 + ,141822 + ,89 + ,530 + ,118 + ,1 + ,26 + ,27 + ,861 + ,106515 + ,37 + ,272 + ,56 + ,0 + ,32 + ,23 + ,778 + ,43410 + ,19 + ,292 + ,63 + ,0 + ,7 + ,1 + ,1533 + ,146920 + ,64 + ,458 + ,88 + ,1 + ,67 + ,25 + ,889 + ,88874 + ,38 + ,241 + ,46 + ,0 + ,30 + ,17 + ,1705 + ,111924 + ,49 + ,497 + ,60 + ,8 + ,55 + ,29 + ,700 + ,60373 + ,39 + ,165 + ,29 + ,3 + ,3 + ,12 + ,285 + ,19764 + ,12 + ,75 + ,19 + ,1 + ,10 + ,2 + ,1490 + ,121665 + ,46 + ,461 + ,58 + ,2 + ,46 + ,18 + ,981 + ,108685 + ,26 + ,341 + ,66 + ,0 + ,23 + ,25 + ,1368 + ,124493 + ,37 + ,446 + ,97 + ,0 + ,43 + ,29 + ,256 + ,11796 + ,9 + ,79 + ,22 + ,0 + ,1 + ,2 + ,98 + ,10674 + ,9 + ,33 + ,7 + ,0 + ,0 + ,0 + ,1317 + ,131263 + ,52 + ,449 + ,37 + ,0 + ,33 + ,18 + ,41 + ,6836 + ,3 + ,11 + ,5 + ,0 + ,0 + ,1 + ,1768 + ,153278 + ,55 + ,606 + ,48 + ,5 + ,48 + ,21 + ,42 + ,5118 + ,3 + ,6 + ,1 + ,0 + ,5 + ,0 + ,528 + ,40248 + ,16 + ,183 + ,34 + ,1 + ,8 + ,4 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,938 + ,100728 + ,42 + ,310 + ,49 + ,0 + ,25 + ,25 + ,1245 + ,84267 + ,36 + ,245 + ,44 + ,0 + ,21 + ,26 + ,81 + ,7131 + ,4 + ,27 + ,0 + ,1 + ,0 + ,0 + ,257 + ,8812 + ,13 + ,97 + ,18 + ,0 + ,0 + ,4 + ,891 + ,63952 + ,22 + ,247 + ,48 + ,1 + ,15 + ,17 + ,1114 + ,120111 + ,47 + ,273 + ,54 + ,0 + ,47 + ,21 + ,1079 + ,94127 + ,18 + ,386 + ,50 + ,1 + ,17 + ,22) + ,dim=c(8 + ,144) + ,dimnames=list(c('pageviews' + ,'timeRFC' + ,'logins' + ,'CCV' + ,'CV' + ,'Cauthors' + ,'bloggedC' + ,'reviewedC') + ,1:144)) > y <- array(NA,dim=c(8,144),dimnames=list(c('pageviews','timeRFC','logins','CCV','CV','Cauthors','bloggedC','reviewedC'),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] "timeRFC" > 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" "timeRFC" "logins" "CCV" "CV" "Cauthors" [7] "bloggedC" "reviewedC" > colnames(x)[par1] [1] "timeRFC" > 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/1fuah1324298527.tab") + } + } > m Conditional inference tree with 7 terminal nodes Response: timeRFC Inputs: pageviews, logins, CCV, CV, Cauthors, bloggedC, reviewedC 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) pageviews <= 841; criterion = 0.986, statistic = 9.559 5)* weights = 15 4) pageviews > 841 6)* weights = 8 1) pageviews > 907 7) pageviews <= 1575; criterion = 1, statistic = 65.271 8) bloggedC <= 25; criterion = 0.993, statistic = 10.875 9)* weights = 10 8) bloggedC > 25 10)* weights = 46 7) pageviews > 1575 11) CCV <= 747; criterion = 1, statistic = 24.944 12)* weights = 36 11) CCV > 747 13)* weights = 14 > postscript(file="/var/wessaorg/rcomp/tmp/2ypva1324298527.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/36wn61324298527.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 156470.944 -5874.944444 2 154801 119306.696 35494.304348 3 7215 8818.733 -1603.733333 4 122139 156470.944 -34331.944444 5 221399 226287.786 -4888.785714 6 441870 226287.786 215582.214286 7 134379 119306.696 15072.304348 8 140428 119306.696 21121.304348 9 103255 119306.696 -16051.695652 10 271630 226287.786 45342.214286 11 121593 156470.944 -34877.944444 12 172071 156470.944 15600.055556 13 83707 119306.696 -35599.695652 14 197412 226287.786 -28875.785714 15 134398 119306.696 15091.304348 16 139224 119306.696 19917.304348 17 134153 156470.944 -22317.944444 18 64149 93138.100 -28989.100000 19 122294 156470.944 -34176.944444 20 24889 51379.000 -26490.000000 21 52197 82634.750 -30437.750000 22 188915 156470.944 32444.055556 23 163147 156470.944 6676.055556 24 98575 156470.944 -57895.944444 25 143546 156470.944 -12924.944444 26 139780 119306.696 20473.304348 27 163784 156470.944 7313.055556 28 152479 119306.696 33172.304348 29 304108 226287.786 77820.214286 30 184024 226287.786 -42263.785714 31 151621 119306.696 32314.304348 32 164516 119306.696 45209.304348 33 120179 156470.944 -36291.944444 34 214701 226287.786 -11586.785714 35 196865 156470.944 40394.055556 36 0 8818.733 -8818.733333 37 181527 226287.786 -44760.785714 38 93107 119306.696 -26199.695652 39 129352 156470.944 -27118.944444 40 229143 226287.786 2855.214286 41 177063 156470.944 20592.055556 42 126602 119306.696 7295.304348 43 93742 93138.100 603.900000 44 152153 156470.944 -4317.944444 45 95704 119306.696 -23602.695652 46 139793 119306.696 20486.304348 47 76348 51379.000 24969.000000 48 188980 156470.944 32509.055556 49 172100 156470.944 15629.055556 50 146552 226287.786 -79735.785714 51 48188 51379.000 -3191.000000 52 109185 119306.696 -10121.695652 53 263652 226287.786 37364.214286 54 215609 156470.944 59138.055556 55 174876 156470.944 18405.055556 56 115124 119306.696 -4182.695652 57 179712 156470.944 23241.055556 58 70369 51379.000 18990.000000 59 109215 82634.750 26580.250000 60 166096 226287.786 -60191.785714 61 130414 119306.696 11107.304348 62 102057 156470.944 -54413.944444 63 115310 119306.696 -3996.695652 64 101181 119306.696 -18125.695652 65 135228 93138.100 42089.900000 66 94982 119306.696 -24324.695652 67 166919 156470.944 10448.055556 68 118169 156470.944 -38301.944444 69 102361 119306.696 -16945.695652 70 31970 8818.733 23151.266667 71 200413 226287.786 -25874.785714 72 103381 119306.696 -15925.695652 73 94940 119306.696 -24366.695652 74 101560 119306.696 -17746.695652 75 144176 156470.944 -12294.944444 76 71921 93138.100 -21217.100000 77 126905 156470.944 -29565.944444 78 131184 156470.944 -25286.944444 79 60138 51379.000 8759.000000 80 84971 119306.696 -34335.695652 81 80420 82634.750 -2214.750000 82 233569 156470.944 77098.055556 83 56252 51379.000 4873.000000 84 97181 119306.696 -22125.695652 85 50800 51379.000 -579.000000 86 125941 119306.696 6634.304348 87 211032 156470.944 54561.055556 88 71960 119306.696 -47346.695652 89 90379 119306.696 -28927.695652 90 125650 119306.696 6343.304348 91 115572 119306.696 -3734.695652 92 136266 156470.944 -20204.944444 93 146715 119306.696 27408.304348 94 124626 119306.696 5319.304348 95 49176 51379.000 -2203.000000 96 212926 156470.944 56455.055556 97 173884 156470.944 17413.055556 98 19349 8818.733 10530.266667 99 181141 156470.944 24670.055556 100 145502 226287.786 -80785.785714 101 45448 51379.000 -5931.000000 102 58280 51379.000 6901.000000 103 115944 119306.696 -3362.695652 104 94341 93138.100 1202.900000 105 59090 51379.000 7711.000000 106 27676 51379.000 -23703.000000 107 120586 119306.696 1279.304348 108 88011 82634.750 5376.250000 109 0 8818.733 -8818.733333 110 85610 119306.696 -33696.695652 111 84193 93138.100 -8945.100000 112 117769 119306.696 -1537.695652 113 107653 119306.696 -11653.695652 114 71894 82634.750 -10740.750000 115 3616 8818.733 -5202.733333 116 0 8818.733 -8818.733333 117 154806 119306.696 35499.304348 118 136061 119306.696 16754.304348 119 141822 156470.944 -14648.944444 120 106515 82634.750 23880.250000 121 43410 51379.000 -7969.000000 122 146920 119306.696 27613.304348 123 88874 82634.750 6239.250000 124 111924 156470.944 -44546.944444 125 60373 51379.000 8994.000000 126 19764 8818.733 10945.266667 127 121665 119306.696 2358.304348 128 108685 93138.100 15546.900000 129 124493 119306.696 5186.304348 130 11796 8818.733 2977.266667 131 10674 8818.733 1855.266667 132 131263 119306.696 11956.304348 133 6836 8818.733 -1982.733333 134 153278 156470.944 -3192.944444 135 5118 8818.733 -3700.733333 136 40248 51379.000 -11131.000000 137 0 8818.733 -8818.733333 138 100728 93138.100 7589.900000 139 84267 93138.100 -8871.100000 140 7131 8818.733 -1687.733333 141 8812 8818.733 -6.733333 142 63952 82634.750 -18682.750000 143 120111 119306.696 804.304348 144 94127 93138.100 988.900000 > 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/45acw1324298527.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/589t11324298527.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/6rt3l1324298527.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/7wer31324298527.tab") + } > > try(system("convert tmp/2ypva1324298527.ps tmp/2ypva1324298527.png",intern=TRUE)) character(0) > try(system("convert tmp/36wn61324298527.ps tmp/36wn61324298527.png",intern=TRUE)) character(0) > try(system("convert tmp/45acw1324298527.ps tmp/45acw1324298527.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.417 0.250 3.680