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(162687 + ,48 + ,82 + ,20465 + ,233285 + ,75 + ,96 + ,33629 + ,7215 + ,0 + ,0 + ,1423 + ,164587 + ,74 + ,90 + ,25629 + ,283430 + ,92 + ,132 + ,54002 + ,546996 + ,137 + ,140 + ,151036 + ,192501 + ,65 + ,100 + ,33287 + ,213538 + ,97 + ,132 + ,31172 + ,182282 + ,62 + ,121 + ,28113 + ,336547 + ,72 + ,108 + ,57803 + ,122275 + ,50 + ,63 + ,49830 + ,203938 + ,88 + ,118 + ,52143 + ,119300 + ,68 + ,71 + ,21055 + ,220796 + ,79 + ,112 + ,47007 + ,174005 + ,56 + ,63 + ,28735 + ,156326 + ,54 + ,86 + ,59147 + ,164063 + ,101 + ,148 + ,78950 + ,90025 + ,13 + ,54 + ,13497 + ,179987 + ,80 + ,134 + ,46154 + ,47066 + ,19 + ,57 + ,53249 + ,109572 + ,33 + ,59 + ,10726 + ,241285 + ,99 + ,113 + ,83700 + ,208339 + ,38 + ,96 + ,40400 + ,164166 + ,68 + ,96 + ,33797 + ,159763 + ,54 + ,78 + ,36205 + ,207078 + ,63 + ,80 + ,30165 + ,217028 + ,66 + ,93 + ,58534 + ,201536 + ,90 + ,109 + ,44663 + ,408960 + ,75 + ,115 + ,92556 + ,250260 + ,68 + ,94 + ,40078 + ,216527 + ,69 + ,118 + ,34711 + ,212949 + ,80 + ,71 + ,31076 + ,164248 + ,59 + ,75 + ,74608 + ,276436 + ,135 + ,108 + ,58092 + ,238654 + ,75 + ,100 + ,42009 + ,0 + ,0 + ,0 + ,0 + ,233971 + ,54 + ,121 + ,36022 + ,149649 + ,62 + ,51 + ,23333 + ,161703 + ,46 + ,119 + ,53349 + ,254893 + ,83 + ,136 + ,92596 + ,269492 + ,106 + ,84 + ,49598 + ,169526 + ,51 + ,136 + ,44093 + ,107893 + ,27 + ,84 + ,84205 + ,229714 + ,78 + ,92 + ,63369 + ,139667 + ,71 + ,103 + ,60132 + ,175983 + ,44 + ,88 + ,37403 + ,81407 + ,23 + ,106 + ,24460 + ,251259 + ,78 + ,96 + ,46456 + ,239807 + ,60 + ,124 + ,66616 + ,172743 + ,73 + ,106 + ,41554 + ,48188 + ,12 + ,82 + ,22346 + ,169355 + ,104 + ,87 + ,30874 + ,335398 + ,95 + ,97 + ,68701 + ,244729 + ,57 + ,107 + ,35728 + ,208286 + ,68 + ,130 + ,29010 + ,159913 + ,44 + ,43 + ,23110 + ,232137 + ,62 + ,96 + ,38844 + ,101694 + ,26 + ,100 + ,27084 + ,157258 + ,67 + ,91 + ,35139 + ,211586 + ,36 + ,136 + ,57476 + ,181076 + ,56 + ,128 + ,33277 + ,158024 + ,55 + ,87 + ,31141 + ,141491 + ,54 + ,74 + ,61281 + ,130108 + ,61 + ,96 + ,25820 + ,166420 + ,27 + ,102 + ,23284 + ,135509 + ,64 + ,122 + ,35378 + ,195043 + ,76 + ,144 + ,74990 + ,138708 + ,93 + ,90 + ,29653 + ,116552 + ,59 + ,97 + ,64622 + ,31970 + ,5 + ,78 + ,4157 + ,277661 + ,58 + ,72 + ,29245 + ,167825 + ,47 + ,53 + ,50008 + ,135926 + ,88 + ,120 + ,52338 + ,136647 + ,57 + ,66 + ,13310 + ,171518 + ,81 + ,150 + ,92901 + ,108980 + ,35 + ,117 + ,10956 + ,183471 + ,102 + ,123 + ,34241 + ,167426 + ,73 + ,122 + ,75043 + ,112510 + ,32 + ,75 + ,21152 + ,92421 + ,34 + ,122 + ,42249 + ,117169 + ,80 + ,106 + ,42005 + ,304603 + ,49 + ,116 + ,41152 + ,75101 + ,30 + ,86 + ,14399 + ,145043 + ,57 + ,90 + ,28263 + ,95827 + ,54 + ,87 + ,17215 + ,173931 + ,38 + ,99 + ,48140 + ,250424 + ,63 + ,132 + ,62897 + ,115367 + ,58 + ,96 + ,22883 + ,125839 + ,49 + ,91 + ,41622 + ,164078 + ,46 + ,77 + ,40715 + ,158931 + ,51 + ,104 + ,65897 + ,190382 + ,90 + ,100 + ,76542 + ,155226 + ,45 + ,94 + ,37477 + ,146159 + ,28 + ,60 + ,53216 + ,62641 + ,26 + ,46 + ,40911 + ,258585 + ,54 + ,135 + ,57021 + ,199841 + ,96 + ,99 + ,73116 + ,19349 + ,13 + ,2 + ,3895 + ,247280 + ,43 + ,96 + ,46609 + ,164984 + ,42 + ,109 + ,29351 + ,72128 + ,30 + ,15 + ,2325 + ,104253 + ,59 + ,68 + ,31747 + ,151090 + ,73 + ,102 + ,32665 + ,147990 + ,40 + ,93 + ,19249 + ,87448 + ,36 + ,46 + ,15292 + ,27676 + ,2 + ,59 + ,5842 + ,170326 + ,103 + ,116 + ,33994 + ,132148 + ,30 + ,29 + ,13018 + ,0 + ,0 + ,0 + ,0 + ,133868 + ,78 + ,91 + ,98177 + ,109001 + ,25 + ,76 + ,37941 + ,158833 + ,59 + ,86 + ,31032 + ,150013 + ,60 + ,84 + ,32683 + ,89887 + ,36 + ,65 + ,34545 + ,3616 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,216479 + ,51 + ,89 + ,27525 + ,177323 + ,79 + ,114 + ,66856 + ,177948 + ,30 + ,132 + ,28549 + ,140106 + ,43 + ,100 + ,38610 + ,43410 + ,7 + ,3 + ,2781 + ,206059 + ,92 + ,109 + ,41211 + ,109873 + ,32 + ,81 + ,22698 + ,157084 + ,84 + ,125 + ,41194 + ,60493 + ,3 + ,48 + ,32689 + ,19764 + ,10 + ,8 + ,5752 + ,177559 + ,47 + ,80 + ,26757 + ,154169 + ,44 + ,107 + ,22527 + ,164249 + ,54 + ,140 + ,44810 + ,11796 + ,1 + ,8 + ,0 + ,10674 + ,0 + ,0 + ,0 + ,151322 + ,46 + ,56 + ,100674 + ,6836 + ,0 + ,4 + ,0 + ,174712 + ,51 + ,70 + ,57786 + ,5118 + ,5 + ,0 + ,0 + ,40248 + ,8 + ,14 + ,5444 + ,0 + ,0 + ,0 + ,0 + ,127628 + ,38 + ,104 + ,28470 + ,88837 + ,21 + ,89 + ,61849 + ,7131 + ,0 + ,0 + ,0 + ,9056 + ,0 + ,12 + ,2179 + ,97191 + ,26 + ,60 + ,8019 + ,157478 + ,53 + ,95 + ,39644 + ,125583 + ,31 + ,88 + ,23494) + ,dim=c(4 + ,144) + ,dimnames=list(c('time' + ,'bloggedcomputations' + ,'feedbackpr' + ,'characters') + ,1:144)) > y <- array(NA,dim=c(4,144),dimnames=list(c('time','bloggedcomputations','feedbackpr','characters'),1:144)) > 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 = '' > par2 = 'none' > 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] 162687 233285 7215 164587 283430 546996 192501 213538 182282 336547 [11] 122275 203938 119300 220796 174005 156326 164063 90025 179987 47066 [21] 109572 241285 208339 164166 159763 207078 217028 201536 408960 250260 [31] 216527 212949 164248 276436 238654 0 233971 149649 161703 254893 [41] 269492 169526 107893 229714 139667 175983 81407 251259 239807 172743 [51] 48188 169355 335398 244729 208286 159913 232137 101694 157258 211586 [61] 181076 158024 141491 130108 166420 135509 195043 138708 116552 31970 [71] 277661 167825 135926 136647 171518 108980 183471 167426 112510 92421 [81] 117169 304603 75101 145043 95827 173931 250424 115367 125839 164078 [91] 158931 190382 155226 146159 62641 258585 199841 19349 247280 164984 [101] 72128 104253 151090 147990 87448 27676 170326 132148 0 133868 [111] 109001 158833 150013 89887 3616 0 216479 177323 177948 140106 [121] 43410 206059 109873 157084 60493 19764 177559 154169 164249 11796 [131] 10674 151322 6836 174712 5118 40248 0 127628 88837 7131 [141] 9056 97191 157478 125583 > 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 3616 5118 6836 7131 7215 9056 10674 11796 19349 19764 4 1 1 1 1 1 1 1 1 1 1 27676 31970 40248 43410 47066 48188 60493 62641 72128 75101 81407 1 1 1 1 1 1 1 1 1 1 1 87448 88837 89887 90025 92421 95827 97191 101694 104253 107893 108980 1 1 1 1 1 1 1 1 1 1 1 109001 109572 109873 112510 115367 116552 117169 119300 122275 125583 125839 1 1 1 1 1 1 1 1 1 1 1 127628 130108 132148 133868 135509 135926 136647 138708 139667 140106 141491 1 1 1 1 1 1 1 1 1 1 1 145043 146159 147990 149649 150013 151090 151322 154169 155226 156326 157084 1 1 1 1 1 1 1 1 1 1 1 157258 157478 158024 158833 158931 159763 159913 161703 162687 164063 164078 1 1 1 1 1 1 1 1 1 1 1 164166 164248 164249 164587 164984 166420 167426 167825 169355 169526 170326 1 1 1 1 1 1 1 1 1 1 1 171518 172743 173931 174005 174712 175983 177323 177559 177948 179987 181076 1 1 1 1 1 1 1 1 1 1 1 182282 183471 190382 192501 195043 199841 201536 203938 206059 207078 208286 1 1 1 1 1 1 1 1 1 1 1 208339 211586 212949 213538 216479 216527 217028 220796 229714 232137 233285 1 1 1 1 1 1 1 1 1 1 1 233971 238654 239807 241285 244729 247280 250260 250424 251259 254893 258585 1 1 1 1 1 1 1 1 1 1 1 269492 276436 277661 283430 304603 335398 336547 408960 546996 1 1 1 1 1 1 1 1 1 > colnames(x) [1] "time" "bloggedcomputations" "feedbackpr" [4] "characters" > colnames(x)[par1] [1] "time" > x[,par1] [1] 162687 233285 7215 164587 283430 546996 192501 213538 182282 336547 [11] 122275 203938 119300 220796 174005 156326 164063 90025 179987 47066 [21] 109572 241285 208339 164166 159763 207078 217028 201536 408960 250260 [31] 216527 212949 164248 276436 238654 0 233971 149649 161703 254893 [41] 269492 169526 107893 229714 139667 175983 81407 251259 239807 172743 [51] 48188 169355 335398 244729 208286 159913 232137 101694 157258 211586 [61] 181076 158024 141491 130108 166420 135509 195043 138708 116552 31970 [71] 277661 167825 135926 136647 171518 108980 183471 167426 112510 92421 [81] 117169 304603 75101 145043 95827 173931 250424 115367 125839 164078 [91] 158931 190382 155226 146159 62641 258585 199841 19349 247280 164984 [101] 72128 104253 151090 147990 87448 27676 170326 132148 0 133868 [111] 109001 158833 150013 89887 3616 0 216479 177323 177948 140106 [121] 43410 206059 109873 157084 60493 19764 177559 154169 164249 11796 [131] 10674 151322 6836 174712 5118 40248 0 127628 88837 7131 [141] 9056 97191 157478 125583 > 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/1tw4t1324606472.tab") + } + } > m Conditional inference tree with 6 terminal nodes Response: time Inputs: bloggedcomputations, feedbackpr, characters Number of observations: 144 1) bloggedcomputations <= 26; criterion = 1, statistic = 84.631 2) bloggedcomputations <= 10; criterion = 1, statistic = 20.889 3)* weights = 18 2) bloggedcomputations > 10 4)* weights = 10 1) bloggedcomputations > 26 5) bloggedcomputations <= 61; criterion = 1, statistic = 32.389 6) feedbackpr <= 104; criterion = 0.997, statistic = 10.722 7)* weights = 48 6) feedbackpr > 104 8)* weights = 15 5) bloggedcomputations > 61 9) characters <= 46154; criterion = 1, statistic = 16.672 10)* weights = 28 9) characters > 46154 11)* weights = 25 > postscript(file="/var/www/rcomp/tmp/2048e1324606472.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/3ey9m1324606472.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 162687 146551.3 16135.6667 2 233285 183053.4 50231.6429 3 7215 15833.5 -8618.5000 4 164587 183053.4 -18466.3571 5 283430 240066.1 43363.8800 6 546996 240066.1 306929.8800 7 192501 183053.4 9447.6429 8 213538 183053.4 30484.6429 9 182282 183053.4 -771.3571 10 336547 240066.1 96480.8800 11 122275 146551.3 -24276.3333 12 203938 240066.1 -36128.1200 13 119300 183053.4 -63753.3571 14 220796 240066.1 -19270.1200 15 174005 146551.3 27453.6667 16 156326 146551.3 9774.6667 17 164063 240066.1 -76003.1200 18 90025 74539.9 15485.1000 19 179987 183053.4 -3066.3571 20 47066 74539.9 -27473.9000 21 109572 146551.3 -36979.3333 22 241285 240066.1 1218.8800 23 208339 146551.3 61787.6667 24 164166 183053.4 -18887.3571 25 159763 146551.3 13211.6667 26 207078 183053.4 24024.6429 27 217028 240066.1 -23038.1200 28 201536 183053.4 18482.6429 29 408960 240066.1 168893.8800 30 250260 183053.4 67206.6429 31 216527 183053.4 33473.6429 32 212949 183053.4 29895.6429 33 164248 146551.3 17696.6667 34 276436 240066.1 36369.8800 35 238654 183053.4 55600.6429 36 0 15833.5 -15833.5000 37 233971 191222.5 42748.5333 38 149649 183053.4 -33404.3571 39 161703 191222.5 -29519.4667 40 254893 240066.1 14826.8800 41 269492 240066.1 29425.8800 42 169526 191222.5 -21696.4667 43 107893 146551.3 -38658.3333 44 229714 240066.1 -10352.1200 45 139667 240066.1 -100399.1200 46 175983 146551.3 29431.6667 47 81407 74539.9 6867.1000 48 251259 240066.1 11192.8800 49 239807 191222.5 48584.5333 50 172743 183053.4 -10310.3571 51 48188 74539.9 -26351.9000 52 169355 183053.4 -13698.3571 53 335398 240066.1 95331.8800 54 244729 191222.5 53506.5333 55 208286 183053.4 25232.6429 56 159913 146551.3 13361.6667 57 232137 183053.4 49083.6429 58 101694 74539.9 27154.1000 59 157258 183053.4 -25795.3571 60 211586 191222.5 20363.5333 61 181076 191222.5 -10146.4667 62 158024 146551.3 11472.6667 63 141491 146551.3 -5060.3333 64 130108 146551.3 -16443.3333 65 166420 146551.3 19868.6667 66 135509 183053.4 -47544.3571 67 195043 240066.1 -45023.1200 68 138708 183053.4 -44345.3571 69 116552 146551.3 -29999.3333 70 31970 15833.5 16136.5000 71 277661 146551.3 131109.6667 72 167825 146551.3 21273.6667 73 135926 240066.1 -104140.1200 74 136647 146551.3 -9904.3333 75 171518 240066.1 -68548.1200 76 108980 191222.5 -82242.4667 77 183471 183053.4 417.6429 78 167426 240066.1 -72640.1200 79 112510 146551.3 -34041.3333 80 92421 191222.5 -98801.4667 81 117169 183053.4 -65884.3571 82 304603 191222.5 113380.5333 83 75101 146551.3 -71450.3333 84 145043 146551.3 -1508.3333 85 95827 146551.3 -50724.3333 86 173931 146551.3 27379.6667 87 250424 240066.1 10357.8800 88 115367 146551.3 -31184.3333 89 125839 146551.3 -20712.3333 90 164078 146551.3 17526.6667 91 158931 146551.3 12379.6667 92 190382 240066.1 -49684.1200 93 155226 146551.3 8674.6667 94 146159 146551.3 -392.3333 95 62641 74539.9 -11898.9000 96 258585 191222.5 67362.5333 97 199841 240066.1 -40225.1200 98 19349 74539.9 -55190.9000 99 247280 146551.3 100728.6667 100 164984 191222.5 -26238.4667 101 72128 146551.3 -74423.3333 102 104253 146551.3 -42298.3333 103 151090 183053.4 -31963.3571 104 147990 146551.3 1438.6667 105 87448 146551.3 -59103.3333 106 27676 15833.5 11842.5000 107 170326 183053.4 -12727.3571 108 132148 146551.3 -14403.3333 109 0 15833.5 -15833.5000 110 133868 240066.1 -106198.1200 111 109001 74539.9 34461.1000 112 158833 146551.3 12281.6667 113 150013 146551.3 3461.6667 114 89887 146551.3 -56664.3333 115 3616 15833.5 -12217.5000 116 0 15833.5 -15833.5000 117 216479 146551.3 69927.6667 118 177323 240066.1 -62743.1200 119 177948 191222.5 -13274.4667 120 140106 146551.3 -6445.3333 121 43410 15833.5 27576.5000 122 206059 183053.4 23005.6429 123 109873 146551.3 -36678.3333 124 157084 183053.4 -25969.3571 125 60493 15833.5 44659.5000 126 19764 15833.5 3930.5000 127 177559 146551.3 31007.6667 128 154169 191222.5 -37053.4667 129 164249 191222.5 -26973.4667 130 11796 15833.5 -4037.5000 131 10674 15833.5 -5159.5000 132 151322 146551.3 4770.6667 133 6836 15833.5 -8997.5000 134 174712 146551.3 28160.6667 135 5118 15833.5 -10715.5000 136 40248 15833.5 24414.5000 137 0 15833.5 -15833.5000 138 127628 146551.3 -18923.3333 139 88837 74539.9 14297.1000 140 7131 15833.5 -8702.5000 141 9056 15833.5 -6777.5000 142 97191 74539.9 22651.1000 143 157478 146551.3 10926.6667 144 125583 146551.3 -20968.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/4j1ef1324606472.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/518fa1324606472.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/6ku291324606472.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/7h4py1324606472.tab") + } > > try(system("convert tmp/2048e1324606472.ps tmp/2048e1324606472.png",intern=TRUE)) character(0) > try(system("convert tmp/3ey9m1324606472.ps tmp/3ey9m1324606472.png",intern=TRUE)) character(0) > try(system("convert tmp/4j1ef1324606472.ps tmp/4j1ef1324606472.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.000 0.120 3.106