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(278691 + ,71 + ,494 + ,96 + ,42 + ,159 + ,140824 + ,197623 + ,70 + ,477 + ,75 + ,38 + ,149 + ,110459 + ,233139 + ,78 + ,701 + ,70 + ,46 + ,178 + ,105079 + ,221690 + ,106 + ,1150 + ,134 + ,42 + ,164 + ,112098 + ,177540 + ,53 + ,395 + ,69 + ,30 + ,100 + ,43929 + ,70849 + ,28 + ,179 + ,8 + ,35 + ,129 + ,76173 + ,566234 + ,130 + ,2446 + ,169 + ,40 + ,156 + ,187326 + ,33186 + ,19 + ,111 + ,1 + ,18 + ,67 + ,22807 + ,226511 + ,62 + ,756 + ,87 + ,38 + ,148 + ,144408 + ,245577 + ,46 + ,638 + ,92 + ,37 + ,132 + ,66485 + ,317443 + ,114 + ,831 + ,96 + ,46 + ,169 + ,79089 + ,248379 + ,124 + ,706 + ,119 + ,60 + ,230 + ,81625 + ,200620 + ,79 + ,749 + ,57 + ,37 + ,122 + ,68788 + ,367785 + ,82 + ,1184 + ,139 + ,55 + ,191 + ,103297 + ,266325 + ,87 + ,717 + ,87 + ,44 + ,162 + ,69446 + ,394271 + ,183 + ,1744 + ,176 + ,63 + ,237 + ,114948 + ,335567 + ,76 + ,845 + ,114 + ,40 + ,156 + ,167949 + ,407650 + ,168 + ,1360 + ,119 + ,43 + ,157 + ,125081 + ,182016 + ,57 + ,514 + ,103 + ,32 + ,123 + ,125818 + ,267365 + ,88 + ,692 + ,135 + ,52 + ,203 + ,136588 + ,279428 + ,72 + ,847 + ,123 + ,49 + ,187 + ,112431 + ,484574 + ,105 + ,1369 + ,89 + ,41 + ,152 + ,103037 + ,196721 + ,43 + ,494 + ,74 + ,25 + ,89 + ,82317 + ,197899 + ,56 + ,628 + ,103 + ,57 + ,227 + ,118906 + ,256290 + ,131 + ,1364 + ,158 + ,45 + ,165 + ,83515 + ,255126 + ,132 + ,1067 + ,113 + ,42 + ,162 + ,104581 + ,281816 + ,131 + ,1112 + ,100 + ,45 + ,174 + ,103129 + ,278027 + ,89 + ,636 + ,117 + ,43 + ,154 + ,83243 + ,173134 + ,55 + ,610 + ,59 + ,36 + ,129 + ,37110 + ,383613 + ,77 + ,1205 + ,142 + ,45 + ,174 + ,113344 + ,302413 + ,84 + ,1021 + ,136 + ,50 + ,195 + ,139165 + ,251255 + ,81 + ,724 + ,50 + ,50 + ,186 + ,86652 + ,355456 + ,96 + ,868 + ,141 + ,51 + ,197 + ,112302 + ,109546 + ,45 + ,374 + ,46 + ,42 + ,157 + ,69652 + ,427915 + ,103 + ,1290 + ,141 + ,44 + ,168 + ,119442 + ,273950 + ,56 + ,1186 + ,83 + ,42 + ,159 + ,69867 + ,427825 + ,124 + ,1344 + ,112 + ,44 + ,161 + ,101629 + ,247287 + ,88 + ,673 + ,79 + ,40 + ,153 + ,70168 + ,115658 + ,33 + ,284 + ,33 + ,17 + ,55 + ,31081 + ,386534 + ,205 + ,1299 + ,149 + ,43 + ,166 + ,103925 + ,340132 + ,83 + ,1546 + ,126 + ,41 + ,151 + ,92622 + ,194127 + ,71 + ,715 + ,80 + ,41 + ,148 + ,79011 + ,213258 + ,79 + ,676 + ,84 + ,40 + ,129 + ,93487 + ,182398 + ,65 + ,487 + ,68 + ,49 + ,181 + ,64520 + ,157164 + ,84 + ,1051 + ,50 + ,52 + ,93 + ,93473 + ,457592 + ,153 + ,2084 + ,101 + ,42 + ,150 + ,114360 + ,78800 + ,42 + ,330 + ,20 + ,26 + ,82 + ,33032 + ,213831 + ,81 + ,683 + ,101 + ,59 + ,229 + ,96125 + ,368086 + ,122 + ,1410 + ,150 + ,50 + ,193 + ,151911 + ,203104 + ,62 + ,1004 + ,115 + ,50 + ,176 + ,89256 + ,244371 + ,77 + ,688 + ,98 + ,47 + ,179 + ,95676 + ,24188 + ,24 + ,218 + ,8 + ,4 + ,12 + ,5950 + ,399093 + ,331 + ,862 + ,88 + ,51 + ,181 + ,149695 + ,65029 + ,17 + ,255 + ,21 + ,18 + ,67 + ,32551 + ,101097 + ,64 + ,454 + ,30 + ,14 + ,52 + ,31701 + ,297973 + ,61 + ,1185 + ,97 + ,41 + ,148 + ,100087 + ,352671 + ,88 + ,728 + ,149 + ,61 + ,230 + ,169707 + ,367083 + ,203 + ,1207 + ,132 + ,40 + ,148 + ,150491 + ,371178 + ,148 + ,1089 + ,161 + ,44 + ,160 + ,120192 + ,269973 + ,88 + ,884 + ,89 + ,40 + ,155 + ,95893 + ,389761 + ,149 + ,1332 + ,160 + ,51 + ,198 + ,151715 + ,315924 + ,121 + ,1190 + ,139 + ,29 + ,104 + ,176225 + ,285807 + ,121 + ,1233 + ,104 + ,43 + ,169 + ,59900 + ,282351 + ,90 + ,987 + ,99 + ,42 + ,163 + ,104767 + ,250558 + ,73 + ,619 + ,56 + ,41 + ,151 + ,114799 + ,265696 + ,71 + ,528 + ,163 + ,30 + ,116 + ,72128 + ,215915 + ,138 + ,651 + ,93 + ,39 + ,153 + ,143592 + ,247349 + ,154 + ,862 + ,85 + ,51 + ,195 + ,89626 + ,260919 + ,86 + ,913 + ,150 + ,40 + ,149 + ,131072 + ,182308 + ,71 + ,635 + ,143 + ,29 + ,106 + ,126817 + ,256761 + ,72 + ,898 + ,107 + ,47 + ,179 + ,81351 + ,73566 + ,32 + ,385 + ,22 + ,23 + ,88 + ,22618 + ,263796 + ,89 + ,767 + ,85 + ,48 + ,185 + ,88977 + ,207899 + ,56 + ,818 + ,85 + ,38 + ,133 + ,92059 + ,228779 + ,67 + ,779 + ,131 + ,42 + ,164 + ,81897 + ,363571 + ,89 + ,997 + ,140 + ,46 + ,169 + ,108146 + ,382785 + ,98 + ,1233 + ,152 + ,40 + ,153 + ,126372 + ,220401 + ,109 + ,586 + ,81 + ,45 + ,166 + ,249771 + ,225097 + ,67 + ,751 + ,136 + ,42 + ,164 + ,71154 + ,215445 + ,68 + ,734 + ,102 + ,41 + ,146 + ,71571 + ,188786 + ,49 + ,711 + ,69 + ,37 + ,141 + ,55918 + ,481148 + ,130 + ,1268 + ,161 + ,47 + ,183 + ,160141 + ,145943 + ,70 + ,653 + ,30 + ,26 + ,99 + ,38692 + ,292287 + ,108 + ,700 + ,120 + ,48 + ,134 + ,102812 + ,80953 + ,25 + ,437 + ,49 + ,8 + ,28 + ,56622 + ,164260 + ,57 + ,863 + ,62 + ,27 + ,101 + ,15986 + ,179344 + ,61 + ,459 + ,76 + ,38 + ,139 + ,123534 + ,413462 + ,220 + ,1580 + ,85 + ,41 + ,159 + ,108535 + ,358697 + ,125 + ,1024 + ,146 + ,61 + ,222 + ,93879 + ,180679 + ,106 + ,1051 + ,165 + ,45 + ,171 + ,144551 + ,298696 + ,102 + ,843 + ,89 + ,41 + ,154 + ,56750 + ,288706 + ,82 + ,725 + ,167 + ,42 + ,154 + ,127654 + ,197956 + ,66 + ,621 + ,48 + ,35 + ,129 + ,65594 + ,282361 + ,77 + ,1128 + ,149 + ,36 + ,140 + ,59938 + ,329202 + ,88 + ,969 + ,75 + ,40 + ,156 + ,146975 + ,221875 + ,44 + ,669 + ,100 + ,40 + ,156 + ,165904 + ,277071 + ,63 + ,674 + ,114 + ,38 + ,138 + ,169265 + ,305984 + ,87 + ,820 + ,165 + ,43 + ,153 + ,183500 + ,416032 + ,161 + ,1366 + ,155 + ,65 + ,251 + ,165986 + ,412530 + ,116 + ,1493 + ,165 + ,33 + ,126 + ,184923 + ,297080 + ,141 + ,893 + ,121 + ,51 + ,198 + ,140358 + ,318235 + ,68 + ,900 + ,156 + ,45 + ,168 + ,149959 + ,200486 + ,194 + ,704 + ,79 + ,36 + ,138 + ,57224 + ,43287 + ,14 + ,214 + ,13 + ,19 + ,71 + ,43750 + ,189520 + ,84 + ,733 + ,89 + ,25 + ,90 + ,48029 + ,255152 + ,153 + ,855 + ,110 + ,44 + ,167 + ,104978 + ,288617 + ,56 + ,1251 + ,129 + ,45 + ,172 + ,100046 + ,314167 + ,93 + ,1069 + ,169 + ,44 + ,162 + ,101047 + ,170268 + ,86 + ,426 + ,28 + ,35 + ,129 + ,197426 + ,164399 + ,99 + ,954 + ,118 + ,46 + ,179 + ,160902 + ,350667 + ,76 + ,674 + ,82 + ,44 + ,163 + ,147172 + ,303273 + ,90 + ,696 + ,148 + ,45 + ,164 + ,109432 + ,23623 + ,11 + ,156 + ,12 + ,1 + ,NA + ,1168 + ,195849 + ,74 + ,779 + ,146 + ,40 + ,155 + ,83248 + ,61857 + ,25 + ,192 + ,23 + ,11 + ,32 + ,25162 + ,184709 + ,52 + ,546 + ,83 + ,51 + ,189 + ,45724 + ,428191 + ,121 + ,1213 + ,163 + ,38 + ,140 + ,110529 + ,21054 + ,16 + ,146 + ,4 + ,NA + ,NA + ,855 + ,252805 + ,52 + ,866 + ,81 + ,30 + ,111 + ,101382 + ,31961 + ,22 + ,200 + ,18 + ,8 + ,25 + ,14116 + ,351541 + ,122 + ,1336 + ,118 + ,43 + ,159 + ,89506 + ,246359 + ,71 + ,726 + ,76 + ,48 + ,183 + ,135356 + ,187003 + ,95 + ,522 + ,55 + ,49 + ,184 + ,116066 + ,172442 + ,56 + ,714 + ,57 + ,32 + ,119 + ,144244 + ,38214 + ,34 + ,276 + ,16 + ,8 + ,27 + ,8773 + ,241539 + ,48 + ,789 + ,88 + ,43 + ,163 + ,102153 + ,358276 + ,83 + ,1031 + ,137 + ,52 + ,198 + ,117440 + ,209821 + ,64 + ,502 + ,50 + ,53 + ,205 + ,104128 + ,441447 + ,86 + ,1678 + ,147 + ,49 + ,191 + ,134238 + ,348017 + ,99 + ,884 + ,163 + ,48 + ,187 + ,134047 + ,439634 + ,131 + ,1200 + ,142 + ,56 + ,210 + ,279488 + ,208962 + ,40 + ,547 + ,77 + ,45 + ,166 + ,79756 + ,105332 + ,44 + ,422 + ,42 + ,40 + ,145 + ,66089 + ,311111 + ,355 + ,995 + ,94 + ,48 + ,187 + ,102070 + ,460033 + ,192 + ,1554 + ,126 + ,50 + ,186 + ,146760 + ,159057 + ,58 + ,563 + ,63 + ,43 + ,164 + ,154771 + ,411980 + ,136 + ,1811 + ,127 + ,46 + ,172 + ,165933 + ,173486 + ,80 + ,749 + ,59 + ,40 + ,147 + ,64593 + ,284582 + ,51 + ,648 + ,117 + ,45 + ,167 + ,92280 + ,283913 + ,100 + ,905 + ,110 + ,46 + ,158 + ,67150 + ,234203 + ,120 + ,659 + ,44 + ,37 + ,144 + ,128692 + ,386740 + ,123 + ,1611 + ,95 + ,45 + ,169 + ,124089 + ,246963 + ,92 + ,811 + ,128 + ,39 + ,145 + ,125386 + ,173260 + ,63 + ,716 + ,41 + ,21 + ,79 + ,37238 + ,346730 + ,107 + ,1034 + ,146 + ,50 + ,194 + ,140015 + ,176654 + ,58 + ,732 + ,147 + ,55 + ,212 + ,150047 + ,259048 + ,90 + ,1033 + ,119 + ,40 + ,148 + ,154451 + ,312540 + ,111 + ,850 + ,185 + ,48 + ,171 + ,156349 + ,1 + ,NA + ,NA + ,NA + ,NA + ,NA + ,NA + ,14688 + ,10 + ,85 + ,4 + ,NA + ,NA + ,6023 + ,98 + ,1 + ,NA + ,NA + ,NA + ,NA + ,NA + ,455 + ,2 + ,NA + ,NA + ,NA + ,NA + ,NA + ,NA + ,NA + ,NA + ,NA + ,NA + ,NA + ,NA + ,NA + ,NA + ,NA + ,NA + ,NA + ,NA + ,NA + ,283222 + ,91 + ,806 + ,85 + ,46 + ,141 + ,84601 + ,409280 + ,163 + ,1128 + ,157 + ,52 + ,204 + ,68946 + ,NA + ,NA + ,NA + ,NA + ,NA + ,NA + ,NA + ,203 + ,4 + ,NA + ,NA + ,NA + ,NA + ,NA + ,7199 + ,5 + ,74 + ,7 + ,NA + ,NA + ,1644 + ,46660 + ,20 + ,259 + ,12 + ,5 + ,15 + ,6179 + ,17547 + ,5 + ,69 + ,NA + ,1 + ,4 + ,3926 + ,121550 + ,46 + ,309 + ,37 + ,48 + ,172 + ,52789 + ,969 + ,2 + ,NA + ,NA + ,NA + ,NA + ,NA + ,242228 + ,73 + ,687 + ,62 + ,34 + ,125 + ,100350) + ,dim=c(7 + ,164) + ,dimnames=list(c('Time' + ,'Logins' + ,'BezieneCompendia' + ,'Blogs' + ,'GedanePR' + ,'FeedbackPr' + ,'Karakters') + ,1:164)) > y <- array(NA,dim=c(7,164),dimnames=list(c('Time','Logins','BezieneCompendia','Blogs','GedanePR','FeedbackPr','Karakters'),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 = 'yes' > 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] "Time" > x[,par1] [1] 278691 197623 233139 221690 177540 70849 566234 33186 226511 245577 [11] 317443 248379 200620 367785 266325 394271 335567 407650 182016 267365 [21] 279428 484574 196721 197899 256290 255126 281816 278027 173134 383613 [31] 302413 251255 355456 109546 427915 273950 427825 247287 115658 386534 [41] 340132 194127 213258 182398 157164 457592 78800 213831 368086 203104 [51] 244371 24188 399093 65029 101097 297973 352671 367083 371178 269973 [61] 389761 315924 285807 282351 250558 265696 215915 247349 260919 182308 [71] 256761 73566 263796 207899 228779 363571 382785 220401 225097 215445 [81] 188786 481148 145943 292287 80953 164260 179344 413462 358697 180679 [91] 298696 288706 197956 282361 329202 221875 277071 305984 416032 412530 [101] 297080 318235 200486 43287 189520 255152 288617 314167 170268 164399 [111] 350667 303273 23623 195849 61857 184709 428191 21054 252805 31961 [121] 351541 246359 187003 172442 38214 241539 358276 209821 441447 348017 [131] 439634 208962 105332 311111 460033 159057 411980 173486 284582 283913 [141] 234203 386740 246963 173260 346730 176654 259048 312540 1 14688 [151] 98 455 283222 409280 203 7199 46660 17547 121550 969 [161] 242228 > 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]) [ 1,250558) [250558,566234] 81 80 > colnames(x) [1] "Time" "Logins" "BezieneCompendia" "Blogs" [5] "GedanePR" "FeedbackPr" "Karakters" > colnames(x)[par1] [1] "Time" > x[,par1] [1] [250558,566234] [ 1,250558) [ 1,250558) [ 1,250558) [5] [ 1,250558) [ 1,250558) [250558,566234] [ 1,250558) [9] [ 1,250558) [ 1,250558) [250558,566234] [ 1,250558) [13] [ 1,250558) [250558,566234] [250558,566234] [250558,566234] [17] [250558,566234] [250558,566234] [ 1,250558) [250558,566234] [21] [250558,566234] [250558,566234] [ 1,250558) [ 1,250558) [25] [250558,566234] [250558,566234] [250558,566234] [250558,566234] [29] [ 1,250558) [250558,566234] [250558,566234] [250558,566234] [33] [250558,566234] [ 1,250558) [250558,566234] [250558,566234] [37] [250558,566234] [ 1,250558) [ 1,250558) [250558,566234] [41] [250558,566234] [ 1,250558) [ 1,250558) [ 1,250558) [45] [ 1,250558) [250558,566234] [ 1,250558) [ 1,250558) [49] [250558,566234] [ 1,250558) [ 1,250558) [ 1,250558) [53] [250558,566234] [ 1,250558) [ 1,250558) [250558,566234] [57] [250558,566234] [250558,566234] [250558,566234] [250558,566234] [61] [250558,566234] [250558,566234] [250558,566234] [250558,566234] [65] [250558,566234] [250558,566234] [ 1,250558) [ 1,250558) [69] [250558,566234] [ 1,250558) [250558,566234] [ 1,250558) [73] [250558,566234] [ 1,250558) [ 1,250558) [250558,566234] [77] [250558,566234] [ 1,250558) [ 1,250558) [ 1,250558) [81] [ 1,250558) [250558,566234] [ 1,250558) [250558,566234] [85] [ 1,250558) [ 1,250558) [ 1,250558) [250558,566234] [89] [250558,566234] [ 1,250558) [250558,566234] [250558,566234] [93] [ 1,250558) [250558,566234] [250558,566234] [ 1,250558) [97] [250558,566234] [250558,566234] [250558,566234] [250558,566234] [101] [250558,566234] [250558,566234] [ 1,250558) [ 1,250558) [105] [ 1,250558) [250558,566234] [250558,566234] [250558,566234] [109] [ 1,250558) [ 1,250558) [250558,566234] [250558,566234] [113] [ 1,250558) [ 1,250558) [ 1,250558) [ 1,250558) [117] [250558,566234] [ 1,250558) [250558,566234] [ 1,250558) [121] [250558,566234] [ 1,250558) [ 1,250558) [ 1,250558) [125] [ 1,250558) [ 1,250558) [250558,566234] [ 1,250558) [129] [250558,566234] [250558,566234] [250558,566234] [ 1,250558) [133] [ 1,250558) [250558,566234] [250558,566234] [ 1,250558) [137] [250558,566234] [ 1,250558) [250558,566234] [250558,566234] [141] [ 1,250558) [250558,566234] [ 1,250558) [ 1,250558) [145] [250558,566234] [ 1,250558) [250558,566234] [250558,566234] [149] [ 1,250558) [ 1,250558) [ 1,250558) [ 1,250558) [153] [250558,566234] [250558,566234] [ 1,250558) [ 1,250558) [157] [ 1,250558) [ 1,250558) [ 1,250558) [ 1,250558) [161] [ 1,250558) Levels: [ 1,250558) [250558,566234] > 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/1rx771324511006.tab") + } + } m.ct.i.pred m.ct.i.actu 1 2 1 632 94 2 145 581 [1] 0.8705234 [1] 0.8002755 [1] 0.8353994 m.ct.x.pred m.ct.x.actu 1 2 1 70 14 2 21 53 [1] 0.8333333 [1] 0.7162162 [1] 0.778481 > m Conditional inference tree with 3 terminal nodes Response: as.factor(Time) Inputs: Logins, BezieneCompendia, Blogs, GedanePR, FeedbackPr, Karakters Number of observations: 161 1) BezieneCompendia <= 818; criterion = 1, statistic = 65.226 2) Blogs <= 103; criterion = 1, statistic = 16.291 3)* weights = 74 2) Blogs > 103 4)* weights = 16 1) BezieneCompendia > 818 5)* weights = 71 > postscript(file="/var/wessaorg/rcomp/tmp/2c3001324511006.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/3lbn51324511006.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 1 [2,] 1 1 [3,] 1 1 [4,] 1 2 [5,] 1 1 [6,] 1 1 [7,] 2 2 [8,] 1 1 [9,] 1 1 [10,] 1 1 [11,] 2 2 [12,] 1 2 [13,] 1 1 [14,] 2 2 [15,] 2 1 [16,] 2 2 [17,] 2 2 [18,] 2 2 [19,] 1 1 [20,] 2 2 [21,] 2 2 [22,] 2 2 [23,] 1 1 [24,] 1 1 [25,] 2 2 [26,] 2 2 [27,] 2 2 [28,] 2 2 [29,] 1 1 [30,] 2 2 [31,] 2 2 [32,] 2 1 [33,] 2 2 [34,] 1 1 [35,] 2 2 [36,] 2 2 [37,] 2 2 [38,] 1 1 [39,] 1 1 [40,] 2 2 [41,] 2 2 [42,] 1 1 [43,] 1 1 [44,] 1 1 [45,] 1 2 [46,] 2 2 [47,] 1 1 [48,] 1 1 [49,] 2 2 [50,] 1 2 [51,] 1 1 [52,] 1 1 [53,] 2 2 [54,] 1 1 [55,] 1 1 [56,] 2 2 [57,] 2 2 [58,] 2 2 [59,] 2 2 [60,] 2 2 [61,] 2 2 [62,] 2 2 [63,] 2 2 [64,] 2 2 [65,] 2 1 [66,] 2 2 [67,] 1 1 [68,] 1 2 [69,] 2 2 [70,] 1 2 [71,] 2 2 [72,] 1 1 [73,] 2 1 [74,] 1 1 [75,] 1 2 [76,] 2 2 [77,] 2 2 [78,] 1 1 [79,] 1 2 [80,] 1 1 [81,] 1 1 [82,] 2 2 [83,] 1 1 [84,] 2 2 [85,] 1 1 [86,] 1 2 [87,] 1 1 [88,] 2 2 [89,] 2 2 [90,] 1 2 [91,] 2 2 [92,] 2 2 [93,] 1 1 [94,] 2 2 [95,] 2 2 [96,] 1 1 [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,] 2 2 [108,] 2 2 [109,] 1 1 [110,] 1 2 [111,] 2 1 [112,] 2 2 [113,] 1 1 [114,] 1 2 [115,] 1 1 [116,] 1 1 [117,] 2 2 [118,] 1 1 [119,] 2 2 [120,] 1 1 [121,] 2 2 [122,] 1 1 [123,] 1 1 [124,] 1 1 [125,] 1 1 [126,] 1 1 [127,] 2 2 [128,] 1 1 [129,] 2 2 [130,] 2 2 [131,] 2 2 [132,] 1 1 [133,] 1 1 [134,] 2 2 [135,] 2 2 [136,] 1 1 [137,] 2 2 [138,] 1 1 [139,] 2 2 [140,] 2 2 [141,] 1 1 [142,] 2 2 [143,] 1 2 [144,] 1 1 [145,] 2 2 [146,] 1 2 [147,] 2 2 [148,] 2 2 [149,] 1 1 [150,] 1 1 [151,] 1 1 [152,] 1 1 [153,] 2 1 [154,] 2 2 [155,] 1 1 [156,] 1 1 [157,] 1 1 [158,] 1 1 [159,] 1 1 [160,] 1 1 [161,] 1 1 [ 1,250558) [250558,566234] [ 1,250558) 67 14 [250558,566234] 7 73 > postscript(file="/var/wessaorg/rcomp/tmp/4u8wq1324511006.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/53dkc1324511006.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/6e8ls1324511006.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/73qvb1324511006.tab") + } > > try(system("convert tmp/2c3001324511006.ps tmp/2c3001324511006.png",intern=TRUE)) character(0) > try(system("convert tmp/3lbn51324511006.ps tmp/3lbn51324511006.png",intern=TRUE)) character(0) > try(system("convert tmp/4u8wq1324511006.ps tmp/4u8wq1324511006.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.652 0.277 3.928