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(240 + ,36 + ,278 + ,151036 + ,26258 + ,111 + ,28 + ,84 + ,92556 + ,14881 + ,91 + ,26 + ,129 + ,57803 + ,16957 + ,68 + ,27 + ,89 + ,68701 + ,18717 + ,57 + ,29 + ,60 + ,41152 + ,8464 + ,61 + ,31 + ,60 + ,92596 + ,26641 + ,77 + ,26 + ,67 + ,35728 + ,9724 + ,129 + ,30 + ,124 + ,54002 + ,20323 + ,217 + ,33 + ,100 + ,62897 + ,22557 + ,104 + ,36 + ,166 + ,57021 + ,14612 + ,117 + ,25 + ,302 + ,58092 + ,4362 + ,108 + ,19 + ,135 + ,29245 + ,6372 + ,99 + ,25 + ,255 + ,47007 + ,13448 + ,48 + ,24 + ,84 + ,42009 + ,14349 + ,58 + ,27 + ,58 + ,36022 + ,10881 + ,90 + ,27 + ,94 + ,83700 + ,20517 + ,87 + ,21 + ,114 + ,46456 + ,13275 + ,60 + ,26 + ,58 + ,38844 + ,8030 + ,40 + ,20 + ,90 + ,40078 + ,16318 + ,95 + ,24 + ,104 + ,46609 + ,11252 + ,61 + ,24 + ,94 + ,73116 + ,11219 + ,67 + ,36 + ,86 + ,74990 + ,19365 + ,67 + ,21 + ,94 + ,49598 + ,14426 + ,68 + ,25 + ,127 + ,40400 + ,2570 + ,54 + ,33 + ,49 + ,29010 + ,9863 + ,149 + ,25 + ,90 + ,58534 + ,15657 + ,80 + ,31 + ,113 + ,66616 + ,21224 + ,64 + ,30 + ,113 + ,52143 + ,20488 + ,52 + ,20 + ,74 + ,33629 + ,10265 + ,86 + ,38 + ,59 + ,57476 + ,7768 + ,42 + ,20 + ,111 + ,31076 + ,10462 + ,74 + ,24 + ,59 + ,63369 + ,5989 + ,85 + ,18 + ,109 + ,20465 + ,6200 + ,77 + ,28 + ,55 + ,44663 + ,15329 + ,38 + ,23 + ,70 + ,27525 + ,10698 + ,56 + ,21 + ,48 + ,57786 + ,6837 + ,65 + ,25 + ,88 + ,41211 + ,9188 + ,41 + ,28 + ,76 + ,34711 + ,9556 + ,54 + ,30 + ,54 + ,31172 + ,8247 + ,56 + ,25 + ,68 + ,37477 + ,7028 + ,32 + ,26 + ,56 + ,23284 + ,5753 + ,92 + ,28 + ,119 + ,28549 + ,6852 + ,55 + ,26 + ,171 + ,41554 + ,10615 + ,71 + ,31 + ,61 + ,29351 + ,9289 + ,77 + ,19 + ,81 + ,59147 + ,6185 + ,60 + ,34 + ,89 + ,92901 + ,12964 + ,46 + ,26 + ,71 + ,48140 + ,8895 + ,80 + ,21 + ,41 + ,36205 + ,5299 + ,37 + ,29 + ,97 + ,44810 + ,9435 + ,49 + ,17 + ,50 + ,28735 + ,5389 + ,89 + ,28 + ,69 + ,75043 + ,9970 + ,85 + ,22 + ,40 + ,37403 + ,13958 + ,25 + ,21 + ,160 + ,30165 + ,7233 + ,69 + ,23 + ,87 + ,76542 + ,13178 + ,75 + ,29 + ,72 + ,66856 + ,14884 + ,48 + ,21 + ,72 + ,40715 + ,7820 + ,53 + ,23 + ,89 + ,33287 + ,10165 + ,52 + ,33 + ,92 + ,78950 + ,24369 + ,52 + ,18 + ,37 + ,100674 + ,7642 + ,52 + ,29 + ,65 + ,33277 + ,13823 + ,45 + ,32 + ,267 + ,53349 + ,13073 + ,65 + ,25 + ,152 + ,29653 + ,9422 + ,54 + ,27 + ,111 + ,34241 + ,11580 + ,53 + ,34 + ,62 + ,44093 + ,15604 + ,49 + ,20 + ,61 + ,26757 + ,9831 + ,42 + ,29 + ,127 + ,33994 + ,12840 + ,57 + ,15 + ,81 + ,53216 + ,6616 + ,41 + ,23 + ,55 + ,31032 + ,7987 + ,82 + ,34 + ,142 + ,46154 + ,17327 + ,91 + ,26 + ,154 + ,25629 + ,8874 + ,72 + ,24 + ,158 + ,49830 + ,8058 + ,41 + ,30 + ,87 + ,28113 + ,8683 + ,95 + ,17 + ,87 + ,74608 + ,7192 + ,47 + ,21 + ,54 + ,39644 + ,13400 + ,50 + ,11 + ,74 + ,23110 + ,8374 + ,44 + ,23 + ,84 + ,32665 + ,8208 + ,37 + ,28 + ,59 + ,65897 + ,12112 + ,56 + ,19 + ,84 + ,61281 + ,10170 + ,61 + ,21 + ,51 + ,30874 + ,12396 + ,37 + ,23 + ,56 + ,38610 + ,6873 + ,59 + ,23 + ,32 + ,35139 + ,14146 + ,49 + ,29 + ,60 + ,41194 + ,4260 + ,56 + ,21 + ,65 + ,32683 + ,10566 + ,26 + ,25 + ,66 + ,22527 + ,5953 + ,65 + ,21 + ,57 + ,37941 + ,5322 + ,61 + ,12 + ,80 + ,50008 + ,5413 + ,36 + ,24 + ,48 + ,64622 + ,12310 + ,33 + ,24 + ,46 + ,25820 + ,7573 + ,71 + ,19 + ,81 + ,31141 + ,7230 + ,65 + ,21 + ,89 + ,13310 + ,3394 + ,43 + ,25 + ,49 + ,28470 + ,8191 + ,49 + ,34 + ,164 + ,33797 + ,5162 + ,32 + ,25 + ,132 + ,28263 + ,10226 + ,42 + ,22 + ,46 + ,60132 + ,11270 + ,62 + ,28 + ,60 + ,52338 + ,10837 + ,37 + ,29 + ,36 + ,35378 + ,9791 + ,53 + ,23 + ,66 + ,19249 + ,7488 + ,29 + ,23 + ,35 + ,84205 + ,9184 + ,18 + ,22 + ,50 + ,23494 + ,8181 + ,49 + ,14 + ,137 + ,23333 + ,8022 + ,54 + ,24 + ,49 + ,41622 + ,8620 + ,31 + ,10 + ,32 + ,13018 + ,1350 + ,39 + ,17 + ,46 + ,22698 + ,5141 + ,94 + ,21 + ,83 + ,21055 + ,7945 + ,31 + ,25 + ,58 + ,98177 + ,10623 + ,71 + ,31 + ,105 + ,42249 + ,10138 + ,36 + ,26 + ,44 + ,61849 + ,1661 + ,95 + ,22 + ,71 + ,22883 + ,6900 + ,31 + ,35 + ,49 + ,24460 + ,7162 + ,64 + ,26 + ,49 + ,42005 + ,14697 + ,37 + ,12 + ,27 + ,15292 + ,4574 + ,22 + ,26 + ,72 + ,27084 + ,7509 + ,37 + ,32 + ,79 + ,10956 + ,3495 + ,57 + ,21 + ,71 + ,34545 + ,1900 + ,52 + ,15 + ,72 + ,13497 + ,70 + ,23 + ,17 + ,48 + ,8019 + ,3080 + ,39 + ,12 + ,29 + ,32689 + ,443 + ,23 + ,21 + ,76 + ,21152 + ,4911 + ,20 + ,20 + ,44 + ,31747 + ,6562 + ,26 + ,23 + ,49 + ,14399 + ,4204 + ,52 + ,15 + ,40 + ,10726 + ,3149 + ,27 + ,4 + ,11 + ,2325 + ,593 + ,42 + ,22 + ,49 + ,17215 + ,3456 + ,34 + ,13 + ,30 + ,40911 + ,9570 + ,28 + ,22 + ,37 + ,22346 + ,2102 + ,19 + ,1 + ,63 + ,2781 + ,4 + ,16 + ,4 + ,34 + ,5444 + ,775 + ,15 + ,21 + ,40 + ,4157 + ,1283 + ,24 + ,18 + ,49 + ,53249 + ,3878 + ,22 + ,16 + ,59 + ,5842 + ,522 + ,12 + ,2 + ,19 + ,5752 + ,2416 + ,12 + ,1 + ,15 + ,3895 + ,786 + ,9 + ,2 + ,22 + ,0 + ,0 + ,9 + ,0 + ,7 + ,0 + ,0 + ,13 + ,4 + ,18 + ,2179 + ,548 + ,18 + ,0 + ,1 + ,1423 + ,603 + ,4 + ,0 + ,0 + ,0 + ,0 + ,3 + ,1 + ,5 + ,0 + ,0 + ,3 + ,0 + ,1 + ,0 + ,0 + ,5 + ,0 + ,5 + ,0 + ,0 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0) + ,dim=c(5 + ,144) + ,dimnames=list(c('X1' + ,'X2' + ,'X3' + ,'X4' + ,'X5') + ,1:144)) > y <- array(NA,dim=c(5,144),dimnames=list(c('X1','X2','X3','X4','X5'),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 = '3' > 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] "X1" > x[,par1] [1] 240 111 91 68 57 61 77 129 217 104 117 108 99 48 58 90 87 60 [19] 40 95 61 67 67 68 54 149 80 64 52 86 42 74 85 77 38 56 [37] 65 41 54 56 32 92 55 71 77 60 46 80 37 49 89 85 25 69 [55] 75 48 53 52 52 52 45 65 54 53 49 42 57 41 82 91 72 41 [73] 95 47 50 44 37 56 61 37 59 49 56 26 65 61 36 33 71 65 [91] 43 49 32 42 62 37 53 29 18 49 54 31 39 94 31 71 36 95 [109] 31 64 37 22 37 57 52 23 39 23 20 26 52 27 42 34 28 19 [127] 16 15 24 22 12 12 9 9 13 18 4 3 3 5 1 0 0 0 > 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 3 4 5 9 12 13 15 16 18 19 20 22 23 24 25 26 27 28 3 1 2 1 1 2 2 1 1 1 2 1 1 2 2 1 1 2 1 1 29 31 32 33 34 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 1 3 2 1 1 2 6 1 2 1 3 4 1 1 1 1 1 2 5 1 52 53 54 55 56 57 58 59 60 61 62 64 65 67 68 69 71 72 74 75 6 3 4 1 4 3 1 1 2 4 1 2 4 2 2 1 3 1 1 1 77 80 82 85 86 87 89 90 91 92 94 95 99 104 108 111 117 129 149 217 3 2 1 2 1 1 1 1 2 1 1 3 1 1 1 1 1 1 1 1 240 1 > colnames(x) [1] "X1" "X2" "X3" "X4" "X5" > colnames(x)[par1] [1] "X1" > x[,par1] [1] 240 111 91 68 57 61 77 129 217 104 117 108 99 48 58 90 87 60 [19] 40 95 61 67 67 68 54 149 80 64 52 86 42 74 85 77 38 56 [37] 65 41 54 56 32 92 55 71 77 60 46 80 37 49 89 85 25 69 [55] 75 48 53 52 52 52 45 65 54 53 49 42 57 41 82 91 72 41 [73] 95 47 50 44 37 56 61 37 59 49 56 26 65 61 36 33 71 65 [91] 43 49 32 42 62 37 53 29 18 49 54 31 39 94 31 71 36 95 [109] 31 64 37 22 37 57 52 23 39 23 20 26 52 27 42 34 28 19 [127] 16 15 24 22 12 12 9 9 13 18 4 3 3 5 1 0 0 0 > 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/1krko1344776841.tab") + } + } > m Conditional inference tree with 6 terminal nodes Response: X1 Inputs: X2, X3, X4, X5 Number of observations: 144 1) X5 <= 2416; criterion = 1, statistic = 55.16 2) X3 <= 22; criterion = 1, statistic = 15.597 3)* weights = 15 2) X3 > 22 4)* weights = 10 1) X5 > 2416 5) X3 <= 80; criterion = 1, statistic = 26.155 6) X5 <= 13823; criterion = 0.954, statistic = 6.372 7)* weights = 59 6) X5 > 13823 8)* weights = 7 5) X3 > 80 9) X4 <= 53349; criterion = 0.999, statistic = 14.279 10)* weights = 34 9) X4 > 53349 11)* weights = 19 > postscript(file="/var/wessaorg/rcomp/tmp/2rr4h1344776841.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/3y2491344776841.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 240 101.736842 138.2631579 2 111 101.736842 9.2631579 3 91 101.736842 -10.7368421 4 68 101.736842 -33.7368421 5 57 47.525424 9.4745763 6 61 67.714286 -6.7142857 7 77 47.525424 29.4745763 8 129 101.736842 27.2631579 9 217 101.736842 115.2631579 10 104 101.736842 2.2631579 11 117 101.736842 15.2631579 12 108 63.352941 44.6470588 13 99 63.352941 35.6470588 14 48 63.352941 -15.3529412 15 58 47.525424 10.4745763 16 90 101.736842 -11.7368421 17 87 63.352941 23.6470588 18 60 47.525424 12.4745763 19 40 63.352941 -23.3529412 20 95 63.352941 31.6470588 21 61 101.736842 -40.7368421 22 67 101.736842 -34.7368421 23 67 63.352941 3.6470588 24 68 63.352941 4.6470588 25 54 47.525424 6.4745763 26 149 101.736842 47.2631579 27 80 101.736842 -21.7368421 28 64 63.352941 0.6470588 29 52 47.525424 4.4745763 30 86 47.525424 38.4745763 31 42 63.352941 -21.3529412 32 74 47.525424 26.4745763 33 85 63.352941 21.6470588 34 77 67.714286 9.2857143 35 38 47.525424 -9.5254237 36 56 47.525424 8.4745763 37 65 63.352941 1.6470588 38 41 47.525424 -6.5254237 39 54 47.525424 6.4745763 40 56 47.525424 8.4745763 41 32 47.525424 -15.5254237 42 92 63.352941 28.6470588 43 55 63.352941 -8.3529412 44 71 47.525424 23.4745763 45 77 101.736842 -24.7368421 46 60 101.736842 -41.7368421 47 46 47.525424 -1.5254237 48 80 47.525424 32.4745763 49 37 63.352941 -26.3529412 50 49 47.525424 1.4745763 51 89 47.525424 41.4745763 52 85 67.714286 17.2857143 53 25 63.352941 -38.3529412 54 69 101.736842 -32.7368421 55 75 67.714286 7.2857143 56 48 47.525424 0.4745763 57 53 63.352941 -10.3529412 58 52 101.736842 -49.7368421 59 52 47.525424 4.4745763 60 52 47.525424 4.4745763 61 45 63.352941 -18.3529412 62 65 63.352941 1.6470588 63 54 63.352941 -9.3529412 64 53 67.714286 -14.7142857 65 49 47.525424 1.4745763 66 42 63.352941 -21.3529412 67 57 63.352941 -6.3529412 68 41 47.525424 -6.5254237 69 82 63.352941 18.6470588 70 91 63.352941 27.6470588 71 72 63.352941 8.6470588 72 41 63.352941 -22.3529412 73 95 101.736842 -6.7368421 74 47 47.525424 -0.5254237 75 50 47.525424 2.4745763 76 44 63.352941 -19.3529412 77 37 47.525424 -10.5254237 78 56 101.736842 -45.7368421 79 61 47.525424 13.4745763 80 37 47.525424 -10.5254237 81 59 67.714286 -8.7142857 82 49 47.525424 1.4745763 83 56 47.525424 8.4745763 84 26 47.525424 -21.5254237 85 65 47.525424 17.4745763 86 61 47.525424 13.4745763 87 36 47.525424 -11.5254237 88 33 47.525424 -14.5254237 89 71 63.352941 7.6470588 90 65 63.352941 1.6470588 91 43 47.525424 -4.5254237 92 49 63.352941 -14.3529412 93 32 63.352941 -31.3529412 94 42 47.525424 -5.5254237 95 62 47.525424 14.4745763 96 37 47.525424 -10.5254237 97 53 47.525424 5.4745763 98 29 47.525424 -18.5254237 99 18 47.525424 -29.5254237 100 49 63.352941 -14.3529412 101 54 47.525424 6.4745763 102 31 31.500000 -0.5000000 103 39 47.525424 -8.5254237 104 94 63.352941 30.6470588 105 31 47.525424 -16.5254237 106 71 63.352941 7.6470588 107 36 31.500000 4.5000000 108 95 47.525424 47.4745763 109 31 47.525424 -16.5254237 110 64 67.714286 -3.7142857 111 37 47.525424 -10.5254237 112 22 47.525424 -25.5254237 113 37 47.525424 -10.5254237 114 57 31.500000 25.5000000 115 52 31.500000 20.5000000 116 23 47.525424 -24.5254237 117 39 31.500000 7.5000000 118 23 47.525424 -24.5254237 119 20 47.525424 -27.5254237 120 26 47.525424 -21.5254237 121 52 47.525424 4.4745763 122 27 7.733333 19.2666667 123 42 47.525424 -5.5254237 124 34 47.525424 -13.5254237 125 28 31.500000 -3.5000000 126 19 31.500000 -12.5000000 127 16 31.500000 -15.5000000 128 15 31.500000 -16.5000000 129 24 47.525424 -23.5254237 130 22 31.500000 -9.5000000 131 12 7.733333 4.2666667 132 12 7.733333 4.2666667 133 9 7.733333 1.2666667 134 9 7.733333 1.2666667 135 13 7.733333 5.2666667 136 18 7.733333 10.2666667 137 4 7.733333 -3.7333333 138 3 7.733333 -4.7333333 139 3 7.733333 -4.7333333 140 5 7.733333 -2.7333333 141 1 7.733333 -6.7333333 142 0 7.733333 -7.7333333 143 0 7.733333 -7.7333333 144 0 7.733333 -7.7333333 > 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/4vxhp1344776841.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/59dym1344776842.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/63t6j1344776842.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/70nnw1344776842.tab") + } > > try(system("convert tmp/2rr4h1344776841.ps tmp/2rr4h1344776841.png",intern=TRUE)) character(0) > try(system("convert tmp/3y2491344776841.ps tmp/3y2491344776841.png",intern=TRUE)) character(0) > try(system("convert tmp/4vxhp1344776841.ps tmp/4vxhp1344776841.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.398 0.331 4.722