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(79 + ,94 + ,24188 + ,2 + ,58 + ,103 + ,18273 + ,NA + ,60 + ,93 + ,14130 + ,NA + ,108 + ,103 + ,32287 + ,4 + ,49 + ,51 + ,8654 + ,NA + ,0 + ,70 + ,9245 + ,NA + ,121 + ,91 + ,33251 + ,NA + ,1 + ,22 + ,1271 + ,NA + ,20 + ,38 + ,5279 + ,NA + ,43 + ,93 + ,27101 + ,0 + ,69 + ,60 + ,16373 + ,NA + ,78 + ,123 + ,19716 + ,0 + ,86 + ,148 + ,17753 + ,-4 + ,44 + ,90 + ,9028 + ,4 + ,104 + ,124 + ,18653 + ,4 + ,63 + ,70 + ,8828 + ,NA + ,158 + ,168 + ,29498 + ,0 + ,102 + ,115 + ,27563 + ,-1 + ,77 + ,71 + ,18293 + ,0 + ,82 + ,66 + ,22530 + ,NA + ,115 + ,134 + ,15977 + ,NA + ,101 + ,117 + ,35082 + ,NA + ,80 + ,108 + ,16116 + ,1 + ,50 + ,84 + ,15849 + ,NA + ,83 + ,156 + ,16026 + ,NA + ,123 + ,120 + ,26569 + ,0 + ,73 + ,114 + ,24785 + ,3 + ,81 + ,94 + ,17569 + ,NA + ,105 + ,120 + ,23825 + ,-1 + ,47 + ,81 + ,7869 + ,NA + ,105 + ,110 + ,14975 + ,NA + ,94 + ,133 + ,37791 + ,NA + ,44 + ,122 + ,9605 + ,NA + ,114 + ,158 + ,27295 + ,NA + ,38 + ,109 + ,2746 + ,NA + ,107 + ,124 + ,34461 + ,4 + ,30 + ,39 + ,8098 + ,NA + ,71 + ,92 + ,4787 + ,NA + ,84 + ,126 + ,24919 + ,3 + ,0 + ,0 + ,603 + ,NA + ,59 + ,70 + ,16329 + ,NA + ,33 + ,37 + ,12558 + ,1 + ,42 + ,38 + ,7784 + ,0 + ,96 + ,120 + ,28522 + ,-2 + ,106 + ,93 + ,22265 + ,-3 + ,56 + ,95 + ,14459 + ,-4 + ,57 + ,77 + ,14526 + ,NA + ,59 + ,90 + ,22240 + ,2 + ,39 + ,80 + ,11802 + ,NA + ,34 + ,31 + ,7623 + ,NA + ,76 + ,110 + ,11912 + ,2 + ,20 + ,66 + ,7935 + ,NA + ,91 + ,138 + ,18220 + ,-4 + ,115 + ,133 + ,19199 + ,3 + ,85 + ,113 + ,19918 + ,NA + ,76 + ,100 + ,21884 + ,NA + ,8 + ,7 + ,2694 + ,NA + ,79 + ,140 + ,15808 + ,NA + ,21 + ,61 + ,3597 + ,NA + ,30 + ,41 + ,5296 + ,NA + ,76 + ,96 + ,25239 + ,2 + ,101 + ,164 + ,29801 + ,2 + ,94 + ,78 + ,18450 + ,0 + ,27 + ,49 + ,7132 + ,NA + ,92 + ,102 + ,34861 + ,5 + ,123 + ,124 + ,35940 + ,NA + ,75 + ,99 + ,16688 + ,-2 + ,128 + ,129 + ,24683 + ,0 + ,105 + ,62 + ,46230 + ,NA + ,55 + ,73 + ,10387 + ,NA + ,56 + ,114 + ,21436 + ,-2 + ,41 + ,99 + ,30546 + ,-3 + ,72 + ,70 + ,19746 + ,NA + ,67 + ,104 + ,15977 + ,2 + ,75 + ,116 + ,22583 + ,NA + ,114 + ,91 + ,17274 + ,NA + ,118 + ,74 + ,16469 + ,NA + ,77 + ,138 + ,14251 + ,2 + ,22 + ,67 + ,3007 + ,NA + ,66 + ,151 + ,16851 + ,2 + ,69 + ,72 + ,21113 + ,0 + ,105 + ,120 + ,17401 + ,4 + ,116 + ,115 + ,23958 + ,4 + ,88 + ,105 + ,23567 + ,NA + ,73 + ,104 + ,13065 + ,NA + ,99 + ,108 + ,15358 + ,NA + ,62 + ,98 + ,14587 + ,2 + ,53 + ,69 + ,12770 + ,NA + ,118 + ,111 + ,24021 + ,NA + ,30 + ,99 + ,9648 + ,NA + ,100 + ,71 + ,20537 + ,2 + ,49 + ,27 + ,7905 + ,NA + ,24 + ,69 + ,4527 + ,NA + ,67 + ,107 + ,30495 + ,-4 + ,46 + ,73 + ,7117 + ,3 + ,57 + ,107 + ,17719 + ,NA + ,75 + ,93 + ,27056 + ,NA + ,135 + ,129 + ,33473 + ,3 + ,68 + ,69 + ,9758 + ,NA + ,124 + ,118 + ,21115 + ,2 + ,33 + ,73 + ,7236 + ,NA + ,98 + ,119 + ,13790 + ,NA + ,58 + ,104 + ,32902 + ,-1 + ,68 + ,107 + ,25131 + ,-3 + ,81 + ,99 + ,30910 + ,NA + ,131 + ,90 + ,35947 + ,NA + ,110 + ,197 + ,29848 + ,NA + ,37 + ,36 + ,6943 + ,0 + ,130 + ,85 + ,42705 + ,NA + ,93 + ,139 + ,31808 + ,1 + ,118 + ,106 + ,26675 + ,NA + ,39 + ,50 + ,8435 + ,NA + ,13 + ,64 + ,7409 + ,NA + ,74 + ,31 + ,14993 + ,NA + ,81 + ,63 + ,36867 + ,NA + ,109 + ,92 + ,33835 + ,NA + ,151 + ,106 + ,24164 + ,NA + ,51 + ,63 + ,12607 + ,NA + ,28 + ,69 + ,22609 + ,NA + ,40 + ,41 + ,5892 + ,NA + ,56 + ,56 + ,17014 + ,-3 + ,27 + ,25 + ,5394 + ,NA + ,37 + ,65 + ,9178 + ,NA + ,83 + ,93 + ,6440 + ,3 + ,54 + ,114 + ,21916 + ,NA + ,27 + ,38 + ,4011 + ,NA + ,28 + ,44 + ,5818 + ,NA + ,59 + ,87 + ,18647 + ,0 + ,133 + ,110 + ,20556 + ,0 + ,12 + ,0 + ,238 + ,NA + ,0 + ,27 + ,70 + ,NA + ,106 + ,83 + ,22392 + ,0 + ,23 + ,30 + ,3913 + ,NA + ,44 + ,80 + ,12237 + ,NA + ,71 + ,98 + ,8388 + ,3 + ,116 + ,82 + ,22120 + ,-3 + ,4 + ,0 + ,338 + ,NA + ,62 + ,60 + ,11727 + ,NA + ,12 + ,28 + ,3704 + ,NA + ,18 + ,9 + ,3988 + ,NA + ,14 + ,33 + ,3030 + ,NA + ,60 + ,59 + ,13520 + ,NA + ,7 + ,49 + ,1421 + ,NA + ,98 + ,115 + ,20923 + ,0 + ,64 + ,140 + ,20237 + ,-4 + ,29 + ,49 + ,3219 + ,NA + ,32 + ,120 + ,3769 + ,2 + ,25 + ,66 + ,12252 + ,-1 + ,16 + ,21 + ,1888 + ,NA + ,48 + ,124 + ,14497 + ,NA + ,100 + ,152 + ,28864 + ,NA + ,46 + ,139 + ,21721 + ,3 + ,45 + ,38 + ,4821 + ,NA + ,129 + ,144 + ,33644 + ,NA + ,130 + ,120 + ,15923 + ,NA + ,136 + ,160 + ,42935 + ,NA + ,59 + ,114 + ,18864 + ,NA + ,25 + ,39 + ,4977 + ,NA + ,32 + ,78 + ,7785 + ,NA + ,63 + ,119 + ,17939 + ,2 + ,95 + ,141 + ,23436 + ,5 + ,14 + ,101 + ,325 + ,NA + ,36 + ,56 + ,13539 + ,NA + ,113 + ,133 + ,34538 + ,2 + ,47 + ,83 + ,12198 + ,NA + ,92 + ,116 + ,26924 + ,NA + ,70 + ,90 + ,12716 + ,NA + ,19 + ,36 + ,8172 + ,NA + ,50 + ,50 + ,10855 + ,NA + ,41 + ,61 + ,11932 + ,NA + ,91 + ,97 + ,14300 + ,NA + ,111 + ,98 + ,25515 + ,-2 + ,41 + ,78 + ,2805 + ,NA + ,120 + ,117 + ,29402 + ,0 + ,135 + ,148 + ,16440 + ,NA + ,27 + ,41 + ,11221 + ,NA + ,87 + ,105 + ,28732 + ,3 + ,25 + ,55 + ,5250 + ,-2 + ,131 + ,132 + ,28608 + ,0 + ,45 + ,44 + ,8092 + ,NA + ,29 + ,21 + ,4473 + ,NA + ,58 + ,50 + ,1572 + ,NA + ,4 + ,0 + ,2065 + ,NA + ,47 + ,73 + ,14817 + ,6 + ,109 + ,86 + ,16714 + ,-3 + ,7 + ,0 + ,556 + ,NA + ,12 + ,13 + ,2089 + ,NA + ,0 + ,4 + ,2658 + ,NA + ,37 + ,57 + ,10695 + ,NA + ,37 + ,48 + ,1669 + ,3 + ,46 + ,46 + ,16267 + ,NA + ,15 + ,48 + ,7768 + ,0 + ,42 + ,32 + ,7252 + ,NA + ,7 + ,68 + ,6387 + ,NA + ,54 + ,87 + ,18715 + ,NA + ,54 + ,43 + ,7936 + ,-2 + ,14 + ,67 + ,8643 + ,NA + ,16 + ,46 + ,7294 + ,1 + ,33 + ,46 + ,4570 + ,NA + ,32 + ,56 + ,7185 + ,NA + ,21 + ,48 + ,10058 + ,NA + ,15 + ,44 + ,2342 + ,NA + ,38 + ,60 + ,8509 + ,NA + ,22 + ,65 + ,13275 + ,0 + ,28 + ,55 + ,6816 + ,NA + ,10 + ,38 + ,1930 + ,NA + ,31 + ,52 + ,8086 + ,NA + ,32 + ,60 + ,10737 + ,NA + ,32 + ,54 + ,8033 + ,NA + ,43 + ,86 + ,7058 + ,NA + ,27 + ,24 + ,6782 + ,NA + ,37 + ,52 + ,5401 + ,2 + ,20 + ,49 + ,6521 + ,NA + ,32 + ,61 + ,10856 + ,NA + ,0 + ,61 + ,2154 + ,NA + ,5 + ,81 + ,6117 + ,NA + ,26 + ,43 + ,5238 + ,NA + ,10 + ,40 + ,4820 + ,NA + ,27 + ,40 + ,5615 + ,NA + ,11 + ,56 + ,4272 + ,NA + ,29 + ,68 + ,8702 + ,2 + ,25 + ,79 + ,15340 + ,NA + ,55 + ,47 + ,8030 + ,-3 + ,23 + ,57 + ,9526 + ,NA + ,5 + ,41 + ,1278 + ,-2 + ,43 + ,29 + ,4236 + ,NA + ,23 + ,3 + ,3023 + ,NA + ,34 + ,60 + ,7196 + ,NA + ,36 + ,30 + ,3394 + ,NA + ,35 + ,79 + ,6371 + ,NA + ,0 + ,47 + ,1574 + ,1 + ,37 + ,40 + ,9620 + ,NA + ,28 + ,48 + ,6978 + ,NA + ,16 + ,36 + ,4911 + ,NA + ,26 + ,42 + ,8645 + ,NA + ,38 + ,49 + ,8987 + ,NA + ,23 + ,57 + ,5544 + ,NA + ,22 + ,12 + ,3083 + ,NA + ,30 + ,40 + ,6909 + ,NA + ,16 + ,43 + ,3189 + ,NA + ,18 + ,33 + ,6745 + ,NA + ,28 + ,77 + ,16724 + ,NA + ,32 + ,43 + ,4850 + ,NA + ,21 + ,45 + ,7025 + ,NA + ,23 + ,47 + ,6047 + ,NA + ,29 + ,43 + ,7377 + ,NA + ,50 + ,45 + ,9078 + ,NA + ,12 + ,50 + ,4605 + ,NA + ,21 + ,35 + ,3238 + ,NA + ,18 + ,7 + ,8100 + ,NA + ,27 + ,71 + ,9653 + ,-4 + ,41 + ,67 + ,8914 + ,NA + ,13 + ,0 + ,786 + ,NA + ,12 + ,62 + ,6700 + ,NA + ,21 + ,54 + ,5788 + ,NA + ,8 + ,4 + ,593 + ,NA + ,26 + ,25 + ,4506 + ,NA + ,27 + ,40 + ,6382 + ,NA + ,13 + ,38 + ,5621 + ,NA + ,16 + ,19 + ,3997 + ,NA + ,2 + ,17 + ,520 + ,NA + ,42 + ,67 + ,8891 + ,NA + ,5 + ,14 + ,999 + ,NA + ,37 + ,30 + ,7067 + ,0 + ,17 + ,54 + ,4639 + ,NA + ,38 + ,35 + ,5654 + ,NA + ,37 + ,59 + ,6928 + ,NA + ,29 + ,24 + ,1514 + ,1 + ,32 + ,58 + ,9238 + ,NA + ,35 + ,42 + ,8204 + ,NA + ,17 + ,46 + ,5926 + ,NA + ,20 + ,61 + ,5785 + ,NA + ,7 + ,3 + ,4 + ,NA + ,46 + ,52 + ,5930 + ,NA + ,24 + ,25 + ,3710 + ,NA + ,40 + ,40 + ,705 + ,NA + ,3 + ,32 + ,443 + ,NA + ,10 + ,4 + ,2416 + ,NA + ,37 + ,49 + ,7747 + ,NA + ,17 + ,63 + ,5432 + ,0 + ,28 + ,67 + ,4913 + ,NA + ,19 + ,32 + ,2650 + ,NA + ,29 + ,23 + ,2370 + ,NA + ,8 + ,7 + ,775 + ,NA + ,10 + ,54 + ,5576 + ,NA + ,15 + ,37 + ,1352 + ,NA + ,15 + ,35 + ,3080 + ,NA + ,28 + ,51 + ,10205 + ,NA + ,17 + ,39 + ,6095 + ,NA) + ,dim=c(4 + ,289) + ,dimnames=list(c('blogged_comp.' + ,'feedb.mess.long' + ,'tot.revisions' + ,'Result_test ') + ,1:289)) > y <- array(NA,dim=c(4,289),dimnames=list(c('blogged_comp.','feedb.mess.long','tot.revisions','Result_test '),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 = 'quantiles' > par1 = '2' > 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, 67) [67,197] 145 144 > colnames(x) [1] "blogged_comp." "feedb.mess.long" "tot.revisions" "Result_test." > colnames(x)[par1] [1] "feedb.mess.long" > x[,par1] [1] [67,197] [67,197] [67,197] [67,197] [ 0, 67) [67,197] [67,197] [ 0, 67) [9] [ 0, 67) [67,197] [ 0, 67) [67,197] [67,197] [67,197] [67,197] [67,197] [17] [67,197] [67,197] [67,197] [ 0, 67) [67,197] [67,197] [67,197] [67,197] [25] [67,197] [67,197] [67,197] [67,197] [67,197] [67,197] [67,197] [67,197] [33] [67,197] [67,197] [67,197] [67,197] [ 0, 67) [67,197] [67,197] [ 0, 67) [41] [67,197] [ 0, 67) [ 0, 67) [67,197] [67,197] [67,197] [67,197] [67,197] [49] [67,197] [ 0, 67) [67,197] [ 0, 67) [67,197] [67,197] [67,197] [67,197] [57] [ 0, 67) [67,197] [ 0, 67) [ 0, 67) [67,197] [67,197] [67,197] [ 0, 67) [65] [67,197] [67,197] [67,197] [67,197] [ 0, 67) [67,197] [67,197] [67,197] [73] [67,197] [67,197] [67,197] [67,197] [67,197] [67,197] [67,197] [67,197] [81] [67,197] [67,197] [67,197] [67,197] [67,197] [67,197] [67,197] [67,197] [89] [67,197] [67,197] [67,197] [ 0, 67) [67,197] [67,197] [67,197] [67,197] [97] [67,197] [67,197] [67,197] [67,197] [67,197] [67,197] [67,197] [67,197] [105] [67,197] [67,197] [67,197] [ 0, 67) [67,197] [67,197] [67,197] [ 0, 67) [113] [ 0, 67) [ 0, 67) [ 0, 67) [67,197] [67,197] [ 0, 67) [67,197] [ 0, 67) [121] [ 0, 67) [ 0, 67) [ 0, 67) [67,197] [67,197] [ 0, 67) [ 0, 67) [67,197] [129] [67,197] [ 0, 67) [ 0, 67) [67,197] [ 0, 67) [67,197] [67,197] [67,197] [137] [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [67,197] [145] [67,197] [ 0, 67) [67,197] [ 0, 67) [ 0, 67) [67,197] [67,197] [67,197] [153] [ 0, 67) [67,197] [67,197] [67,197] [67,197] [ 0, 67) [67,197] [67,197] [161] [67,197] [67,197] [ 0, 67) [67,197] [67,197] [67,197] [67,197] [ 0, 67) [169] [ 0, 67) [ 0, 67) [67,197] [67,197] [67,197] [67,197] [67,197] [ 0, 67) [177] [67,197] [ 0, 67) [67,197] [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [67,197] [185] [67,197] [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [193] [ 0, 67) [67,197] [67,197] [ 0, 67) [67,197] [ 0, 67) [ 0, 67) [ 0, 67) [201] [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [209] [ 0, 67) [67,197] [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [67,197] [217] [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [67,197] [67,197] [ 0, 67) [ 0, 67) [225] [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [67,197] [ 0, 67) [ 0, 67) [233] [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [241] [ 0, 67) [67,197] [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [249] [ 0, 67) [ 0, 67) [67,197] [67,197] [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [257] [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [67,197] [ 0, 67) [ 0, 67) [265] [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [273] [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [281] [67,197] [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [ 0, 67) [289] [ 0, 67) Levels: [ 0, 67) [67,197] > 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/1a7sk1324660599.tab") + } + } > m Conditional inference tree with 5 terminal nodes Response: as.factor(feedb.mess.long) Inputs: blogged_comp., tot.revisions, Result_test. Number of observations: 289 1) blogged_comp. <= 40; criterion = 1, statistic = 132.488 2) tot.revisions <= 8509; criterion = 0.998, statistic = 11.405 3)* weights = 116 2) tot.revisions > 8509 4)* weights = 25 1) blogged_comp. > 40 5) blogged_comp. <= 62; criterion = 1, statistic = 20.818 6) tot.revisions <= 13520; criterion = 0.997, statistic = 10.823 7)* weights = 29 6) tot.revisions > 13520 8)* weights = 22 5) blogged_comp. > 62 9)* weights = 97 > postscript(file="/var/wessaorg/rcomp/tmp/2klvn1324660599.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/3fynl1324660599.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,] 2 2 [2,] 2 2 [3,] 2 2 [4,] 2 2 [5,] 1 1 [6,] 2 1 [7,] 2 2 [8,] 1 1 [9,] 1 1 [10,] 2 2 [11,] 1 2 [12,] 2 2 [13,] 2 2 [14,] 2 1 [15,] 2 2 [16,] 2 2 [17,] 2 2 [18,] 2 2 [19,] 2 2 [20,] 1 2 [21,] 2 2 [22,] 2 2 [23,] 2 2 [24,] 2 2 [25,] 2 2 [26,] 2 2 [27,] 2 2 [28,] 2 2 [29,] 2 2 [30,] 2 1 [31,] 2 2 [32,] 2 2 [33,] 2 1 [34,] 2 2 [35,] 2 1 [36,] 2 2 [37,] 1 1 [38,] 2 2 [39,] 2 2 [40,] 1 1 [41,] 2 2 [42,] 1 1 [43,] 1 1 [44,] 2 2 [45,] 2 2 [46,] 2 2 [47,] 2 2 [48,] 2 2 [49,] 2 1 [50,] 1 1 [51,] 2 2 [52,] 1 1 [53,] 2 2 [54,] 2 2 [55,] 2 2 [56,] 2 2 [57,] 1 1 [58,] 2 2 [59,] 1 1 [60,] 1 1 [61,] 2 2 [62,] 2 2 [63,] 2 2 [64,] 1 1 [65,] 2 2 [66,] 2 2 [67,] 2 2 [68,] 2 2 [69,] 1 2 [70,] 2 1 [71,] 2 2 [72,] 2 2 [73,] 2 2 [74,] 2 2 [75,] 2 2 [76,] 2 2 [77,] 2 2 [78,] 2 2 [79,] 2 1 [80,] 2 2 [81,] 2 2 [82,] 2 2 [83,] 2 2 [84,] 2 2 [85,] 2 2 [86,] 2 2 [87,] 2 2 [88,] 2 1 [89,] 2 2 [90,] 2 1 [91,] 2 2 [92,] 1 1 [93,] 2 1 [94,] 2 2 [95,] 2 1 [96,] 2 2 [97,] 2 2 [98,] 2 2 [99,] 2 2 [100,] 2 2 [101,] 2 1 [102,] 2 2 [103,] 2 2 [104,] 2 2 [105,] 2 2 [106,] 2 2 [107,] 2 2 [108,] 1 1 [109,] 2 2 [110,] 2 2 [111,] 2 2 [112,] 1 1 [113,] 1 1 [114,] 1 2 [115,] 1 2 [116,] 2 2 [117,] 2 2 [118,] 1 1 [119,] 2 1 [120,] 1 1 [121,] 1 2 [122,] 1 1 [123,] 1 1 [124,] 2 2 [125,] 2 2 [126,] 1 1 [127,] 1 1 [128,] 2 2 [129,] 2 2 [130,] 1 1 [131,] 1 1 [132,] 2 2 [133,] 1 1 [134,] 2 1 [135,] 2 2 [136,] 2 2 [137,] 1 1 [138,] 1 1 [139,] 1 1 [140,] 1 1 [141,] 1 1 [142,] 1 1 [143,] 1 1 [144,] 2 2 [145,] 2 2 [146,] 1 1 [147,] 2 1 [148,] 1 1 [149,] 1 1 [150,] 2 2 [151,] 2 2 [152,] 2 2 [153,] 1 1 [154,] 2 2 [155,] 2 2 [156,] 2 2 [157,] 2 2 [158,] 1 1 [159,] 2 1 [160,] 2 2 [161,] 2 2 [162,] 2 1 [163,] 1 1 [164,] 2 2 [165,] 2 1 [166,] 2 2 [167,] 2 2 [168,] 1 1 [169,] 1 1 [170,] 1 1 [171,] 2 2 [172,] 2 2 [173,] 2 1 [174,] 2 2 [175,] 2 2 [176,] 1 1 [177,] 2 2 [178,] 1 1 [179,] 2 2 [180,] 1 1 [181,] 1 1 [182,] 1 1 [183,] 1 1 [184,] 2 2 [185,] 2 2 [186,] 1 1 [187,] 1 1 [188,] 1 1 [189,] 1 1 [190,] 1 1 [191,] 1 2 [192,] 1 1 [193,] 1 1 [194,] 2 1 [195,] 2 2 [196,] 1 1 [197,] 2 1 [198,] 1 1 [199,] 1 1 [200,] 1 1 [201,] 1 1 [202,] 1 1 [203,] 1 1 [204,] 1 1 [205,] 1 1 [206,] 1 1 [207,] 1 1 [208,] 1 1 [209,] 1 1 [210,] 2 1 [211,] 1 1 [212,] 1 1 [213,] 1 1 [214,] 1 1 [215,] 1 1 [216,] 2 1 [217,] 1 1 [218,] 1 1 [219,] 1 1 [220,] 1 1 [221,] 2 1 [222,] 2 1 [223,] 1 1 [224,] 1 1 [225,] 1 1 [226,] 1 1 [227,] 1 1 [228,] 1 1 [229,] 1 1 [230,] 2 1 [231,] 1 1 [232,] 1 1 [233,] 1 1 [234,] 1 1 [235,] 1 1 [236,] 1 1 [237,] 1 1 [238,] 1 1 [239,] 1 1 [240,] 1 1 [241,] 1 1 [242,] 2 1 [243,] 1 1 [244,] 1 1 [245,] 1 1 [246,] 1 1 [247,] 1 1 [248,] 1 1 [249,] 1 1 [250,] 1 1 [251,] 2 1 [252,] 2 1 [253,] 1 1 [254,] 1 1 [255,] 1 1 [256,] 1 1 [257,] 1 1 [258,] 1 1 [259,] 1 1 [260,] 1 1 [261,] 1 1 [262,] 2 1 [263,] 1 1 [264,] 1 1 [265,] 1 1 [266,] 1 1 [267,] 1 1 [268,] 1 1 [269,] 1 1 [270,] 1 1 [271,] 1 1 [272,] 1 1 [273,] 1 1 [274,] 1 1 [275,] 1 1 [276,] 1 1 [277,] 1 1 [278,] 1 1 [279,] 1 1 [280,] 1 1 [281,] 2 1 [282,] 1 1 [283,] 1 1 [284,] 1 1 [285,] 1 1 [286,] 1 1 [287,] 1 1 [288,] 1 1 [289,] 1 1 [ 0, 67) [67,197] [ 0, 67) 138 7 [67,197] 32 112 > postscript(file="/var/wessaorg/rcomp/tmp/4oqew1324660599.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/5gih51324660599.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/622lt1324660599.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/7ejg21324660599.tab") + } > > try(system("convert tmp/2klvn1324660599.ps tmp/2klvn1324660599.png",intern=TRUE)) character(0) > try(system("convert tmp/3fynl1324660599.ps tmp/3fynl1324660599.png",intern=TRUE)) character(0) > try(system("convert tmp/4oqew1324660599.ps tmp/4oqew1324660599.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.861 0.281 3.134