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(252101 + ,62 + ,34 + ,104 + ,124252 + ,134577 + ,59 + ,30 + ,111 + ,98956 + ,198520 + ,62 + ,38 + ,93 + ,98073 + ,189326 + ,94 + ,34 + ,119 + ,106816 + ,137449 + ,43 + ,25 + ,57 + ,41449 + ,65295 + ,27 + ,31 + ,80 + ,76173 + ,439387 + ,103 + ,29 + ,107 + ,177551 + ,33186 + ,19 + ,18 + ,22 + ,22807 + ,178368 + ,51 + ,30 + ,103 + ,126938 + ,186657 + ,38 + ,29 + ,72 + ,61680 + ,261949 + ,96 + ,38 + ,123 + ,72117 + ,191051 + ,95 + ,49 + ,164 + ,79738 + ,138866 + ,57 + ,33 + ,100 + ,57793 + ,296878 + ,66 + ,46 + ,143 + ,91677 + ,192648 + ,72 + ,38 + ,79 + ,64631 + ,333462 + ,162 + ,52 + ,183 + ,106385 + ,243571 + ,58 + ,32 + ,123 + ,161961 + ,263451 + ,130 + ,35 + ,81 + ,112669 + ,155679 + ,48 + ,25 + ,74 + ,114029 + ,227053 + ,70 + ,42 + ,158 + ,124550 + ,240028 + ,63 + ,40 + ,133 + ,105416 + ,388549 + ,90 + ,35 + ,128 + ,72875 + ,156540 + ,34 + ,25 + ,84 + ,81964 + ,148421 + ,43 + ,46 + ,184 + ,104880 + ,177732 + ,97 + ,36 + ,127 + ,76302 + ,191441 + ,105 + ,35 + ,128 + ,96740 + ,249893 + ,122 + ,38 + ,118 + ,93071 + ,236812 + ,76 + ,35 + ,125 + ,78912 + ,142329 + ,45 + ,28 + ,89 + ,35224 + ,259667 + ,53 + ,37 + ,122 + ,90694 + ,231625 + ,65 + ,40 + ,151 + ,125369 + ,176062 + ,67 + ,42 + ,122 + ,80849 + ,286683 + ,79 + ,44 + ,162 + ,104434 + ,87485 + ,33 + ,33 + ,121 + ,65702 + ,322865 + ,83 + ,35 + ,132 + ,108179 + ,247082 + ,51 + ,37 + ,110 + ,63583 + ,346011 + ,106 + ,39 + ,135 + ,95066 + ,191653 + ,74 + ,32 + ,80 + ,62486 + ,114673 + ,31 + ,17 + ,46 + ,31081 + ,284224 + ,161 + ,34 + ,127 + ,94584 + ,284195 + ,72 + ,33 + ,103 + ,87408 + ,155363 + ,59 + ,35 + ,95 + ,68966 + ,177306 + ,67 + ,32 + ,100 + ,88766 + ,144571 + ,49 + ,35 + ,102 + ,57139 + ,140319 + ,73 + ,45 + ,45 + ,90586 + ,405267 + ,135 + ,38 + ,122 + ,109249 + ,78800 + ,42 + ,26 + ,66 + ,33032 + ,201970 + ,69 + ,45 + ,159 + ,96056 + ,302674 + ,99 + ,44 + ,153 + ,146648 + ,164733 + ,50 + ,40 + ,131 + ,80613 + ,194221 + ,68 + ,33 + ,113 + ,87026 + ,24188 + ,24 + ,4 + ,7 + ,5950 + ,342263 + ,279 + ,41 + ,147 + ,131106 + ,65029 + ,17 + ,18 + ,61 + ,32551 + ,101097 + ,64 + ,14 + ,41 + ,31701 + ,246088 + ,46 + ,33 + ,108 + ,91072 + ,273108 + ,75 + ,49 + ,184 + ,159803 + ,282220 + ,160 + ,32 + ,115 + ,143950 + ,273495 + ,119 + ,37 + ,132 + ,112368 + ,214872 + ,74 + ,32 + ,113 + ,82124 + ,335121 + ,124 + ,41 + ,141 + ,144068 + ,267171 + ,107 + ,25 + ,65 + ,162627 + ,187938 + ,88 + ,40 + ,87 + ,55062 + ,229512 + ,78 + ,35 + ,121 + ,95329 + ,209798 + ,61 + ,33 + ,112 + ,105612 + ,201345 + ,60 + ,28 + ,81 + ,62853 + ,163833 + ,114 + ,31 + ,116 + ,125976 + ,204250 + ,129 + ,40 + ,132 + ,79146 + ,197813 + ,67 + ,32 + ,104 + ,108461 + ,132955 + ,60 + ,25 + ,80 + ,99971 + ,216092 + ,59 + ,42 + ,145 + ,77826 + ,73566 + ,32 + ,23 + ,67 + ,22618 + ,213198 + ,67 + ,42 + ,159 + ,84892 + ,181713 + ,49 + ,38 + ,90 + ,92059 + ,148698 + ,49 + ,34 + ,120 + ,77993 + ,300103 + ,70 + ,38 + ,126 + ,104155 + ,251437 + ,78 + ,32 + ,118 + ,109840 + ,197295 + ,101 + ,37 + ,112 + ,238712 + ,158163 + ,55 + ,34 + ,123 + ,67486 + ,155529 + ,57 + ,33 + ,98 + ,68007 + ,132672 + ,41 + ,25 + ,78 + ,48194 + ,377205 + ,100 + ,40 + ,119 + ,134796 + ,145905 + ,66 + ,26 + ,99 + ,38692 + ,223701 + ,87 + ,40 + ,81 + ,93587 + ,80953 + ,25 + ,8 + ,27 + ,56622 + ,130805 + ,47 + ,27 + ,77 + ,15986 + ,135082 + ,48 + ,32 + ,118 + ,113402 + ,300805 + ,156 + ,33 + ,122 + ,97967 + ,271806 + ,95 + ,50 + ,103 + ,74844 + ,150949 + ,96 + ,37 + ,129 + ,136051 + ,225805 + ,79 + ,33 + ,69 + ,50548 + ,197389 + ,68 + ,34 + ,121 + ,112215 + ,156583 + ,56 + ,28 + ,81 + ,59591 + ,222599 + ,66 + ,32 + ,119 + ,59938 + ,261601 + ,70 + ,32 + ,116 + ,137639 + ,178489 + ,35 + ,32 + ,123 + ,143372 + ,200657 + ,43 + ,31 + ,111 + ,138599 + ,259084 + ,68 + ,35 + ,100 + ,174110 + ,313075 + ,130 + ,58 + ,221 + ,135062 + ,346933 + ,100 + ,27 + ,95 + ,175681 + ,246440 + ,104 + ,45 + ,153 + ,130307 + ,252444 + ,58 + ,37 + ,118 + ,139141 + ,159965 + ,159 + ,32 + ,50 + ,44244 + ,43287 + ,14 + ,19 + ,64 + ,43750 + ,172239 + ,68 + ,22 + ,34 + ,48029 + ,183738 + ,120 + ,35 + ,76 + ,95216 + ,227681 + ,43 + ,36 + ,112 + ,92288 + ,260464 + ,81 + ,36 + ,115 + ,94588 + ,106288 + ,54 + ,23 + ,69 + ,197426 + ,109632 + ,77 + ,36 + ,108 + ,151244 + ,268905 + ,58 + ,36 + ,130 + ,139206 + ,266805 + ,78 + ,42 + ,110 + ,106271 + ,23623 + ,11 + ,1 + ,0 + ,1168 + ,152474 + ,65 + ,32 + ,83 + ,71764 + ,61857 + ,25 + ,11 + ,30 + ,25162 + ,144889 + ,43 + ,40 + ,106 + ,45635 + ,346600 + ,99 + ,34 + ,91 + ,101817 + ,21054 + ,16 + ,0 + ,0 + ,855 + ,224051 + ,45 + ,27 + ,69 + ,100174 + ,31414 + ,19 + ,8 + ,9 + ,14116 + ,261043 + ,105 + ,35 + ,123 + ,85008 + ,197819 + ,57 + ,41 + ,143 + ,124254 + ,154984 + ,73 + ,40 + ,125 + ,105793 + ,112933 + ,45 + ,28 + ,81 + ,117129 + ,38214 + ,34 + ,8 + ,21 + ,8773 + ,158671 + ,33 + ,35 + ,124 + ,94747 + ,302148 + ,70 + ,47 + ,168 + ,107549 + ,177918 + ,55 + ,46 + ,149 + ,97392 + ,350552 + ,70 + ,42 + ,147 + ,126893 + ,275578 + ,91 + ,48 + ,145 + ,118850 + ,368746 + ,106 + ,49 + ,172 + ,234853 + ,172464 + ,31 + ,35 + ,126 + ,74783 + ,94381 + ,35 + ,32 + ,89 + ,66089 + ,243875 + ,279 + ,36 + ,137 + ,95684 + ,382487 + ,153 + ,42 + ,149 + ,139537 + ,114525 + ,40 + ,35 + ,121 + ,144253 + ,335681 + ,119 + ,37 + ,133 + ,153824 + ,147989 + ,72 + ,34 + ,93 + ,63995 + ,216638 + ,45 + ,36 + ,119 + ,84891 + ,192862 + ,72 + ,36 + ,102 + ,61263 + ,184818 + ,107 + ,32 + ,45 + ,106221 + ,336707 + ,105 + ,33 + ,104 + ,113587 + ,215836 + ,76 + ,35 + ,111 + ,113864 + ,173260 + ,63 + ,21 + ,78 + ,37238 + ,271773 + ,89 + ,40 + ,120 + ,119906 + ,130908 + ,52 + ,49 + ,176 + ,135096 + ,204009 + ,75 + ,33 + ,109 + ,151611 + ,245514 + ,92 + ,39 + ,132 + ,144645 + ,1 + ,0 + ,0 + ,0 + ,0 + ,14688 + ,10 + ,0 + ,0 + ,6023 + ,98 + ,1 + ,0 + ,0 + ,0 + ,455 + ,2 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,195765 + ,75 + ,33 + ,78 + ,77457 + ,326038 + ,121 + ,42 + ,104 + ,62464 + ,0 + ,0 + ,0 + ,0 + ,0 + ,203 + ,4 + ,0 + ,0 + ,0 + ,7199 + ,5 + ,0 + ,0 + ,1644 + ,46660 + ,20 + ,5 + ,13 + ,6179 + ,17547 + ,5 + ,1 + ,4 + ,3926 + ,107465 + ,38 + ,38 + ,65 + ,42087 + ,969 + ,2 + ,0 + ,0 + ,0 + ,173102 + ,58 + ,28 + ,55 + ,87656) + ,dim=c(5 + ,164) + ,dimnames=list(c('TimeinRFC' + ,'#logins' + ,'#FBmess' + ,'#revCom' + ,'#char') + ,1:164)) > y <- array(NA,dim=c(5,164),dimnames=list(c('TimeinRFC','#logins','#FBmess','#revCom','#char'),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] "TimeinRFC" > x[,par1] [1] 252101 134577 198520 189326 137449 65295 439387 33186 178368 186657 [11] 261949 191051 138866 296878 192648 333462 243571 263451 155679 227053 [21] 240028 388549 156540 148421 177732 191441 249893 236812 142329 259667 [31] 231625 176062 286683 87485 322865 247082 346011 191653 114673 284224 [41] 284195 155363 177306 144571 140319 405267 78800 201970 302674 164733 [51] 194221 24188 342263 65029 101097 246088 273108 282220 273495 214872 [61] 335121 267171 187938 229512 209798 201345 163833 204250 197813 132955 [71] 216092 73566 213198 181713 148698 300103 251437 197295 158163 155529 [81] 132672 377205 145905 223701 80953 130805 135082 300805 271806 150949 [91] 225805 197389 156583 222599 261601 178489 200657 259084 313075 346933 [101] 246440 252444 159965 43287 172239 183738 227681 260464 106288 109632 [111] 268905 266805 23623 152474 61857 144889 346600 21054 224051 31414 [121] 261043 197819 154984 112933 38214 158671 302148 177918 350552 275578 [131] 368746 172464 94381 243875 382487 114525 335681 147989 216638 192862 [141] 184818 336707 215836 173260 271773 130908 204009 245514 1 14688 [151] 98 455 0 0 195765 326038 0 203 7199 46660 [161] 17547 107465 969 173102 > 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 1 98 203 455 969 7199 14688 17547 21054 23623 3 1 1 1 1 1 1 1 1 1 1 24188 31414 33186 38214 43287 46660 61857 65029 65295 73566 78800 1 1 1 1 1 1 1 1 1 1 1 80953 87485 94381 101097 106288 107465 109632 112933 114525 114673 130805 1 1 1 1 1 1 1 1 1 1 1 130908 132672 132955 134577 135082 137449 138866 140319 142329 144571 144889 1 1 1 1 1 1 1 1 1 1 1 145905 147989 148421 148698 150949 152474 154984 155363 155529 155679 156540 1 1 1 1 1 1 1 1 1 1 1 156583 158163 158671 159965 163833 164733 172239 172464 173102 173260 176062 1 1 1 1 1 1 1 1 1 1 1 177306 177732 177918 178368 178489 181713 183738 184818 186657 187938 189326 1 1 1 1 1 1 1 1 1 1 1 191051 191441 191653 192648 192862 194221 195765 197295 197389 197813 197819 1 1 1 1 1 1 1 1 1 1 1 198520 200657 201345 201970 204009 204250 209798 213198 214872 215836 216092 1 1 1 1 1 1 1 1 1 1 1 216638 222599 223701 224051 225805 227053 227681 229512 231625 236812 240028 1 1 1 1 1 1 1 1 1 1 1 243571 243875 245514 246088 246440 247082 249893 251437 252101 252444 259084 1 1 1 1 1 1 1 1 1 1 1 259667 260464 261043 261601 261949 263451 266805 267171 268905 271773 271806 1 1 1 1 1 1 1 1 1 1 1 273108 273495 275578 282220 284195 284224 286683 296878 300103 300805 302148 1 1 1 1 1 1 1 1 1 1 1 302674 313075 322865 326038 333462 335121 335681 336707 342263 346011 346600 1 1 1 1 1 1 1 1 1 1 1 346933 350552 368746 377205 382487 388549 405267 439387 1 1 1 1 1 1 1 1 > colnames(x) [1] "TimeinRFC" "X.logins" "X.FBmess" "X.revCom" "X.char" > colnames(x)[par1] [1] "TimeinRFC" > x[,par1] [1] 252101 134577 198520 189326 137449 65295 439387 33186 178368 186657 [11] 261949 191051 138866 296878 192648 333462 243571 263451 155679 227053 [21] 240028 388549 156540 148421 177732 191441 249893 236812 142329 259667 [31] 231625 176062 286683 87485 322865 247082 346011 191653 114673 284224 [41] 284195 155363 177306 144571 140319 405267 78800 201970 302674 164733 [51] 194221 24188 342263 65029 101097 246088 273108 282220 273495 214872 [61] 335121 267171 187938 229512 209798 201345 163833 204250 197813 132955 [71] 216092 73566 213198 181713 148698 300103 251437 197295 158163 155529 [81] 132672 377205 145905 223701 80953 130805 135082 300805 271806 150949 [91] 225805 197389 156583 222599 261601 178489 200657 259084 313075 346933 [101] 246440 252444 159965 43287 172239 183738 227681 260464 106288 109632 [111] 268905 266805 23623 152474 61857 144889 346600 21054 224051 31414 [121] 261043 197819 154984 112933 38214 158671 302148 177918 350552 275578 [131] 368746 172464 94381 243875 382487 114525 335681 147989 216638 192862 [141] 184818 336707 215836 173260 271773 130908 204009 245514 1 14688 [151] 98 455 0 0 195765 326038 0 203 7199 46660 [161] 17547 107465 969 173102 > 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/1u3i51323627339.tab") + } + } > m Conditional inference tree with 6 terminal nodes Response: TimeinRFC Inputs: X.logins, X.FBmess, X.revCom, X.char Number of observations: 164 1) X.FBmess <= 19; criterion = 1, statistic = 89.023 2) X.logins <= 16; criterion = 1, statistic = 16.26 3)* weights = 14 2) X.logins > 16 4)* weights = 10 1) X.FBmess > 19 5) X.logins <= 77; criterion = 1, statistic = 42.051 6) X.logins <= 57; criterion = 1, statistic = 22.669 7)* weights = 41 6) X.logins > 57 8) X.revCom <= 125; criterion = 1, statistic = 14.892 9)* weights = 35 8) X.revCom > 125 10)* weights = 12 5) X.logins > 77 11)* weights = 52 > postscript(file="/var/wessaorg/rcomp/tmp/2go3o1323627339.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/35bpd1323627339.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 252101 193294.429 5.880657e+04 2 134577 193294.429 -5.871743e+04 3 198520 193294.429 5.225571e+03 4 189326 274520.212 -8.519421e+04 5 137449 155527.268 -1.807827e+04 6 65295 155527.268 -9.023227e+04 7 439387 274520.212 1.648668e+05 8 33186 59727.100 -2.654110e+04 9 178368 155527.268 2.284073e+04 10 186657 155527.268 3.112973e+04 11 261949 274520.212 -1.257121e+04 12 191051 274520.212 -8.346921e+04 13 138866 155527.268 -1.666127e+04 14 296878 260138.333 3.673967e+04 15 192648 193294.429 -6.464286e+02 16 333462 274520.212 5.894179e+04 17 243571 193294.429 5.027657e+04 18 263451 274520.212 -1.106921e+04 19 155679 155527.268 1.517317e+02 20 227053 260138.333 -3.308533e+04 21 240028 260138.333 -2.011033e+04 22 388549 274520.212 1.140288e+05 23 156540 155527.268 1.012732e+03 24 148421 155527.268 -7.106268e+03 25 177732 274520.212 -9.678821e+04 26 191441 274520.212 -8.307921e+04 27 249893 274520.212 -2.462721e+04 28 236812 193294.429 4.351757e+04 29 142329 155527.268 -1.319827e+04 30 259667 155527.268 1.041397e+05 31 231625 260138.333 -2.851333e+04 32 176062 193294.429 -1.723243e+04 33 286683 274520.212 1.216279e+04 34 87485 155527.268 -6.804227e+04 35 322865 274520.212 4.834479e+04 36 247082 155527.268 9.155473e+04 37 346011 274520.212 7.149079e+04 38 191653 193294.429 -1.641429e+03 39 114673 59727.100 5.494590e+04 40 284224 274520.212 9.703788e+03 41 284195 193294.429 9.090057e+04 42 155363 193294.429 -3.793143e+04 43 177306 193294.429 -1.598843e+04 44 144571 155527.268 -1.095627e+04 45 140319 193294.429 -5.297543e+04 46 405267 274520.212 1.307468e+05 47 78800 155527.268 -7.672727e+04 48 201970 260138.333 -5.816833e+04 49 302674 274520.212 2.815379e+04 50 164733 155527.268 9.205732e+03 51 194221 193294.429 9.265714e+02 52 24188 59727.100 -3.553910e+04 53 342263 274520.212 6.774279e+04 54 65029 59727.100 5.301900e+03 55 101097 59727.100 4.136990e+04 56 246088 155527.268 9.056073e+04 57 273108 260138.333 1.296967e+04 58 282220 274520.212 7.699788e+03 59 273495 274520.212 -1.025212e+03 60 214872 193294.429 2.157757e+04 61 335121 274520.212 6.060079e+04 62 267171 274520.212 -7.349212e+03 63 187938 274520.212 -8.658221e+04 64 229512 274520.212 -4.500821e+04 65 209798 193294.429 1.650357e+04 66 201345 193294.429 8.050571e+03 67 163833 274520.212 -1.106872e+05 68 204250 274520.212 -7.027021e+04 69 197813 193294.429 4.518571e+03 70 132955 193294.429 -6.033943e+04 71 216092 260138.333 -4.404633e+04 72 73566 155527.268 -8.196127e+04 73 213198 260138.333 -4.694033e+04 74 181713 155527.268 2.618573e+04 75 148698 155527.268 -6.829268e+03 76 300103 260138.333 3.996467e+04 77 251437 274520.212 -2.308321e+04 78 197295 274520.212 -7.722521e+04 79 158163 155527.268 2.635732e+03 80 155529 155527.268 1.731707e+00 81 132672 155527.268 -2.285527e+04 82 377205 274520.212 1.026848e+05 83 145905 193294.429 -4.738943e+04 84 223701 274520.212 -5.081921e+04 85 80953 59727.100 2.122590e+04 86 130805 155527.268 -2.472227e+04 87 135082 155527.268 -2.044527e+04 88 300805 274520.212 2.628479e+04 89 271806 274520.212 -2.714212e+03 90 150949 274520.212 -1.235712e+05 91 225805 274520.212 -4.871521e+04 92 197389 193294.429 4.094571e+03 93 156583 155527.268 1.055732e+03 94 222599 193294.429 2.930457e+04 95 261601 193294.429 6.830657e+04 96 178489 155527.268 2.296173e+04 97 200657 155527.268 4.512973e+04 98 259084 193294.429 6.578957e+04 99 313075 274520.212 3.855479e+04 100 346933 274520.212 7.241279e+04 101 246440 274520.212 -2.808021e+04 102 252444 193294.429 5.914957e+04 103 159965 274520.212 -1.145552e+05 104 43287 9223.143 3.406386e+04 105 172239 193294.429 -2.105543e+04 106 183738 274520.212 -9.078221e+04 107 227681 155527.268 7.215373e+04 108 260464 274520.212 -1.405621e+04 109 106288 155527.268 -4.923927e+04 110 109632 193294.429 -8.366243e+04 111 268905 260138.333 8.766667e+03 112 266805 274520.212 -7.715212e+03 113 23623 9223.143 1.439986e+04 114 152474 193294.429 -4.082043e+04 115 61857 59727.100 2.129900e+03 116 144889 155527.268 -1.063827e+04 117 346600 274520.212 7.207979e+04 118 21054 9223.143 1.183086e+04 119 224051 155527.268 6.852373e+04 120 31414 59727.100 -2.831310e+04 121 261043 274520.212 -1.347721e+04 122 197819 155527.268 4.229173e+04 123 154984 193294.429 -3.831043e+04 124 112933 155527.268 -4.259427e+04 125 38214 59727.100 -2.151310e+04 126 158671 155527.268 3.143732e+03 127 302148 260138.333 4.200967e+04 128 177918 155527.268 2.239073e+04 129 350552 260138.333 9.041367e+04 130 275578 274520.212 1.057788e+03 131 368746 274520.212 9.422579e+04 132 172464 155527.268 1.693673e+04 133 94381 155527.268 -6.114627e+04 134 243875 274520.212 -3.064521e+04 135 382487 274520.212 1.079668e+05 136 114525 155527.268 -4.100227e+04 137 335681 274520.212 6.116079e+04 138 147989 193294.429 -4.530543e+04 139 216638 155527.268 6.111073e+04 140 192862 193294.429 -4.324286e+02 141 184818 274520.212 -8.970221e+04 142 336707 274520.212 6.218679e+04 143 215836 193294.429 2.254157e+04 144 173260 193294.429 -2.003443e+04 145 271773 274520.212 -2.747212e+03 146 130908 155527.268 -2.461927e+04 147 204009 193294.429 1.071457e+04 148 245514 274520.212 -2.900621e+04 149 1 9223.143 -9.222143e+03 150 14688 9223.143 5.464857e+03 151 98 9223.143 -9.125143e+03 152 455 9223.143 -8.768143e+03 153 0 9223.143 -9.223143e+03 154 0 9223.143 -9.223143e+03 155 195765 193294.429 2.470571e+03 156 326038 274520.212 5.151779e+04 157 0 9223.143 -9.223143e+03 158 203 9223.143 -9.020143e+03 159 7199 9223.143 -2.024143e+03 160 46660 59727.100 -1.306710e+04 161 17547 9223.143 8.323857e+03 162 107465 155527.268 -4.806227e+04 163 969 9223.143 -8.254143e+03 164 173102 193294.429 -2.019243e+04 > 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/403wh1323627339.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/5llzv1323627339.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/6alqj1323627339.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/7qkkj1323627339.tab") + } > > try(system("convert tmp/2go3o1323627339.ps tmp/2go3o1323627339.png",intern=TRUE)) character(0) > try(system("convert tmp/35bpd1323627339.ps tmp/35bpd1323627339.png",intern=TRUE)) character(0) > try(system("convert tmp/403wh1323627339.ps tmp/403wh1323627339.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.398 0.258 3.851