R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list(210907 + ,79 + ,94 + ,24188 + ,120982 + ,58 + ,103 + ,18273 + ,176508 + ,60 + ,93 + ,14130 + ,179321 + ,108 + ,103 + ,32287 + ,123185 + ,49 + ,51 + ,8654 + ,52746 + ,0 + ,70 + ,9245 + ,385534 + ,121 + ,91 + ,33251 + ,33170 + ,1 + ,22 + ,1271 + ,101645 + ,20 + ,38 + ,5279 + ,149061 + ,43 + ,93 + ,27101 + ,165446 + ,69 + ,60 + ,16373 + ,237213 + ,78 + ,123 + ,19716 + ,173326 + ,86 + ,148 + ,17753 + ,133131 + ,44 + ,90 + ,9028 + ,258873 + ,104 + ,124 + ,18653 + ,180083 + ,63 + ,70 + ,8828 + ,324799 + ,158 + ,168 + ,29498 + ,230964 + ,102 + ,115 + ,27563 + ,236785 + ,77 + ,71 + ,18293 + ,135473 + ,82 + ,66 + ,22530 + ,202925 + ,115 + ,134 + ,15977 + ,215147 + ,101 + ,117 + ,35082 + ,344297 + ,80 + ,108 + ,16116 + ,153935 + ,50 + ,84 + ,15849 + ,132943 + ,83 + ,156 + ,16026 + ,174724 + ,123 + ,120 + ,26569 + ,174415 + ,73 + ,114 + ,24785 + ,225548 + ,81 + ,94 + ,17569 + ,223632 + ,105 + ,120 + ,23825 + ,124817 + ,47 + ,81 + ,7869 + ,221698 + ,105 + ,110 + ,14975 + ,210767 + ,94 + ,133 + ,37791 + ,170266 + ,44 + ,122 + ,9605 + ,260561 + ,114 + ,158 + ,27295 + ,84853 + ,38 + ,109 + ,2746 + ,294424 + ,107 + ,124 + ,34461 + ,101011 + ,30 + ,39 + ,8098 + ,215641 + ,71 + ,92 + ,4787 + ,325107 + ,84 + ,126 + ,24919 + ,7176 + ,0 + ,0 + ,603 + ,167542 + ,59 + ,70 + ,16329 + ,106408 + ,33 + ,37 + ,12558 + ,96560 + ,42 + ,38 + ,7784 + ,265769 + ,96 + ,120 + ,28522 + ,269651 + ,106 + ,93 + ,22265 + ,149112 + ,56 + ,95 + ,14459 + ,175824 + ,57 + ,77 + ,14526 + ,152871 + ,59 + ,90 + ,22240 + ,111665 + ,39 + ,80 + ,11802 + ,116408 + ,34 + ,31 + ,7623 + ,362301 + ,76 + ,110 + ,11912 + ,78800 + ,20 + ,66 + ,7935 + ,183167 + ,91 + ,138 + ,18220 + ,277965 + ,115 + ,133 + ,19199 + ,150629 + ,85 + ,113 + ,19918 + ,168809 + ,76 + ,100 + ,21884 + ,24188 + ,8 + ,7 + ,2694 + ,329267 + ,79 + ,140 + ,15808 + ,65029 + ,21 + ,61 + ,3597 + ,101097 + ,30 + ,41 + ,5296 + ,218946 + ,76 + ,96 + ,25239 + ,244052 + ,101 + ,164 + ,29801 + ,341570 + ,94 + ,78 + ,18450 + ,103597 + ,27 + ,49 + ,7132 + ,233328 + ,92 + ,102 + ,34861 + ,256462 + ,123 + ,124 + ,35940 + ,206161 + ,75 + ,99 + ,16688 + ,311473 + ,128 + ,129 + ,24683 + ,235800 + ,105 + ,62 + ,46230 + ,177939 + ,55 + ,73 + ,10387 + ,207176 + ,56 + ,114 + ,21436 + ,196553 + ,41 + ,99 + ,30546 + ,174184 + ,72 + ,70 + ,19746 + ,143246 + ,67 + ,104 + ,15977 + ,187559 + ,75 + ,116 + ,22583 + ,187681 + ,114 + ,91 + ,17274 + ,119016 + ,118 + ,74 + ,16469 + ,182192 + ,77 + ,138 + ,14251 + ,73566 + ,22 + ,67 + ,3007 + ,194979 + ,66 + ,151 + ,16851 + ,167488 + ,69 + ,72 + ,21113 + ,143756 + ,105 + ,120 + ,17401 + ,275541 + ,116 + ,115 + ,23958 + ,243199 + ,88 + ,105 + ,23567 + ,182999 + ,73 + ,104 + ,13065 + ,135649 + ,99 + ,108 + ,15358 + ,152299 + ,62 + ,98 + ,14587 + ,120221 + ,53 + ,69 + ,12770 + ,346485 + ,118 + ,111 + ,24021 + ,145790 + ,30 + ,99 + ,9648 + ,193339 + ,100 + ,71 + ,20537 + ,80953 + ,49 + ,27 + ,7905 + ,122774 + ,24 + ,69 + ,4527 + ,130585 + ,67 + ,107 + ,30495 + ,112611 + ,46 + ,73 + ,7117 + ,286468 + ,57 + ,107 + ,17719 + ,241066 + ,75 + ,93 + ,27056 + ,148446 + ,135 + ,129 + ,33473 + ,204713 + ,68 + ,69 + ,9758 + ,182079 + ,124 + ,118 + ,21115 + ,140344 + ,33 + ,73 + ,7236 + ,220516 + ,98 + ,119 + ,13790 + ,243060 + ,58 + ,104 + ,32902 + ,162765 + ,68 + ,107 + ,25131 + ,182613 + ,81 + ,99 + ,30910 + ,232138 + ,131 + ,90 + ,35947 + ,265318 + ,110 + ,197 + ,29848 + ,85574 + ,37 + ,36 + ,6943 + ,310839 + ,130 + ,85 + ,42705 + ,225060 + ,93 + ,139 + ,31808 + ,232317 + ,118 + ,106 + ,26675 + ,144966 + ,39 + ,50 + ,8435 + ,43287 + ,13 + ,64 + ,7409 + ,155754 + ,74 + ,31 + ,14993 + ,164709 + ,81 + ,63 + ,36867 + ,201940 + ,109 + ,92 + ,33835 + ,235454 + ,151 + ,106 + ,24164 + ,220801 + ,51 + ,63 + ,12607 + ,99466 + ,28 + ,69 + ,22609 + ,92661 + ,40 + ,41 + ,5892 + ,133328 + ,56 + ,56 + ,17014 + ,61361 + ,27 + ,25 + ,5394 + ,125930 + ,37 + ,65 + ,9178 + ,100750 + ,83 + ,93 + ,6440 + ,224549 + ,54 + ,114 + ,21916 + ,82316 + ,27 + ,38 + ,4011 + ,102010 + ,28 + ,44 + ,5818 + ,101523 + ,59 + ,87 + ,18647 + ,243511 + ,133 + ,110 + ,20556 + ,22938 + ,12 + ,0 + ,238 + ,41566 + ,0 + ,27 + ,70 + ,152474 + ,106 + ,83 + ,22392 + ,61857 + ,23 + ,30 + ,3913 + ,99923 + ,44 + ,80 + ,12237 + ,132487 + ,71 + ,98 + ,8388 + ,317394 + ,116 + ,82 + ,22120 + ,21054 + ,4 + ,0 + ,338 + ,209641 + ,62 + ,60 + ,11727 + ,22648 + ,12 + ,28 + ,3704 + ,31414 + ,18 + ,9 + ,3988 + ,46698 + ,14 + ,33 + ,3030 + ,131698 + ,60 + ,59 + ,13520 + ,91735 + ,7 + ,49 + ,1421 + ,244749 + ,98 + ,115 + ,20923 + ,184510 + ,64 + ,140 + ,20237 + ,79863 + ,29 + ,49 + ,3219 + ,128423 + ,32 + ,120 + ,3769 + ,97839 + ,25 + ,66 + ,12252 + ,38214 + ,16 + ,21 + ,1888 + ,151101 + ,48 + ,124 + ,14497 + ,272458 + ,100 + ,152 + ,28864 + ,172494 + ,46 + ,139 + ,21721 + ,108043 + ,45 + ,38 + ,4821 + ,328107 + ,129 + ,144 + ,33644 + ,250579 + ,130 + ,120 + ,15923 + ,351067 + ,136 + ,160 + ,42935 + ,158015 + ,59 + ,114 + ,18864 + ,98866 + ,25 + ,39 + ,4977 + ,85439 + ,32 + ,78 + ,7785 + ,229242 + ,63 + ,119 + ,17939 + ,351619 + ,95 + ,141 + ,23436 + ,84207 + ,14 + ,101 + ,325 + ,120445 + ,36 + ,56 + ,13539 + ,324598 + ,113 + ,133 + ,34538 + ,131069 + ,47 + ,83 + ,12198 + ,204271 + ,92 + ,116 + ,26924 + ,165543 + ,70 + ,90 + ,12716 + ,141722 + ,19 + ,36 + ,8172 + ,116048 + ,50 + ,50 + ,10855 + ,250047 + ,41 + ,61 + ,11932 + ,299775 + ,91 + ,97 + ,14300 + ,195838 + ,111 + ,98 + ,25515 + ,173260 + ,41 + ,78 + ,2805 + ,254488 + ,120 + ,117 + ,29402 + ,104389 + ,135 + ,148 + ,16440 + ,136084 + ,27 + ,41 + ,11221 + ,199476 + ,87 + ,105 + ,28732 + ,92499 + ,25 + ,55 + ,5250 + ,224330 + ,131 + ,132 + ,28608 + ,135781 + ,45 + ,44 + ,8092 + ,74408 + ,29 + ,21 + ,4473 + ,81240 + ,58 + ,50 + ,1572 + ,14688 + ,4 + ,0 + ,2065 + ,181633 + ,47 + ,73 + ,14817 + ,271856 + ,109 + ,86 + ,16714 + ,7199 + ,7 + ,0 + ,556 + ,46660 + ,12 + ,13 + ,2089 + ,17547 + ,0 + ,4 + ,2658 + ,133368 + ,37 + ,57 + ,10695 + ,95227 + ,37 + ,48 + ,1669 + ,152601 + ,46 + ,46 + ,16267 + ,98146 + ,15 + ,48 + ,7768 + ,79619 + ,42 + ,32 + ,7252 + ,59194 + ,7 + ,68 + ,6387 + ,139942 + ,54 + ,87 + ,18715 + ,118612 + ,54 + ,43 + ,7936 + ,72880 + ,14 + ,67 + ,8643 + ,65475 + ,16 + ,46 + ,7294 + ,99643 + ,33 + ,46 + ,4570 + ,71965 + ,32 + ,56 + ,7185 + ,77272 + ,21 + ,48 + ,10058 + ,49289 + ,15 + ,44 + ,2342 + ,135131 + ,38 + ,60 + ,8509 + ,108446 + ,22 + ,65 + ,13275 + ,89746 + ,28 + ,55 + ,6816 + ,44296 + ,10 + ,38 + ,1930 + ,77648 + ,31 + ,52 + ,8086 + ,181528 + ,32 + ,60 + ,10737 + ,134019 + ,32 + ,54 + ,8033 + ,124064 + ,43 + ,86 + ,7058 + ,92630 + ,27 + ,24 + ,6782 + ,121848 + ,37 + ,52 + ,5401 + ,52915 + ,20 + ,49 + ,6521 + ,81872 + ,32 + ,61 + ,10856 + ,58981 + ,0 + ,61 + ,2154 + ,53515 + ,5 + ,81 + ,6117 + ,60812 + ,26 + ,43 + ,5238 + ,56375 + ,10 + ,40 + ,4820 + ,65490 + ,27 + ,40 + ,5615 + ,80949 + ,11 + ,56 + ,4272 + ,76302 + ,29 + ,68 + ,8702 + ,104011 + ,25 + ,79 + ,15340 + ,98104 + ,55 + ,47 + ,8030 + ,67989 + ,23 + ,57 + ,9526 + ,30989 + ,5 + ,41 + ,1278 + ,135458 + ,43 + ,29 + ,4236 + ,73504 + ,23 + ,3 + ,3023 + ,63123 + ,34 + ,60 + ,7196 + ,61254 + ,36 + ,30 + ,3394 + ,74914 + ,35 + ,79 + ,6371 + ,31774 + ,0 + ,47 + ,1574 + ,81437 + ,37 + ,40 + ,9620 + ,87186 + ,28 + ,48 + ,6978 + ,50090 + ,16 + ,36 + ,4911 + ,65745 + ,26 + ,42 + ,8645 + ,56653 + ,38 + ,49 + ,8987 + ,158399 + ,23 + ,57 + ,5544 + ,46455 + ,22 + ,12 + ,3083 + ,73624 + ,30 + ,40 + ,6909 + ,38395 + ,16 + ,43 + ,3189 + ,91899 + ,18 + ,33 + ,6745 + ,139526 + ,28 + ,77 + ,16724 + ,52164 + ,32 + ,43 + ,4850 + ,51567 + ,21 + ,45 + ,7025 + ,70551 + ,23 + ,47 + ,6047 + ,84856 + ,29 + ,43 + ,7377 + ,102538 + ,50 + ,45 + ,9078 + ,86678 + ,12 + ,50 + ,4605 + ,85709 + ,21 + ,35 + ,3238 + ,34662 + ,18 + ,7 + ,8100 + ,150580 + ,27 + ,71 + ,9653 + ,99611 + ,41 + ,67 + ,8914 + ,19349 + ,13 + ,0 + ,786 + ,99373 + ,12 + ,62 + ,6700 + ,86230 + ,21 + ,54 + ,5788 + ,30837 + ,8 + ,4 + ,593 + ,31706 + ,26 + ,25 + ,4506 + ,89806 + ,27 + ,40 + ,6382 + ,62088 + ,13 + ,38 + ,5621 + ,40151 + ,16 + ,19 + ,3997 + ,27634 + ,2 + ,17 + ,520 + ,76990 + ,42 + ,67 + ,8891 + ,37460 + ,5 + ,14 + ,999 + ,54157 + ,37 + ,30 + ,7067 + ,49862 + ,17 + ,54 + ,4639 + ,84337 + ,38 + ,35 + ,5654 + ,64175 + ,37 + ,59 + ,6928 + ,59382 + ,29 + ,24 + ,1514 + ,119308 + ,32 + ,58 + ,9238 + ,76702 + ,35 + ,42 + ,8204 + ,103425 + ,17 + ,46 + ,5926 + ,70344 + ,20 + ,61 + ,5785 + ,43410 + ,7 + ,3 + ,4 + ,104838 + ,46 + ,52 + ,5930 + ,62215 + ,24 + ,25 + ,3710 + ,69304 + ,40 + ,40 + ,705 + ,53117 + ,3 + ,32 + ,443 + ,19764 + ,10 + ,4 + ,2416 + ,86680 + ,37 + ,49 + ,7747 + ,84105 + ,17 + ,63 + ,5432 + ,77945 + ,28 + ,67 + ,4913 + ,89113 + ,19 + ,32 + ,2650 + ,91005 + ,29 + ,23 + ,2370 + ,40248 + ,8 + ,7 + ,775 + ,64187 + ,10 + ,54 + ,5576 + ,50857 + ,15 + ,37 + ,1352 + ,56613 + ,15 + ,35 + ,3080 + ,62792 + ,28 + ,51 + ,10205 + ,72535 + ,17 + ,39 + ,6095) + ,dim=c(4 + ,289) + ,dimnames=list(c('time_in_rfc' + ,'blogged_comp.' + ,'feedb.mess.long' + ,'tot.revisions') + ,1:289)) > y <- array(NA,dim=c(4,289),dimnames=list(c('time_in_rfc','blogged_comp.','feedb.mess.long','tot.revisions'),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 = '2' > par2 = 'none' > par1 = '3' > #'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] "feedb.mess.long" > x[,par1] [1] 94 103 93 103 51 70 91 22 38 93 60 123 148 90 124 70 168 115 [19] 71 66 134 117 108 84 156 120 114 94 120 81 110 133 122 158 109 124 [37] 39 92 126 0 70 37 38 120 93 95 77 90 80 31 110 66 138 133 [55] 113 100 7 140 61 41 96 164 78 49 102 124 99 129 62 73 114 99 [73] 70 104 116 91 74 138 67 151 72 120 115 105 104 108 98 69 111 99 [91] 71 27 69 107 73 107 93 129 69 118 73 119 104 107 99 90 197 36 [109] 85 139 106 50 64 31 63 92 106 63 69 41 56 25 65 93 114 38 [127] 44 87 110 0 27 83 30 80 98 82 0 60 28 9 33 59 49 115 [145] 140 49 120 66 21 124 152 139 38 144 120 160 114 39 78 119 141 101 [163] 56 133 83 116 90 36 50 61 97 98 78 117 148 41 105 55 132 44 [181] 21 50 0 73 86 0 13 4 57 48 46 48 32 68 87 43 67 46 [199] 46 56 48 44 60 65 55 38 52 60 54 86 24 52 49 61 61 81 [217] 43 40 40 56 68 79 47 57 41 29 3 60 30 79 47 40 48 36 [235] 42 49 57 12 40 43 33 77 43 45 47 43 45 50 35 7 71 67 [253] 0 62 54 4 25 40 38 19 17 67 14 30 54 35 59 24 58 42 [271] 46 61 3 52 25 40 32 4 49 63 67 32 23 7 54 37 35 51 [289] 39 > 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 3 4 7 9 12 13 14 17 19 21 22 23 24 25 27 28 29 30 31 6 2 3 3 1 1 1 1 1 1 2 1 1 2 3 2 1 1 3 2 32 33 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 3 2 3 3 2 6 3 6 4 2 5 3 2 4 3 4 6 4 2 3 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 4 2 4 3 1 2 5 5 2 3 1 2 3 5 2 4 4 3 1 4 74 77 78 79 80 81 82 83 84 85 86 87 90 91 92 93 94 95 96 97 1 2 3 2 2 2 1 2 1 1 2 2 4 2 2 5 2 1 1 1 98 99 100 101 102 103 104 105 106 107 108 109 110 111 113 114 115 116 117 118 3 4 1 1 1 2 3 2 2 3 2 1 3 1 1 4 3 2 2 1 119 120 122 123 124 126 129 132 133 134 138 139 140 141 144 148 151 152 156 158 2 6 1 1 4 1 2 1 3 1 2 2 2 1 1 2 1 1 1 1 160 164 168 197 1 1 1 1 > colnames(x) [1] "time_in_rfc" "blogged_comp." "feedb.mess.long" "tot.revisions" > colnames(x)[par1] [1] "feedb.mess.long" > x[,par1] [1] 94 103 93 103 51 70 91 22 38 93 60 123 148 90 124 70 168 115 [19] 71 66 134 117 108 84 156 120 114 94 120 81 110 133 122 158 109 124 [37] 39 92 126 0 70 37 38 120 93 95 77 90 80 31 110 66 138 133 [55] 113 100 7 140 61 41 96 164 78 49 102 124 99 129 62 73 114 99 [73] 70 104 116 91 74 138 67 151 72 120 115 105 104 108 98 69 111 99 [91] 71 27 69 107 73 107 93 129 69 118 73 119 104 107 99 90 197 36 [109] 85 139 106 50 64 31 63 92 106 63 69 41 56 25 65 93 114 38 [127] 44 87 110 0 27 83 30 80 98 82 0 60 28 9 33 59 49 115 [145] 140 49 120 66 21 124 152 139 38 144 120 160 114 39 78 119 141 101 [163] 56 133 83 116 90 36 50 61 97 98 78 117 148 41 105 55 132 44 [181] 21 50 0 73 86 0 13 4 57 48 46 48 32 68 87 43 67 46 [199] 46 56 48 44 60 65 55 38 52 60 54 86 24 52 49 61 61 81 [217] 43 40 40 56 68 79 47 57 41 29 3 60 30 79 47 40 48 36 [235] 42 49 57 12 40 43 33 77 43 45 47 43 45 50 35 7 71 67 [253] 0 62 54 4 25 40 38 19 17 67 14 30 54 35 59 24 58 42 [271] 46 61 3 52 25 40 32 4 49 63 67 32 23 7 54 37 35 51 [289] 39 > 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/1ogtk1324674048.tab") + } + } > m Conditional inference tree with 9 terminal nodes Response: feedb.mess.long Inputs: time_in_rfc, blogged_comp., tot.revisions Number of observations: 289 1) blogged_comp. <= 55; criterion = 1, statistic = 172.471 2) time_in_rfc <= 46698; criterion = 1, statistic = 74.675 3) time_in_rfc <= 30837; criterion = 0.985, statistic = 7.896 4)* weights = 12 3) time_in_rfc > 30837 5)* weights = 18 2) time_in_rfc > 46698 6) tot.revisions <= 8654; criterion = 1, statistic = 36.669 7) time_in_rfc <= 121848; criterion = 0.963, statistic = 6.257 8)* weights = 88 7) time_in_rfc > 121848 9)* weights = 14 6) tot.revisions > 8654 10) tot.revisions <= 13539; criterion = 0.994, statistic = 9.639 11)* weights = 32 10) tot.revisions > 13539 12)* weights = 12 1) blogged_comp. > 55 13) blogged_comp. <= 82; criterion = 1, statistic = 18.072 14) time_in_rfc <= 180083; criterion = 0.979, statistic = 7.294 15)* weights = 26 14) time_in_rfc > 180083 16)* weights = 23 13) blogged_comp. > 82 17)* weights = 64 > postscript(file="/var/wessaorg/rcomp/tmp/29non1324674048.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/34zse1324674048.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 94 106.130435 -12.1304348 2 103 82.461538 20.5384615 3 93 82.461538 10.5384615 4 103 117.359375 -14.3593750 5 51 63.428571 -12.4285714 6 70 64.656250 5.3437500 7 91 117.359375 -26.3593750 8 22 24.722222 -2.7222222 9 38 46.681818 -8.6818182 10 93 90.333333 2.6666667 11 60 82.461538 -22.4615385 12 123 106.130435 16.8695652 13 148 117.359375 30.6406250 14 90 64.656250 25.3437500 15 124 117.359375 6.6406250 16 70 82.461538 -12.4615385 17 168 117.359375 50.6406250 18 115 117.359375 -2.3593750 19 71 106.130435 -35.1304348 20 66 82.461538 -16.4615385 21 134 117.359375 16.6406250 22 117 117.359375 -0.3593750 23 108 106.130435 1.8695652 24 84 90.333333 -6.3333333 25 156 117.359375 38.6406250 26 120 117.359375 2.6406250 27 114 82.461538 31.5384615 28 94 106.130435 -12.1304348 29 120 117.359375 2.6406250 30 81 63.428571 17.5714286 31 110 117.359375 -7.3593750 32 133 117.359375 15.6406250 33 122 64.656250 57.3437500 34 158 117.359375 40.6406250 35 109 46.681818 62.3181818 36 124 117.359375 6.6406250 37 39 46.681818 -7.6818182 38 92 106.130435 -14.1304348 39 126 117.359375 8.6406250 40 0 5.333333 -5.3333333 41 70 82.461538 -12.4615385 42 37 64.656250 -27.6562500 43 38 46.681818 -8.6818182 44 120 117.359375 2.6406250 45 93 117.359375 -24.3593750 46 95 82.461538 12.5384615 47 77 82.461538 -5.4615385 48 90 82.461538 7.5384615 49 80 64.656250 15.3437500 50 31 46.681818 -15.6818182 51 110 106.130435 3.8695652 52 66 46.681818 19.3181818 53 138 117.359375 20.6406250 54 133 117.359375 15.6406250 55 113 117.359375 -4.3593750 56 100 82.461538 17.5384615 57 7 5.333333 1.6666667 58 140 106.130435 33.8695652 59 61 46.681818 14.3181818 60 41 46.681818 -5.6818182 61 96 106.130435 -10.1304348 62 164 117.359375 46.6406250 63 78 117.359375 -39.3593750 64 49 46.681818 2.3181818 65 102 117.359375 -15.3593750 66 124 117.359375 6.6406250 67 99 106.130435 -7.1304348 68 129 117.359375 11.6406250 69 62 117.359375 -55.3593750 70 73 64.656250 8.3437500 71 114 106.130435 7.8695652 72 99 90.333333 8.6666667 73 70 82.461538 -12.4615385 74 104 82.461538 21.5384615 75 116 106.130435 9.8695652 76 91 117.359375 -26.3593750 77 74 117.359375 -43.3593750 78 138 106.130435 31.8695652 79 67 46.681818 20.3181818 80 151 106.130435 44.8695652 81 72 82.461538 -10.4615385 82 120 117.359375 2.6406250 83 115 117.359375 -2.3593750 84 105 117.359375 -12.3593750 85 104 106.130435 -2.1304348 86 108 117.359375 -9.3593750 87 98 82.461538 15.5384615 88 69 64.656250 4.3437500 89 111 117.359375 -6.3593750 90 99 64.656250 34.3437500 91 71 117.359375 -46.3593750 92 27 46.681818 -19.6818182 93 69 63.428571 5.5714286 94 107 82.461538 24.5384615 95 73 46.681818 26.3181818 96 107 106.130435 0.8695652 97 93 106.130435 -13.1304348 98 129 117.359375 11.6406250 99 69 106.130435 -37.1304348 100 118 117.359375 0.6406250 101 73 63.428571 9.5714286 102 119 117.359375 1.6406250 103 104 106.130435 -2.1304348 104 107 82.461538 24.5384615 105 99 106.130435 -7.1304348 106 90 117.359375 -27.3593750 107 197 117.359375 79.6406250 108 36 46.681818 -10.6818182 109 85 117.359375 -32.3593750 110 139 117.359375 21.6406250 111 106 117.359375 -11.3593750 112 50 63.428571 -13.4285714 113 64 24.722222 39.2777778 114 31 82.461538 -51.4615385 115 63 82.461538 -19.4615385 116 92 117.359375 -25.3593750 117 106 117.359375 -11.3593750 118 63 64.656250 -1.6562500 119 69 90.333333 -21.3333333 120 41 46.681818 -5.6818182 121 56 82.461538 -26.4615385 122 25 46.681818 -21.6818182 123 65 64.656250 0.3437500 124 93 117.359375 -24.3593750 125 114 90.333333 23.6666667 126 38 46.681818 -8.6818182 127 44 46.681818 -2.6818182 128 87 82.461538 4.5384615 129 110 117.359375 -7.3593750 130 0 5.333333 -5.3333333 131 27 24.722222 2.2777778 132 83 117.359375 -34.3593750 133 30 46.681818 -16.6818182 134 80 64.656250 15.3437500 135 98 82.461538 15.5384615 136 82 117.359375 -35.3593750 137 0 5.333333 -5.3333333 138 60 106.130435 -46.1304348 139 28 5.333333 22.6666667 140 9 24.722222 -15.7222222 141 33 24.722222 8.2777778 142 59 82.461538 -23.4615385 143 49 46.681818 2.3181818 144 115 117.359375 -2.3593750 145 140 106.130435 33.8695652 146 49 46.681818 2.3181818 147 120 63.428571 56.5714286 148 66 64.656250 1.3437500 149 21 24.722222 -3.7222222 150 124 90.333333 33.6666667 151 152 117.359375 34.6406250 152 139 90.333333 48.6666667 153 38 46.681818 -8.6818182 154 144 117.359375 26.6406250 155 120 117.359375 2.6406250 156 160 117.359375 42.6406250 157 114 82.461538 31.5384615 158 39 46.681818 -7.6818182 159 78 46.681818 31.3181818 160 119 106.130435 12.8695652 161 141 117.359375 23.6406250 162 101 46.681818 54.3181818 163 56 64.656250 -8.6562500 164 133 117.359375 15.6406250 165 83 64.656250 18.3437500 166 116 117.359375 -1.3593750 167 90 82.461538 7.5384615 168 36 63.428571 -27.4285714 169 50 64.656250 -14.6562500 170 61 64.656250 -3.6562500 171 97 117.359375 -20.3593750 172 98 117.359375 -19.3593750 173 78 63.428571 14.5714286 174 117 117.359375 -0.3593750 175 148 117.359375 30.6406250 176 41 64.656250 -23.6562500 177 105 117.359375 -12.3593750 178 55 46.681818 8.3181818 179 132 117.359375 14.6406250 180 44 63.428571 -19.4285714 181 21 46.681818 -25.6818182 182 50 82.461538 -32.4615385 183 0 5.333333 -5.3333333 184 73 90.333333 -17.3333333 185 86 117.359375 -31.3593750 186 0 5.333333 -5.3333333 187 13 24.722222 -11.7222222 188 4 5.333333 -1.3333333 189 57 64.656250 -7.6562500 190 48 46.681818 1.3181818 191 46 90.333333 -44.3333333 192 48 46.681818 1.3181818 193 32 46.681818 -14.6818182 194 68 46.681818 21.3181818 195 87 90.333333 -3.3333333 196 43 46.681818 -3.6818182 197 67 46.681818 20.3181818 198 46 46.681818 -0.6818182 199 46 46.681818 -0.6818182 200 56 46.681818 9.3181818 201 48 64.656250 -16.6562500 202 44 46.681818 -2.6818182 203 60 63.428571 -3.4285714 204 65 64.656250 0.3437500 205 55 46.681818 8.3181818 206 38 24.722222 13.2777778 207 52 46.681818 5.3181818 208 60 64.656250 -4.6562500 209 54 63.428571 -9.4285714 210 86 63.428571 22.5714286 211 24 46.681818 -22.6818182 212 52 46.681818 5.3181818 213 49 46.681818 2.3181818 214 61 64.656250 -3.6562500 215 61 46.681818 14.3181818 216 81 46.681818 34.3181818 217 43 46.681818 -3.6818182 218 40 46.681818 -6.6818182 219 40 46.681818 -6.6818182 220 56 46.681818 9.3181818 221 68 64.656250 3.3437500 222 79 90.333333 -11.3333333 223 47 46.681818 0.3181818 224 57 64.656250 -7.6562500 225 41 24.722222 16.2777778 226 29 63.428571 -34.4285714 227 3 46.681818 -43.6818182 228 60 46.681818 13.3181818 229 30 46.681818 -16.6818182 230 79 46.681818 32.3181818 231 47 24.722222 22.2777778 232 40 64.656250 -24.6562500 233 48 46.681818 1.3181818 234 36 46.681818 -10.6818182 235 42 46.681818 -4.6818182 236 49 64.656250 -15.6562500 237 57 63.428571 -6.4285714 238 12 24.722222 -12.7222222 239 40 46.681818 -6.6818182 240 43 24.722222 18.2777778 241 33 46.681818 -13.6818182 242 77 90.333333 -13.3333333 243 43 46.681818 -3.6818182 244 45 46.681818 -1.6818182 245 47 46.681818 0.3181818 246 43 46.681818 -3.6818182 247 45 64.656250 -19.6562500 248 50 46.681818 3.3181818 249 35 46.681818 -11.6818182 250 7 24.722222 -17.7222222 251 71 64.656250 6.3437500 252 67 64.656250 2.3437500 253 0 5.333333 -5.3333333 254 62 46.681818 15.3181818 255 54 46.681818 7.3181818 256 4 5.333333 -1.3333333 257 25 24.722222 0.2777778 258 40 46.681818 -6.6818182 259 38 46.681818 -8.6818182 260 19 24.722222 -5.7222222 261 17 5.333333 11.6666667 262 67 64.656250 2.3437500 263 14 24.722222 -10.7222222 264 30 46.681818 -16.6818182 265 54 46.681818 7.3181818 266 35 46.681818 -11.6818182 267 59 46.681818 12.3181818 268 24 46.681818 -22.6818182 269 58 64.656250 -6.6562500 270 42 46.681818 -4.6818182 271 46 46.681818 -0.6818182 272 61 46.681818 14.3181818 273 3 24.722222 -21.7222222 274 52 46.681818 5.3181818 275 25 46.681818 -21.6818182 276 40 46.681818 -6.6818182 277 32 46.681818 -14.6818182 278 4 5.333333 -1.3333333 279 49 46.681818 2.3181818 280 63 46.681818 16.3181818 281 67 46.681818 20.3181818 282 32 46.681818 -14.6818182 283 23 46.681818 -23.6818182 284 7 24.722222 -17.7222222 285 54 46.681818 7.3181818 286 37 46.681818 -9.6818182 287 35 46.681818 -11.6818182 288 51 64.656250 -13.6562500 289 39 46.681818 -7.6818182 > 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/4idch1324674048.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/5a3kd1324674048.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/61lx01324674048.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/76ssv1324674048.tab") + } > > try(system("convert tmp/29non1324674048.ps tmp/29non1324674048.png",intern=TRUE)) character(0) > try(system("convert tmp/34zse1324674048.ps tmp/34zse1324674048.png",intern=TRUE)) character(0) > try(system("convert tmp/4idch1324674048.ps tmp/4idch1324674048.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.697 0.238 4.955