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(140824 + ,95 + ,3 + ,96 + ,42 + ,130 + ,186099 + ,110459 + ,68 + ,4 + ,75 + ,38 + ,143 + ,113854 + ,105079 + ,64 + ,16 + ,70 + ,46 + ,118 + ,99776 + ,112098 + ,139 + ,2 + ,134 + ,42 + ,146 + ,106194 + ,43929 + ,51 + ,1 + ,83 + ,30 + ,73 + ,100792 + ,76173 + ,46 + ,3 + ,8 + ,35 + ,89 + ,47552 + ,187326 + ,118 + ,0 + ,173 + ,40 + ,146 + ,250931 + ,22807 + ,46 + ,0 + ,1 + ,18 + ,22 + ,6853 + ,144408 + ,79 + ,7 + ,88 + ,38 + ,132 + ,115466 + ,66485 + ,76 + ,0 + ,104 + ,37 + ,92 + ,110896 + ,79089 + ,82 + ,0 + ,114 + ,46 + ,147 + ,169351 + ,81625 + ,66 + ,7 + ,125 + ,60 + ,203 + ,94853 + ,68788 + ,60 + ,10 + ,57 + ,37 + ,113 + ,72591 + ,103297 + ,117 + ,4 + ,139 + ,55 + ,171 + ,101345 + ,69446 + ,50 + ,10 + ,87 + ,44 + ,87 + ,113713 + ,114948 + ,133 + ,0 + ,176 + ,63 + ,208 + ,165354 + ,167949 + ,63 + ,8 + ,114 + ,40 + ,153 + ,164263 + ,125081 + ,100 + ,4 + ,121 + ,43 + ,97 + ,135213 + ,125818 + ,44 + ,3 + ,103 + ,32 + ,95 + ,111669 + ,136588 + ,65 + ,8 + ,135 + ,52 + ,197 + ,134163 + ,112431 + ,103 + ,0 + ,123 + ,49 + ,160 + ,140303 + ,103037 + ,103 + ,1 + ,99 + ,41 + ,148 + ,150773 + ,82317 + ,62 + ,5 + ,77 + ,25 + ,84 + ,111848 + ,118906 + ,70 + ,9 + ,103 + ,57 + ,227 + ,102509 + ,83515 + ,159 + ,1 + ,158 + ,45 + ,154 + ,96785 + ,104581 + ,78 + ,0 + ,116 + ,42 + ,151 + ,116136 + ,103129 + ,101 + ,5 + ,114 + ,45 + ,142 + ,158376 + ,83243 + ,73 + ,0 + ,150 + ,43 + ,148 + ,153990 + ,37110 + ,58 + ,0 + ,64 + ,36 + ,110 + ,64057 + ,113344 + ,147 + ,0 + ,150 + ,45 + ,149 + ,230054 + ,139165 + ,54 + ,3 + ,143 + ,50 + ,179 + ,184531 + ,86652 + ,84 + ,6 + ,50 + ,50 + ,149 + ,114198 + ,112302 + ,56 + ,1 + ,145 + ,51 + ,187 + ,198299 + ,69652 + ,45 + ,4 + ,56 + ,42 + ,153 + ,33750 + ,119442 + ,87 + ,4 + ,141 + ,44 + ,163 + ,189723 + ,69867 + ,87 + ,0 + ,83 + ,42 + ,127 + ,100826 + ,101629 + ,77 + ,0 + ,112 + ,44 + ,151 + ,188355 + ,70168 + ,72 + ,2 + ,79 + ,40 + ,100 + ,104470 + ,31081 + ,36 + ,1 + ,33 + ,17 + ,46 + ,58391 + ,103925 + ,51 + ,2 + ,152 + ,43 + ,156 + ,164808 + ,92622 + ,44 + ,10 + ,126 + ,41 + ,128 + ,134097 + ,79011 + ,75 + ,10 + ,97 + ,41 + ,111 + ,80238 + ,93487 + ,87 + ,5 + ,84 + ,40 + ,119 + ,133252 + ,64520 + ,97 + ,6 + ,68 + ,49 + ,148 + ,54518 + ,93473 + ,90 + ,1 + ,50 + ,52 + ,65 + ,121850 + ,114360 + ,860 + ,2 + ,101 + ,42 + ,134 + ,79367 + ,33032 + ,57 + ,2 + ,20 + ,26 + ,66 + ,56968 + ,96125 + ,99 + ,1 + ,107 + ,59 + ,201 + ,106314 + ,151911 + ,120 + ,10 + ,150 + ,50 + ,177 + ,191889 + ,89256 + ,76 + ,3 + ,129 + ,50 + ,156 + ,104864 + ,95676 + ,56 + ,0 + ,99 + ,47 + ,158 + ,160792 + ,5950 + ,20 + ,0 + ,8 + ,4 + ,7 + ,15049 + ,149695 + ,94 + ,8 + ,88 + ,51 + ,175 + ,191179 + ,32551 + ,21 + ,5 + ,21 + ,18 + ,61 + ,25109 + ,31701 + ,70 + ,3 + ,30 + ,14 + ,41 + ,45824 + ,100087 + ,133 + ,1 + ,102 + ,41 + ,133 + ,129711 + ,169707 + ,86 + ,5 + ,166 + ,61 + ,228 + ,210012 + ,150491 + ,224 + ,6 + ,132 + ,40 + ,140 + ,194679 + ,120192 + ,65 + ,0 + ,161 + ,44 + ,155 + ,197680 + ,95893 + ,86 + ,12 + ,90 + ,40 + ,141 + ,81180 + ,151715 + ,70 + ,10 + ,160 + ,51 + ,181 + ,197765 + ,176225 + ,148 + ,12 + ,139 + ,29 + ,75 + ,214738 + ,59900 + ,72 + ,11 + ,104 + ,43 + ,97 + ,96252 + ,104767 + ,59 + ,8 + ,103 + ,42 + ,142 + ,124527 + ,114799 + ,67 + ,3 + ,66 + ,41 + ,136 + ,153242 + ,72128 + ,58 + ,0 + ,163 + ,30 + ,87 + ,145707 + ,143592 + ,60 + ,6 + ,93 + ,39 + ,140 + ,113963 + ,89626 + ,105 + ,10 + ,85 + ,51 + ,169 + ,134904 + ,131072 + ,84 + ,2 + ,154 + ,40 + ,129 + ,114268 + ,126817 + ,63 + ,5 + ,143 + ,29 + ,92 + ,94333 + ,81351 + ,67 + ,13 + ,107 + ,47 + ,160 + ,102204 + ,22618 + ,39 + ,6 + ,22 + ,23 + ,67 + ,23824 + ,88977 + ,60 + ,7 + ,85 + ,48 + ,179 + ,111563 + ,92059 + ,94 + ,2 + ,101 + ,38 + ,90 + ,91313 + ,81897 + ,67 + ,5 + ,131 + ,42 + ,144 + ,89770 + ,108146 + ,96 + ,4 + ,140 + ,46 + ,144 + ,100125 + ,126372 + ,54 + ,3 + ,156 + ,40 + ,144 + ,165278 + ,249771 + ,54 + ,6 + ,81 + ,45 + ,134 + ,181712 + ,71154 + ,62 + ,2 + ,137 + ,42 + ,146 + ,80906 + ,71571 + ,71 + ,0 + ,102 + ,41 + ,121 + ,75881 + ,55918 + ,50 + ,1 + ,74 + ,37 + ,112 + ,83963 + ,160141 + ,117 + ,1 + ,161 + ,47 + ,145 + ,175721 + ,38692 + ,45 + ,5 + ,30 + ,26 + ,99 + ,68580 + ,102812 + ,61 + ,2 + ,120 + ,48 + ,96 + ,136323 + ,56622 + ,31 + ,0 + ,49 + ,8 + ,27 + ,55792 + ,15986 + ,175 + ,0 + ,121 + ,27 + ,77 + ,25157 + ,123534 + ,70 + ,6 + ,76 + ,38 + ,137 + ,100922 + ,108535 + ,284 + ,1 + ,85 + ,41 + ,151 + ,118845 + ,93879 + ,95 + ,4 + ,151 + ,61 + ,126 + ,170492 + ,144551 + ,72 + ,1 + ,165 + ,45 + ,159 + ,81716 + ,56750 + ,63 + ,1 + ,89 + ,41 + ,101 + ,115750 + ,127654 + ,75 + ,3 + ,168 + ,42 + ,144 + ,105590 + ,65594 + ,90 + ,10 + ,48 + ,35 + ,102 + ,92795 + ,59938 + ,89 + ,1 + ,149 + ,36 + ,135 + ,82390 + ,146975 + ,138 + ,4 + ,75 + ,40 + ,147 + ,135599 + ,165904 + ,68 + ,5 + ,107 + ,40 + ,155 + ,127667 + ,169265 + ,80 + ,7 + ,116 + ,38 + ,138 + ,163073 + ,183500 + ,65 + ,0 + ,181 + ,43 + ,113 + ,211381 + ,165986 + ,130 + ,12 + ,155 + ,65 + ,248 + ,189944 + ,184923 + ,85 + ,13 + ,165 + ,33 + ,116 + ,226168 + ,140358 + ,83 + ,9 + ,121 + ,51 + ,176 + ,117495 + ,149959 + ,89 + ,0 + ,176 + ,45 + ,140 + ,195894 + ,57224 + ,116 + ,0 + ,86 + ,36 + ,59 + ,80684 + ,43750 + ,43 + ,4 + ,13 + ,19 + ,64 + ,19630 + ,48029 + ,87 + ,4 + ,120 + ,25 + ,40 + ,88634 + ,104978 + ,80 + ,0 + ,117 + ,44 + ,98 + ,139292 + ,100046 + ,132 + ,0 + ,133 + ,45 + ,139 + ,128602 + ,101047 + ,59 + ,0 + ,169 + ,44 + ,135 + ,135848 + ,197426 + ,50 + ,0 + ,39 + ,35 + ,97 + ,178377 + ,160902 + ,87 + ,0 + ,125 + ,46 + ,142 + ,106330 + ,147172 + ,62 + ,5 + ,82 + ,44 + ,155 + ,178303 + ,109432 + ,70 + ,1 + ,148 + ,45 + ,115 + ,116938 + ,1168 + ,9 + ,0 + ,12 + ,1 + ,0 + ,5841 + ,83248 + ,54 + ,0 + ,146 + ,40 + ,103 + ,106020 + ,25162 + ,25 + ,4 + ,23 + ,11 + ,30 + ,24610 + ,45724 + ,113 + ,0 + ,87 + ,51 + ,130 + ,74151 + ,110529 + ,63 + ,1 + ,164 + ,38 + ,102 + ,232241 + ,855 + ,2 + ,0 + ,4 + ,0 + ,0 + ,6622 + ,101382 + ,67 + ,5 + ,81 + ,30 + ,77 + ,127097 + ,14116 + ,22 + ,0 + ,18 + ,8 + ,9 + ,13155 + ,89506 + ,157 + ,3 + ,118 + ,43 + ,150 + ,160501 + ,135356 + ,79 + ,7 + ,76 + ,48 + ,163 + ,91502 + ,116066 + ,113 + ,14 + ,55 + ,49 + ,148 + ,24469 + ,144244 + ,50 + ,3 + ,62 + ,32 + ,94 + ,88229 + ,8773 + ,52 + ,0 + ,16 + ,8 + ,21 + ,13983 + ,102153 + ,113 + ,3 + ,98 + ,43 + ,151 + ,80716 + ,117440 + ,115 + ,0 + ,137 + ,52 + ,187 + ,157384 + ,104128 + ,78 + ,0 + ,50 + ,53 + ,171 + ,122975 + ,134238 + ,135 + ,4 + ,152 + ,49 + ,170 + ,191469 + ,134047 + ,120 + ,0 + ,163 + ,48 + ,145 + ,231257 + ,279488 + ,122 + ,3 + ,142 + ,56 + ,198 + ,258287 + ,79756 + ,54 + ,0 + ,80 + ,45 + ,152 + ,122531 + ,66089 + ,63 + ,0 + ,59 + ,40 + ,112 + ,61394 + ,102070 + ,162 + ,4 + ,94 + ,48 + ,173 + ,86480 + ,146760 + ,162 + ,5 + ,128 + ,50 + ,177 + ,195791 + ,154771 + ,107 + ,16 + ,63 + ,43 + ,153 + ,18284 + ,165933 + ,146 + ,6 + ,127 + ,46 + ,161 + ,147581 + ,64593 + ,77 + ,5 + ,60 + ,40 + ,115 + ,72558 + ,92280 + ,87 + ,2 + ,118 + ,45 + ,147 + ,147341 + ,67150 + ,192 + ,1 + ,110 + ,46 + ,124 + ,114651 + ,128692 + ,75 + ,2 + ,46 + ,37 + ,57 + ,100187 + ,124089 + ,131 + ,9 + ,96 + ,45 + ,144 + ,130332 + ,125386 + ,67 + ,1 + ,128 + ,39 + ,126 + ,134218 + ,37238 + ,37 + ,3 + ,41 + ,21 + ,78 + ,10901 + ,140015 + ,61 + ,11 + ,146 + ,50 + ,153 + ,145758 + ,150047 + ,127 + ,5 + ,147 + ,55 + ,196 + ,75767 + ,154451 + ,58 + ,2 + ,121 + ,40 + ,130 + ,134969 + ,156349 + ,71 + ,1 + ,185 + ,48 + ,159 + ,169216 + ,0 + ,0 + ,9 + ,0 + ,0 + ,0 + ,0 + ,6023 + ,0 + ,0 + ,4 + ,0 + ,0 + ,7953 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,84601 + ,72 + ,2 + ,85 + ,46 + ,94 + ,105406 + ,68946 + ,123 + ,3 + ,164 + ,52 + ,129 + ,174586 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1644 + ,0 + ,0 + ,7 + ,0 + ,0 + ,4245 + ,6179 + ,7 + ,0 + ,12 + ,5 + ,13 + ,21509 + ,3926 + ,3 + ,0 + ,0 + ,1 + ,4 + ,7670 + ,52789 + ,106 + ,0 + ,37 + ,48 + ,89 + ,15673 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,100350 + ,53 + ,2 + ,62 + ,34 + ,71 + ,75882) + ,dim=c(7 + ,164) + ,dimnames=list(c('TotalSize' + ,'#CompViews(PR)' + ,'#SharedComp' + ,'#BloggedComputations' + ,'#LongPR' + ,'#Reviews' + ,'#SecinComp') + ,1:164)) > y <- array(NA,dim=c(7,164),dimnames=list(c('TotalSize','#CompViews(PR)','#SharedComp','#BloggedComputations','#LongPR','#Reviews','#SecinComp'),1:164)) > 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 = '1' > 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] "TotalSize" > x[,par1] [1] 140824 110459 105079 112098 43929 76173 187326 22807 144408 66485 [11] 79089 81625 68788 103297 69446 114948 167949 125081 125818 136588 [21] 112431 103037 82317 118906 83515 104581 103129 83243 37110 113344 [31] 139165 86652 112302 69652 119442 69867 101629 70168 31081 103925 [41] 92622 79011 93487 64520 93473 114360 33032 96125 151911 89256 [51] 95676 5950 149695 32551 31701 100087 169707 150491 120192 95893 [61] 151715 176225 59900 104767 114799 72128 143592 89626 131072 126817 [71] 81351 22618 88977 92059 81897 108146 126372 249771 71154 71571 [81] 55918 160141 38692 102812 56622 15986 123534 108535 93879 144551 [91] 56750 127654 65594 59938 146975 165904 169265 183500 165986 184923 [101] 140358 149959 57224 43750 48029 104978 100046 101047 197426 160902 [111] 147172 109432 1168 83248 25162 45724 110529 855 101382 14116 [121] 89506 135356 116066 144244 8773 102153 117440 104128 134238 134047 [131] 279488 79756 66089 102070 146760 154771 165933 64593 92280 67150 [141] 128692 124089 125386 37238 140015 150047 154451 156349 0 6023 [151] 0 0 0 0 84601 68946 0 0 1644 6179 [161] 3926 52789 0 100350 > 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]) [0e+00,100350) [1e+05,279488] 82 82 > colnames(x) [1] "TotalSize" "X.CompViews.PR." "X.SharedComp" [4] "X.BloggedComputations" "X.LongPR" "X.Reviews" [7] "X.SecinComp" > colnames(x)[par1] [1] "TotalSize" > x[,par1] [1] [1e+05,279488] [1e+05,279488] [1e+05,279488] [1e+05,279488] [0e+00,100350) [6] [0e+00,100350) [1e+05,279488] [0e+00,100350) [1e+05,279488] [0e+00,100350) [11] [0e+00,100350) [0e+00,100350) [0e+00,100350) [1e+05,279488] [0e+00,100350) [16] [1e+05,279488] [1e+05,279488] [1e+05,279488] [1e+05,279488] [1e+05,279488] [21] [1e+05,279488] [1e+05,279488] [0e+00,100350) [1e+05,279488] [0e+00,100350) [26] [1e+05,279488] [1e+05,279488] [0e+00,100350) [0e+00,100350) [1e+05,279488] [31] [1e+05,279488] [0e+00,100350) [1e+05,279488] [0e+00,100350) [1e+05,279488] [36] [0e+00,100350) [1e+05,279488] [0e+00,100350) [0e+00,100350) [1e+05,279488] [41] [0e+00,100350) [0e+00,100350) [0e+00,100350) [0e+00,100350) [0e+00,100350) [46] [1e+05,279488] [0e+00,100350) [0e+00,100350) [1e+05,279488] [0e+00,100350) [51] [0e+00,100350) [0e+00,100350) [1e+05,279488] [0e+00,100350) [0e+00,100350) [56] [0e+00,100350) [1e+05,279488] [1e+05,279488] [1e+05,279488] [0e+00,100350) [61] [1e+05,279488] [1e+05,279488] [0e+00,100350) [1e+05,279488] [1e+05,279488] [66] [0e+00,100350) [1e+05,279488] [0e+00,100350) [1e+05,279488] [1e+05,279488] [71] [0e+00,100350) [0e+00,100350) [0e+00,100350) [0e+00,100350) [0e+00,100350) [76] [1e+05,279488] [1e+05,279488] [1e+05,279488] [0e+00,100350) [0e+00,100350) [81] [0e+00,100350) [1e+05,279488] [0e+00,100350) [1e+05,279488] [0e+00,100350) [86] [0e+00,100350) [1e+05,279488] [1e+05,279488] [0e+00,100350) [1e+05,279488] [91] [0e+00,100350) [1e+05,279488] [0e+00,100350) [0e+00,100350) [1e+05,279488] [96] [1e+05,279488] [1e+05,279488] [1e+05,279488] [1e+05,279488] [1e+05,279488] [101] [1e+05,279488] [1e+05,279488] [0e+00,100350) [0e+00,100350) [0e+00,100350) [106] [1e+05,279488] [0e+00,100350) [1e+05,279488] [1e+05,279488] [1e+05,279488] [111] [1e+05,279488] [1e+05,279488] [0e+00,100350) [0e+00,100350) [0e+00,100350) [116] [0e+00,100350) [1e+05,279488] [0e+00,100350) [1e+05,279488] [0e+00,100350) [121] [0e+00,100350) [1e+05,279488] [1e+05,279488] [1e+05,279488] [0e+00,100350) [126] [1e+05,279488] [1e+05,279488] [1e+05,279488] [1e+05,279488] [1e+05,279488] [131] [1e+05,279488] [0e+00,100350) [0e+00,100350) [1e+05,279488] [1e+05,279488] [136] [1e+05,279488] [1e+05,279488] [0e+00,100350) [0e+00,100350) [0e+00,100350) [141] [1e+05,279488] [1e+05,279488] [1e+05,279488] [0e+00,100350) [1e+05,279488] [146] [1e+05,279488] [1e+05,279488] [1e+05,279488] [0e+00,100350) [0e+00,100350) [151] [0e+00,100350) [0e+00,100350) [0e+00,100350) [0e+00,100350) [0e+00,100350) [156] [0e+00,100350) [0e+00,100350) [0e+00,100350) [0e+00,100350) [0e+00,100350) [161] [0e+00,100350) [0e+00,100350) [0e+00,100350) [1e+05,279488] Levels: [0e+00,100350) [1e+05,279488] > 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/1mt031324664799.tab") + } + } > m Conditional inference tree with 5 terminal nodes Response: as.factor(TotalSize) Inputs: X.CompViews.PR., X.SharedComp, X.BloggedComputations, X.LongPR, X.Reviews, X.SecinComp Number of observations: 164 1) X.SecinComp <= 113713; criterion = 1, statistic = 56.351 2) X.Reviews <= 130; criterion = 1, statistic = 16.79 3) X.SecinComp <= 75881; criterion = 0.961, statistic = 7.366 4)* weights = 37 3) X.SecinComp > 75881 5)* weights = 21 2) X.Reviews > 130 6)* weights = 27 1) X.SecinComp > 113713 7) X.SecinComp <= 174586; criterion = 0.955, statistic = 7.095 8)* weights = 52 7) X.SecinComp > 174586 9)* weights = 27 > postscript(file="/var/wessaorg/rcomp/tmp/2uv981324664799.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/3693n1324664799.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 1 [4,] 2 2 [5,] 1 1 [6,] 1 1 [7,] 2 2 [8,] 1 1 [9,] 2 2 [10,] 1 1 [11,] 1 2 [12,] 1 2 [13,] 1 1 [14,] 2 2 [15,] 1 1 [16,] 2 2 [17,] 2 2 [18,] 2 2 [19,] 2 1 [20,] 2 2 [21,] 2 2 [22,] 2 2 [23,] 1 1 [24,] 2 2 [25,] 1 2 [26,] 2 2 [27,] 2 2 [28,] 1 2 [29,] 1 1 [30,] 2 2 [31,] 2 2 [32,] 1 2 [33,] 2 2 [34,] 1 2 [35,] 2 2 [36,] 1 1 [37,] 2 2 [38,] 1 1 [39,] 1 1 [40,] 2 2 [41,] 1 2 [42,] 1 1 [43,] 1 2 [44,] 1 2 [45,] 1 2 [46,] 2 2 [47,] 1 1 [48,] 1 2 [49,] 2 2 [50,] 1 2 [51,] 1 2 [52,] 1 1 [53,] 2 2 [54,] 1 1 [55,] 1 1 [56,] 1 2 [57,] 2 2 [58,] 2 2 [59,] 2 2 [60,] 1 2 [61,] 2 2 [62,] 2 2 [63,] 1 1 [64,] 2 2 [65,] 2 2 [66,] 1 2 [67,] 2 2 [68,] 1 2 [69,] 2 2 [70,] 2 1 [71,] 1 2 [72,] 1 1 [73,] 1 2 [74,] 1 1 [75,] 1 2 [76,] 2 2 [77,] 2 2 [78,] 2 2 [79,] 1 2 [80,] 1 1 [81,] 1 1 [82,] 2 2 [83,] 1 1 [84,] 2 2 [85,] 1 1 [86,] 1 1 [87,] 2 2 [88,] 2 2 [89,] 1 2 [90,] 2 2 [91,] 1 2 [92,] 2 2 [93,] 1 1 [94,] 1 2 [95,] 2 2 [96,] 2 2 [97,] 2 2 [98,] 2 2 [99,] 2 2 [100,] 2 2 [101,] 2 2 [102,] 2 2 [103,] 1 1 [104,] 1 1 [105,] 1 1 [106,] 2 2 [107,] 1 2 [108,] 2 2 [109,] 2 2 [110,] 2 2 [111,] 2 2 [112,] 2 2 [113,] 1 1 [114,] 1 1 [115,] 1 1 [116,] 1 1 [117,] 2 2 [118,] 1 1 [119,] 2 2 [120,] 1 1 [121,] 1 2 [122,] 2 2 [123,] 2 2 [124,] 2 1 [125,] 1 1 [126,] 2 2 [127,] 2 2 [128,] 2 2 [129,] 2 2 [130,] 2 2 [131,] 2 2 [132,] 1 2 [133,] 1 1 [134,] 2 2 [135,] 2 2 [136,] 2 2 [137,] 2 2 [138,] 1 1 [139,] 1 2 [140,] 1 2 [141,] 2 1 [142,] 2 2 [143,] 2 2 [144,] 1 1 [145,] 2 2 [146,] 2 2 [147,] 2 2 [148,] 2 2 [149,] 1 1 [150,] 1 1 [151,] 1 1 [152,] 1 1 [153,] 1 1 [154,] 1 1 [155,] 1 1 [156,] 1 2 [157,] 1 1 [158,] 1 1 [159,] 1 1 [160,] 1 1 [161,] 1 1 [162,] 1 1 [163,] 1 1 [164,] 2 1 [0e+00,100350) [1e+05,279488] [0e+00,100350) 52 30 [1e+05,279488] 6 76 > postscript(file="/var/wessaorg/rcomp/tmp/4lnhk1324664799.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/5ndmn1324664799.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/6eurg1324664799.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/7r4ms1324664799.tab") + } > > try(system("convert tmp/2uv981324664799.ps tmp/2uv981324664799.png",intern=TRUE)) character(0) > try(system("convert tmp/3693n1324664799.ps tmp/3693n1324664799.png",intern=TRUE)) character(0) > try(system("convert tmp/4lnhk1324664799.ps tmp/4lnhk1324664799.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.870 0.338 3.201