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 = '3' > par2 = 'none' > par1 = '1' > #'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] "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]) 0 855 1168 1644 3926 5950 6023 6179 8773 14116 15986 8 1 1 1 1 1 1 1 1 1 1 22618 22807 25162 31081 31701 32551 33032 37110 37238 38692 43750 1 1 1 1 1 1 1 1 1 1 1 43929 45724 48029 52789 55918 56622 56750 57224 59900 59938 64520 1 1 1 1 1 1 1 1 1 1 1 64593 65594 66089 66485 67150 68788 68946 69446 69652 69867 70168 1 1 1 1 1 1 1 1 1 1 1 71154 71571 72128 76173 79011 79089 79756 81351 81625 81897 82317 1 1 1 1 1 1 1 1 1 1 1 83243 83248 83515 84601 86652 88977 89256 89506 89626 92059 92280 1 1 1 1 1 1 1 1 1 1 1 92622 93473 93487 93879 95676 95893 96125 100046 100087 100350 101047 1 1 1 1 1 1 1 1 1 1 1 101382 101629 102070 102153 102812 103037 103129 103297 103925 104128 104581 1 1 1 1 1 1 1 1 1 1 1 104767 104978 105079 108146 108535 109432 110459 110529 112098 112302 112431 1 1 1 1 1 1 1 1 1 1 1 113344 114360 114799 114948 116066 117440 118906 119442 120192 123534 124089 1 1 1 1 1 1 1 1 1 1 1 125081 125386 125818 126372 126817 127654 128692 131072 134047 134238 135356 1 1 1 1 1 1 1 1 1 1 1 136588 139165 140015 140358 140824 143592 144244 144408 144551 146760 146975 1 1 1 1 1 1 1 1 1 1 1 147172 149695 149959 150047 150491 151715 151911 154451 154771 156349 160141 1 1 1 1 1 1 1 1 1 1 1 160902 165904 165933 165986 167949 169265 169707 176225 183500 184923 187326 1 1 1 1 1 1 1 1 1 1 1 197426 249771 279488 1 1 1 > 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] 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 == '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/1l6b11324660432.tab") + } + } > m Conditional inference tree with 6 terminal nodes Response: TotalSize Inputs: X.CompViews.PR., X.SharedComp, X.BloggedComputations, X.LongPR, X.Reviews, X.SecinComp Number of observations: 164 1) X.SecinComp <= 74151; criterion = 1, statistic = 102.576 2) X.Reviews <= 78; criterion = 1, statistic = 29.1 3) X.SecinComp <= 7953; criterion = 1, statistic = 16.658 4)* weights = 14 3) X.SecinComp > 7953 5)* weights = 14 2) X.Reviews > 78 6)* weights = 12 1) X.SecinComp > 74151 7) X.SecinComp <= 174586; criterion = 1, statistic = 41.251 8) X.Reviews <= 129; criterion = 0.998, statistic = 12.583 9)* weights = 37 8) X.Reviews > 129 10)* weights = 60 7) X.SecinComp > 174586 11)* weights = 27 > postscript(file="/var/wessaorg/rcomp/tmp/21o0h1324660432.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/3ai7o1324660432.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 140824 156589.185 -15765.1852 2 110459 113570.667 -3111.6667 3 105079 88349.865 16729.1351 4 112098 113570.667 -1472.6667 5 43929 88349.865 -44420.8649 6 76173 71247.250 4925.7500 7 187326 156589.185 30736.8148 8 22807 2601.643 20205.3571 9 144408 113570.667 30837.3333 10 66485 88349.865 -21864.8649 11 79089 113570.667 -34481.6667 12 81625 113570.667 -31945.6667 13 68788 71247.250 -2459.2500 14 103297 113570.667 -10273.6667 15 69446 88349.865 -18903.8649 16 114948 113570.667 1377.3333 17 167949 113570.667 54378.3333 18 125081 88349.865 36731.1351 19 125818 88349.865 37468.1351 20 136588 113570.667 23017.3333 21 112431 113570.667 -1139.6667 22 103037 113570.667 -10533.6667 23 82317 88349.865 -6032.8649 24 118906 113570.667 5335.3333 25 83515 113570.667 -30055.6667 26 104581 113570.667 -8989.6667 27 103129 113570.667 -10441.6667 28 83243 113570.667 -30327.6667 29 37110 71247.250 -34137.2500 30 113344 156589.185 -43245.1852 31 139165 156589.185 -17424.1852 32 86652 113570.667 -26918.6667 33 112302 156589.185 -44287.1852 34 69652 71247.250 -1595.2500 35 119442 156589.185 -37147.1852 36 69867 88349.865 -18482.8649 37 101629 156589.185 -54960.1852 38 70168 88349.865 -18181.8649 39 31081 26054.214 5026.7857 40 103925 113570.667 -9645.6667 41 92622 88349.865 4272.1351 42 79011 88349.865 -9338.8649 43 93487 88349.865 5137.1351 44 64520 71247.250 -6727.2500 45 93473 88349.865 5123.1351 46 114360 113570.667 789.3333 47 33032 26054.214 6977.7857 48 96125 113570.667 -17445.6667 49 151911 156589.185 -4678.1852 50 89256 113570.667 -24314.6667 51 95676 113570.667 -17894.6667 52 5950 26054.214 -20104.2143 53 149695 156589.185 -6894.1852 54 32551 26054.214 6496.7857 55 31701 26054.214 5646.7857 56 100087 113570.667 -13483.6667 57 169707 156589.185 13117.8148 58 150491 156589.185 -6098.1852 59 120192 156589.185 -36397.1852 60 95893 113570.667 -17677.6667 61 151715 156589.185 -4874.1852 62 176225 156589.185 19635.8148 63 59900 88349.865 -28449.8649 64 104767 113570.667 -8803.6667 65 114799 113570.667 1228.3333 66 72128 88349.865 -16221.8649 67 143592 113570.667 30021.3333 68 89626 113570.667 -23944.6667 69 131072 88349.865 42722.1351 70 126817 88349.865 38467.1351 71 81351 113570.667 -32219.6667 72 22618 26054.214 -3436.2143 73 88977 113570.667 -24593.6667 74 92059 88349.865 3709.1351 75 81897 113570.667 -31673.6667 76 108146 113570.667 -5424.6667 77 126372 113570.667 12801.3333 78 249771 156589.185 93181.8148 79 71154 113570.667 -42416.6667 80 71571 88349.865 -16778.8649 81 55918 88349.865 -32431.8649 82 160141 156589.185 3551.8148 83 38692 71247.250 -32555.2500 84 102812 88349.865 14462.1351 85 56622 26054.214 30567.7857 86 15986 26054.214 -10068.2143 87 123534 113570.667 9963.3333 88 108535 113570.667 -5035.6667 89 93879 88349.865 5529.1351 90 144551 113570.667 30980.3333 91 56750 88349.865 -31599.8649 92 127654 113570.667 14083.3333 93 65594 88349.865 -22755.8649 94 59938 113570.667 -53632.6667 95 146975 113570.667 33404.3333 96 165904 113570.667 52333.3333 97 169265 113570.667 55694.3333 98 183500 156589.185 26910.8148 99 165986 156589.185 9396.8148 100 184923 156589.185 28333.8148 101 140358 113570.667 26787.3333 102 149959 156589.185 -6630.1852 103 57224 88349.865 -31125.8649 104 43750 26054.214 17695.7857 105 48029 88349.865 -40320.8649 106 104978 88349.865 16628.1351 107 100046 113570.667 -13524.6667 108 101047 113570.667 -12523.6667 109 197426 156589.185 40836.8148 110 160902 113570.667 47331.3333 111 147172 156589.185 -9417.1852 112 109432 88349.865 21082.1351 113 1168 2601.643 -1433.6429 114 83248 88349.865 -5101.8649 115 25162 26054.214 -892.2143 116 45724 71247.250 -25523.2500 117 110529 156589.185 -46060.1852 118 855 2601.643 -1746.6429 119 101382 88349.865 13032.1351 120 14116 26054.214 -11938.2143 121 89506 113570.667 -24064.6667 122 135356 113570.667 21785.3333 123 116066 71247.250 44818.7500 124 144244 88349.865 55894.1351 125 8773 26054.214 -17281.2143 126 102153 113570.667 -11417.6667 127 117440 113570.667 3869.3333 128 104128 113570.667 -9442.6667 129 134238 156589.185 -22351.1852 130 134047 156589.185 -22542.1852 131 279488 156589.185 122898.8148 132 79756 113570.667 -33814.6667 133 66089 71247.250 -5158.2500 134 102070 113570.667 -11500.6667 135 146760 156589.185 -9829.1852 136 154771 71247.250 83523.7500 137 165933 113570.667 52362.3333 138 64593 71247.250 -6654.2500 139 92280 113570.667 -21290.6667 140 67150 88349.865 -21199.8649 141 128692 88349.865 40342.1351 142 124089 113570.667 10518.3333 143 125386 88349.865 37036.1351 144 37238 26054.214 11183.7857 145 140015 113570.667 26444.3333 146 150047 113570.667 36476.3333 147 154451 113570.667 40880.3333 148 156349 113570.667 42778.3333 149 0 2601.643 -2601.6429 150 6023 2601.643 3421.3571 151 0 2601.643 -2601.6429 152 0 2601.643 -2601.6429 153 0 2601.643 -2601.6429 154 0 2601.643 -2601.6429 155 84601 88349.865 -3748.8649 156 68946 88349.865 -19403.8649 157 0 2601.643 -2601.6429 158 0 2601.643 -2601.6429 159 1644 2601.643 -957.6429 160 6179 26054.214 -19875.2143 161 3926 2601.643 1324.3571 162 52789 71247.250 -18458.2500 163 0 2601.643 -2601.6429 164 100350 88349.865 12000.1351 > 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/4z1df1324660432.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/5qv2b1324660432.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/605v11324660432.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/767wm1324660432.tab") + } > > try(system("convert tmp/21o0h1324660432.ps tmp/21o0h1324660432.png",intern=TRUE)) character(0) > try(system("convert tmp/3ai7o1324660432.ps tmp/3ai7o1324660432.png",intern=TRUE)) character(0) > try(system("convert tmp/4z1df1324660432.ps tmp/4z1df1324660432.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.655 0.340 3.995