R version 2.12.0 (2010-10-15) Copyright (C) 2010 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 + ,3 + ,96 + ,197623 + ,70 + ,477 + ,4 + ,75 + ,233139 + ,78 + ,701 + ,16 + ,70 + ,221690 + ,106 + ,1150 + ,2 + ,134 + ,177540 + ,53 + ,395 + ,1 + ,69 + ,70849 + ,28 + ,179 + ,3 + ,8 + ,566234 + ,130 + ,2446 + ,0 + ,169 + ,33186 + ,19 + ,111 + ,0 + ,1 + ,226511 + ,61 + ,756 + ,7 + ,87 + ,245577 + ,46 + ,638 + ,0 + ,92 + ,317443 + ,114 + ,831 + ,0 + ,96 + ,248379 + ,124 + ,706 + ,7 + ,119 + ,200620 + ,79 + ,749 + ,10 + ,57 + ,367785 + ,82 + ,1184 + ,4 + ,139 + ,266325 + ,87 + ,717 + ,10 + ,87 + ,394271 + ,183 + ,1744 + ,0 + ,176 + ,335567 + ,76 + ,845 + ,8 + ,114 + ,407650 + ,168 + ,1360 + ,4 + ,119 + ,182016 + ,57 + ,514 + ,3 + ,103 + ,267365 + ,88 + ,692 + ,8 + ,135 + ,279428 + ,72 + ,847 + ,0 + ,123 + ,484574 + ,105 + ,1369 + ,1 + ,89 + ,196721 + ,43 + ,494 + ,5 + ,74 + ,197899 + ,56 + ,628 + ,9 + ,103 + ,256290 + ,131 + ,1364 + ,1 + ,158 + ,255126 + ,132 + ,1067 + ,0 + ,113 + ,281816 + ,131 + ,1112 + ,5 + ,100 + ,278027 + ,89 + ,636 + ,0 + ,117 + ,173134 + ,55 + ,610 + ,0 + ,59 + ,382760 + ,76 + ,1195 + ,0 + ,142 + ,302413 + ,83 + ,1021 + ,3 + ,136 + ,251255 + ,81 + ,724 + ,6 + ,50 + ,355456 + ,96 + ,868 + ,1 + ,141 + ,109546 + ,45 + ,374 + ,4 + ,46 + ,427915 + ,102 + ,1290 + ,4 + ,141 + ,273950 + ,56 + ,1186 + ,0 + ,83 + ,427825 + ,124 + ,1344 + ,0 + ,112 + ,247287 + ,88 + ,673 + ,2 + ,79 + ,115658 + ,33 + ,284 + ,1 + ,33 + ,386534 + ,205 + ,1299 + ,2 + ,149 + ,340132 + ,83 + ,1546 + ,10 + ,126 + ,194127 + ,71 + ,715 + ,10 + ,80 + ,213258 + ,79 + ,676 + ,5 + ,84 + ,182398 + ,65 + ,487 + ,6 + ,68 + ,157164 + ,84 + ,1051 + ,1 + ,50 + ,457592 + ,153 + ,2084 + ,2 + ,101 + ,78800 + ,42 + ,330 + ,2 + ,20 + ,213831 + ,81 + ,683 + ,0 + ,101 + ,368086 + ,122 + ,1410 + ,10 + ,150 + ,203104 + ,62 + ,1004 + ,3 + ,115 + ,244371 + ,77 + ,688 + ,0 + ,98 + ,24188 + ,24 + ,218 + ,0 + ,8 + ,399093 + ,331 + ,862 + ,8 + ,88 + ,65029 + ,17 + ,255 + ,5 + ,21 + ,101097 + ,64 + ,454 + ,3 + ,30 + ,297973 + ,61 + ,1185 + ,1 + ,97 + ,352671 + ,88 + ,728 + ,5 + ,149 + ,367083 + ,203 + ,1207 + ,6 + ,132 + ,371178 + ,148 + ,1089 + ,0 + ,161 + ,269973 + ,88 + ,884 + ,12 + ,89 + ,389761 + ,149 + ,1332 + ,10 + ,160 + ,315924 + ,121 + ,1190 + ,12 + ,139 + ,285807 + ,121 + ,1233 + ,11 + ,104 + ,282351 + ,90 + ,987 + ,8 + ,99 + ,250558 + ,73 + ,619 + ,3 + ,56 + ,265696 + ,71 + ,528 + ,0 + ,163 + ,215915 + ,138 + ,651 + ,6 + ,93 + ,247349 + ,154 + ,862 + ,10 + ,85 + ,260919 + ,86 + ,913 + ,2 + ,150 + ,182308 + ,71 + ,635 + ,5 + ,143 + ,256761 + ,72 + ,898 + ,13 + ,107 + ,73566 + ,32 + ,385 + ,6 + ,22 + ,263796 + ,89 + ,767 + ,7 + ,85 + ,207899 + ,56 + ,818 + ,2 + ,85 + ,228779 + ,67 + ,779 + ,4 + ,131 + ,363571 + ,89 + ,997 + ,4 + ,140 + ,382785 + ,98 + ,1233 + ,3 + ,152 + ,220401 + ,109 + ,586 + ,6 + ,81 + ,225097 + ,67 + ,751 + ,2 + ,136 + ,215445 + ,68 + ,734 + ,0 + ,102 + ,188786 + ,49 + ,711 + ,1 + ,69 + ,481148 + ,130 + ,1268 + ,1 + ,161 + ,145943 + ,70 + ,653 + ,5 + ,30 + ,292287 + ,108 + ,700 + ,2 + ,120 + ,80953 + ,25 + ,437 + ,0 + ,49 + ,164260 + ,57 + ,863 + ,0 + ,62 + ,179344 + ,61 + ,459 + ,6 + ,76 + ,413462 + ,220 + ,1580 + ,1 + ,85 + ,358697 + ,125 + ,1024 + ,0 + ,146 + ,180679 + ,106 + ,1051 + ,1 + ,165 + ,298696 + ,102 + ,843 + ,1 + ,89 + ,288706 + ,82 + ,725 + ,3 + ,167 + ,197956 + ,66 + ,621 + ,10 + ,48 + ,282361 + ,77 + ,1128 + ,1 + ,149 + ,329202 + ,88 + ,969 + ,4 + ,75 + ,221875 + ,44 + ,669 + ,5 + ,100 + ,277071 + ,63 + ,674 + ,5 + ,114 + ,305984 + ,87 + ,820 + ,0 + ,165 + ,416032 + ,161 + ,1366 + ,12 + ,155 + ,412530 + ,116 + ,1493 + ,13 + ,165 + ,297080 + ,141 + ,893 + ,9 + ,121 + ,318235 + ,68 + ,900 + ,0 + ,156 + ,200486 + ,194 + ,704 + ,0 + ,79 + ,43287 + ,14 + ,214 + ,4 + ,13 + ,189520 + ,84 + ,733 + ,4 + ,89 + ,255152 + ,153 + ,855 + ,0 + ,110 + ,288617 + ,56 + ,1251 + ,0 + ,129 + ,314167 + ,93 + ,1069 + ,0 + ,169 + ,170268 + ,86 + ,426 + ,0 + ,28 + ,164399 + ,99 + ,954 + ,0 + ,118 + ,350667 + ,76 + ,674 + ,5 + ,82 + ,303273 + ,90 + ,696 + ,0 + ,148 + ,23623 + ,11 + ,156 + ,0 + ,12 + ,195849 + ,74 + ,779 + ,0 + ,146 + ,61857 + ,25 + ,192 + ,4 + ,23 + ,184709 + ,52 + ,546 + ,0 + ,83 + ,428191 + ,121 + ,1213 + ,1 + ,163 + ,21054 + ,16 + ,146 + ,0 + ,4 + ,252805 + ,52 + ,866 + ,5 + ,81 + ,31961 + ,22 + ,200 + ,0 + ,18 + ,351541 + ,122 + ,1336 + ,3 + ,118 + ,246359 + ,71 + ,726 + ,7 + ,76 + ,187003 + ,95 + ,522 + ,14 + ,55 + ,172442 + ,56 + ,714 + ,3 + ,57 + ,38214 + ,34 + ,276 + ,0 + ,16 + ,241539 + ,48 + ,789 + ,3 + ,88 + ,358276 + ,83 + ,1031 + ,0 + ,137 + ,209821 + ,64 + ,502 + ,0 + ,50 + ,441447 + ,86 + ,1678 + ,4 + ,147 + ,348017 + ,99 + ,884 + ,0 + ,163 + ,439634 + ,131 + ,1200 + ,3 + ,142 + ,208962 + ,40 + ,547 + ,0 + ,77 + ,105332 + ,44 + ,422 + ,0 + ,42 + ,311111 + ,355 + ,995 + ,4 + ,94 + ,460033 + ,192 + ,1554 + ,5 + ,126 + ,159057 + ,58 + ,563 + ,16 + ,63 + ,411980 + ,136 + ,1811 + ,5 + ,127 + ,173486 + ,80 + ,749 + ,5 + ,59 + ,284582 + ,51 + ,648 + ,2 + ,117 + ,283913 + ,100 + ,905 + ,1 + ,110 + ,234203 + ,120 + ,659 + ,0 + ,44 + ,386740 + ,123 + ,1611 + ,9 + ,95 + ,246963 + ,92 + ,811 + ,1 + ,128 + ,173260 + ,63 + ,716 + ,3 + ,41 + ,346730 + ,107 + ,1034 + ,11 + ,146 + ,176654 + ,58 + ,732 + ,5 + ,147 + ,259048 + ,90 + ,1033 + ,2 + ,119 + ,312540 + ,111 + ,850 + ,1 + ,185 + ,1 + ,0 + ,0 + ,9 + ,0 + ,14688 + ,10 + ,85 + ,0 + ,4 + ,98 + ,1 + ,0 + ,0 + ,0 + ,455 + ,2 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,283222 + ,91 + ,806 + ,2 + ,85 + ,409280 + ,163 + ,1128 + ,3 + ,157 + ,0 + ,0 + ,0 + ,0 + ,0 + ,203 + ,4 + ,0 + ,0 + ,0 + ,7199 + ,5 + ,74 + ,0 + ,7 + ,46660 + ,20 + ,259 + ,0 + ,12 + ,17547 + ,5 + ,69 + ,0 + ,0 + ,121550 + ,46 + ,309 + ,0 + ,37 + ,969 + ,2 + ,0 + ,0 + ,0 + ,242228 + ,73 + ,687 + ,2 + ,62) + ,dim=c(5 + ,164) + ,dimnames=list(c('Tijd_RFC' + ,'#Logins' + ,'#Gedeelde_Compendia' + ,'#Blogs' + ,'#Reviews+120tekens') + ,1:164)) > y <- array(NA,dim=c(5,164),dimnames=list(c('Tijd_RFC','#Logins','#Gedeelde_Compendia','#Blogs','#Reviews+120tekens'),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] "Tijd_RFC" > 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 382760 [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 0 0 283222 409280 0 203 7199 46660 [161] 17547 121550 969 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]) 0 1 98 203 455 969 7199 14688 17547 21054 23623 3 1 1 1 1 1 1 1 1 1 1 24188 31961 33186 38214 43287 46660 61857 65029 70849 73566 78800 1 1 1 1 1 1 1 1 1 1 1 80953 101097 105332 109546 115658 121550 145943 157164 159057 164260 164399 1 1 1 1 1 1 1 1 1 1 1 170268 172442 173134 173260 173486 176654 177540 179344 180679 182016 182308 1 1 1 1 1 1 1 1 1 1 1 182398 184709 187003 188786 189520 194127 195849 196721 197623 197899 197956 1 1 1 1 1 1 1 1 1 1 1 200486 200620 203104 207899 208962 209821 213258 213831 215445 215915 220401 1 1 1 1 1 1 1 1 1 1 1 221690 221875 225097 226511 228779 233139 234203 241539 242228 244371 245577 1 1 1 1 1 1 1 1 1 1 1 246359 246963 247287 247349 248379 250558 251255 252805 255126 255152 256290 1 1 1 1 1 1 1 1 1 1 1 256761 259048 260919 263796 265696 266325 267365 269973 273950 277071 278027 1 1 1 1 1 1 1 1 1 1 1 278691 279428 281816 282351 282361 283222 283913 284582 285807 288617 288706 1 1 1 1 1 1 1 1 1 1 1 292287 297080 297973 298696 302413 303273 305984 311111 312540 314167 315924 1 1 1 1 1 1 1 1 1 1 1 317443 318235 329202 335567 340132 346730 348017 350667 351541 352671 355456 1 1 1 1 1 1 1 1 1 1 1 358276 358697 363571 367083 367785 368086 371178 382760 382785 386534 386740 1 1 1 1 1 1 1 1 1 1 1 389761 394271 399093 407650 409280 411980 412530 413462 416032 427825 427915 1 1 1 1 1 1 1 1 1 1 1 428191 439634 441447 457592 460033 481148 484574 566234 1 1 1 1 1 1 1 1 > colnames(x) [1] "Tijd_RFC" "X.Logins" "X.Gedeelde_Compendia" [4] "X.Blogs" "X.Reviews.120tekens" > colnames(x)[par1] [1] "Tijd_RFC" > 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 382760 [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 0 0 283222 409280 0 203 7199 46660 [161] 17547 121550 969 242228 > if (par2 == 'none') { + m <- ctree(as.formula(paste(colnames(x)[par1],' ~ .',sep='')),data = x) + } > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/www/rcomp/tmp/14ok21324665547.tab") + } + } > m Conditional inference tree with 7 terminal nodes Response: Tijd_RFC Inputs: X.Logins, X.Gedeelde_Compendia, X.Blogs, X.Reviews.120tekens Number of observations: 164 1) X.Gedeelde_Compendia <= 454; criterion = 1, statistic = 128.724 2) X.Logins <= 24; criterion = 1, statistic = 25.961 3)* weights = 19 2) X.Logins > 24 4)* weights = 13 1) X.Gedeelde_Compendia > 454 5) X.Gedeelde_Compendia <= 1190; criterion = 1, statistic = 78.727 6) X.Reviews.120tekens <= 81; criterion = 1, statistic = 31.284 7)* weights = 30 6) X.Reviews.120tekens > 81 8) X.Gedeelde_Compendia <= 818; criterion = 0.998, statistic = 12.241 9)* weights = 35 8) X.Gedeelde_Compendia > 818 10)* weights = 39 5) X.Gedeelde_Compendia > 1190 11) X.Gedeelde_Compendia <= 1546; criterion = 0.967, statistic = 6.941 12)* weights = 20 11) X.Gedeelde_Compendia > 1546 13)* weights = 8 > postscript(file="/var/www/rcomp/tmp/2aejv1324665547.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/www/rcomp/tmp/3juvf1324665547.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 278691 244479.23 34211.7714 2 197623 205667.67 -8044.6667 3 233139 205667.67 27471.3333 4 221690 299057.31 -77367.3077 5 177540 100402.31 77137.6923 6 70849 100402.31 -29553.3077 7 566234 441469.88 124764.1250 8 33186 17376.21 15809.7895 9 226511 244479.23 -17968.2286 10 245577 244479.23 1097.7714 11 317443 299057.31 18385.6923 12 248379 244479.23 3899.7714 13 200620 205667.67 -5047.6667 14 367785 299057.31 68727.6923 15 266325 244479.23 21845.7714 16 394271 441469.88 -47198.8750 17 335567 299057.31 36509.6923 18 407650 386244.75 21405.2500 19 182016 244479.23 -62463.2286 20 267365 244479.23 22885.7714 21 279428 299057.31 -19629.3077 22 484574 386244.75 98329.2500 23 196721 205667.67 -8946.6667 24 197899 244479.23 -46580.2286 25 256290 386244.75 -129954.7500 26 255126 299057.31 -43931.3077 27 281816 299057.31 -17241.3077 28 278027 244479.23 33547.7714 29 173134 205667.67 -32533.6667 30 382760 386244.75 -3484.7500 31 302413 299057.31 3355.6923 32 251255 205667.67 45587.3333 33 355456 299057.31 56398.6923 34 109546 100402.31 9143.6923 35 427915 386244.75 41670.2500 36 273950 299057.31 -25107.3077 37 427825 386244.75 41580.2500 38 247287 205667.67 41619.3333 39 115658 100402.31 15255.6923 40 386534 386244.75 289.2500 41 340132 386244.75 -46112.7500 42 194127 205667.67 -11540.6667 43 213258 244479.23 -31221.2286 44 182398 205667.67 -23269.6667 45 157164 205667.67 -48503.6667 46 457592 441469.88 16122.1250 47 78800 100402.31 -21602.3077 48 213831 244479.23 -30648.2286 49 368086 386244.75 -18158.7500 50 203104 299057.31 -95953.3077 51 244371 244479.23 -108.2286 52 24188 17376.21 6811.7895 53 399093 299057.31 100035.6923 54 65029 17376.21 47652.7895 55 101097 100402.31 694.6923 56 297973 299057.31 -1084.3077 57 352671 244479.23 108191.7714 58 367083 386244.75 -19161.7500 59 371178 299057.31 72120.6923 60 269973 299057.31 -29084.3077 61 389761 386244.75 3516.2500 62 315924 299057.31 16866.6923 63 285807 386244.75 -100437.7500 64 282351 299057.31 -16706.3077 65 250558 205667.67 44890.3333 66 265696 244479.23 21216.7714 67 215915 244479.23 -28564.2286 68 247349 299057.31 -51708.3077 69 260919 299057.31 -38138.3077 70 182308 244479.23 -62171.2286 71 256761 299057.31 -42296.3077 72 73566 100402.31 -26836.3077 73 263796 244479.23 19316.7714 74 207899 244479.23 -36580.2286 75 228779 244479.23 -15700.2286 76 363571 299057.31 64513.6923 77 382785 386244.75 -3459.7500 78 220401 205667.67 14733.3333 79 225097 244479.23 -19382.2286 80 215445 244479.23 -29034.2286 81 188786 205667.67 -16881.6667 82 481148 386244.75 94903.2500 83 145943 205667.67 -59724.6667 84 292287 244479.23 47807.7714 85 80953 100402.31 -19449.3077 86 164260 205667.67 -41407.6667 87 179344 205667.67 -26323.6667 88 413462 441469.88 -28007.8750 89 358697 299057.31 59639.6923 90 180679 299057.31 -118378.3077 91 298696 299057.31 -361.3077 92 288706 244479.23 44226.7714 93 197956 205667.67 -7711.6667 94 282361 299057.31 -16696.3077 95 329202 205667.67 123534.3333 96 221875 244479.23 -22604.2286 97 277071 244479.23 32591.7714 98 305984 299057.31 6926.6923 99 416032 386244.75 29787.2500 100 412530 386244.75 26285.2500 101 297080 299057.31 -1977.3077 102 318235 299057.31 19177.6923 103 200486 205667.67 -5181.6667 104 43287 17376.21 25910.7895 105 189520 244479.23 -54959.2286 106 255152 299057.31 -43905.3077 107 288617 386244.75 -97627.7500 108 314167 299057.31 15109.6923 109 170268 100402.31 69865.6923 110 164399 299057.31 -134658.3077 111 350667 244479.23 106187.7714 112 303273 244479.23 58793.7714 113 23623 17376.21 6246.7895 114 195849 244479.23 -48630.2286 115 61857 100402.31 -38545.3077 116 184709 244479.23 -59770.2286 117 428191 386244.75 41946.2500 118 21054 17376.21 3677.7895 119 252805 205667.67 47137.3333 120 31961 17376.21 14584.7895 121 351541 386244.75 -34703.7500 122 246359 205667.67 40691.3333 123 187003 205667.67 -18664.6667 124 172442 205667.67 -33225.6667 125 38214 100402.31 -62188.3077 126 241539 244479.23 -2940.2286 127 358276 299057.31 59218.6923 128 209821 205667.67 4153.3333 129 441447 441469.88 -22.8750 130 348017 299057.31 48959.6923 131 439634 386244.75 53389.2500 132 208962 205667.67 3294.3333 133 105332 100402.31 4929.6923 134 311111 299057.31 12053.6923 135 460033 441469.88 18563.1250 136 159057 205667.67 -46610.6667 137 411980 441469.88 -29489.8750 138 173486 205667.67 -32181.6667 139 284582 244479.23 40102.7714 140 283913 299057.31 -15144.3077 141 234203 205667.67 28535.3333 142 386740 441469.88 -54729.8750 143 246963 244479.23 2483.7714 144 173260 205667.67 -32407.6667 145 346730 299057.31 47672.6923 146 176654 244479.23 -67825.2286 147 259048 299057.31 -40009.3077 148 312540 299057.31 13482.6923 149 1 17376.21 -17375.2105 150 14688 17376.21 -2688.2105 151 98 17376.21 -17278.2105 152 455 17376.21 -16921.2105 153 0 17376.21 -17376.2105 154 0 17376.21 -17376.2105 155 283222 244479.23 38742.7714 156 409280 299057.31 110222.6923 157 0 17376.21 -17376.2105 158 203 17376.21 -17173.2105 159 7199 17376.21 -10177.2105 160 46660 17376.21 29283.7895 161 17547 17376.21 170.7895 162 121550 100402.31 21147.6923 163 969 17376.21 -16407.2105 164 242228 205667.67 36560.3333 > if (par2 != 'none') { + print(cbind(as.factor(x[,par1]),predict(m))) + myt <- table(as.factor(x[,par1]),predict(m)) + print(myt) + } > postscript(file="/var/www/rcomp/tmp/47vyd1324665547.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/www/rcomp/tmp/53li21324665547.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/www/rcomp/tmp/6pkir1324665547.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/www/rcomp/tmp/7nfql1324665547.tab") + } > > try(system("convert tmp/2aejv1324665547.ps tmp/2aejv1324665547.png",intern=TRUE)) character(0) > try(system("convert tmp/3juvf1324665547.ps tmp/3juvf1324665547.png",intern=TRUE)) character(0) > try(system("convert tmp/47vyd1324665547.ps tmp/47vyd1324665547.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.970 0.150 3.111