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(56 + ,79 + ,30 + ,112285 + ,21 + ,56 + ,58 + ,28 + ,84786 + ,23 + ,54 + ,60 + ,38 + ,83123 + ,22 + ,92 + ,121 + ,25 + ,119182 + ,22 + ,44 + ,43 + ,26 + ,116174 + ,21 + ,33 + ,69 + ,25 + ,57635 + ,22 + ,84 + ,78 + ,38 + ,66198 + ,21 + ,55 + ,44 + ,30 + ,57793 + ,21 + ,154 + ,158 + ,47 + ,97668 + ,21 + ,53 + ,102 + ,30 + ,133824 + ,21 + ,119 + ,77 + ,31 + ,101481 + ,23 + ,41 + ,82 + ,23 + ,99645 + ,21 + ,58 + ,101 + ,36 + ,99052 + ,21 + ,75 + ,80 + ,30 + ,67654 + ,22 + ,33 + ,50 + ,25 + ,65553 + ,22 + ,100 + ,73 + ,31 + ,82753 + ,21 + ,112 + ,81 + ,31 + ,85323 + ,22 + ,73 + ,105 + ,33 + ,72654 + ,23 + ,40 + ,47 + ,25 + ,30727 + ,22 + ,60 + ,94 + ,35 + ,117478 + ,22 + ,62 + ,44 + ,42 + ,74007 + ,21 + ,77 + ,107 + ,33 + ,101494 + ,21 + ,99 + ,84 + ,36 + ,79215 + ,21 + ,17 + ,0 + ,0 + ,1423 + ,20 + ,30 + ,33 + ,14 + ,31081 + ,21 + ,76 + ,42 + ,17 + ,22996 + ,25 + ,146 + ,96 + ,32 + ,83122 + ,21 + ,56 + ,56 + ,35 + ,60578 + ,21 + ,107 + ,57 + ,20 + ,39992 + ,20 + ,58 + ,59 + ,28 + ,79892 + ,24 + ,34 + ,39 + ,28 + ,49810 + ,23 + ,119 + ,76 + ,34 + ,100708 + ,21 + ,66 + ,91 + ,39 + ,82875 + ,24 + ,66 + ,76 + ,28 + ,72260 + ,21 + ,24 + ,8 + ,4 + ,5950 + ,23 + ,259 + ,79 + ,39 + ,115762 + ,23 + ,41 + ,76 + ,29 + ,80670 + ,21 + ,68 + ,101 + ,44 + ,143558 + ,22 + ,168 + ,94 + ,21 + ,117105 + ,20 + ,43 + ,27 + ,16 + ,23789 + ,18 + ,105 + ,123 + ,35 + ,105195 + ,22 + ,94 + ,105 + ,23 + ,149193 + ,21 + ,57 + ,41 + ,29 + ,95260 + ,21 + ,53 + ,72 + ,25 + ,55183 + ,23 + ,103 + ,67 + ,27 + ,106671 + ,22 + ,121 + ,75 + ,36 + ,73511 + ,21 + ,62 + ,114 + ,28 + ,92945 + ,21 + ,32 + ,22 + ,23 + ,22618 + ,21 + ,45 + ,69 + ,28 + ,83737 + ,22 + ,46 + ,105 + ,34 + ,69094 + ,21 + ,75 + ,88 + ,28 + ,95536 + ,21 + ,88 + ,73 + ,34 + ,225920 + ,23 + ,53 + ,62 + ,33 + ,61370 + ,21 + ,78 + ,100 + ,35 + ,84651 + ,22 + ,45 + ,24 + ,24 + ,15986 + ,22 + ,46 + ,67 + ,29 + ,95364 + ,20 + ,41 + ,46 + ,20 + ,26706 + ,21 + ,144 + ,57 + ,29 + ,89691 + ,21 + ,91 + ,135 + ,37 + ,126846 + ,21 + ,63 + ,124 + ,33 + ,102860 + ,21 + ,53 + ,33 + ,25 + ,51715 + ,22 + ,62 + ,98 + ,32 + ,55801 + ,21 + ,63 + ,58 + ,29 + ,111813 + ,24 + ,32 + ,68 + ,28 + ,120293 + ,22 + ,62 + ,131 + ,31 + ,161647 + ,24 + ,117 + ,110 + ,52 + ,115929 + ,21 + ,34 + ,37 + ,21 + ,24266 + ,22 + ,92 + ,130 + ,24 + ,162901 + ,22 + ,93 + ,93 + ,41 + ,109825 + ,21 + ,54 + ,118 + ,33 + ,129838 + ,24 + ,144 + ,39 + ,32 + ,37510 + ,21 + ,109 + ,81 + ,31 + ,87771 + ,22 + ,75 + ,51 + ,18 + ,44418 + ,19 + ,50 + ,28 + ,23 + ,192565 + ,22 + ,61 + ,40 + ,17 + ,35232 + ,23 + ,55 + ,56 + ,20 + ,40909 + ,20 + ,77 + ,27 + ,12 + ,13294 + ,20 + ,72 + ,83 + ,30 + ,140867 + ,23 + ,53 + ,28 + ,13 + ,44332 + ,20 + ,42 + ,59 + ,22 + ,61056 + ,20 + ,71 + ,133 + ,42 + ,101338 + ,23 + ,10 + ,12 + ,1 + ,1168 + ,25 + ,65 + ,106 + ,32 + ,65567 + ,21 + ,66 + ,44 + ,25 + ,32334 + ,22 + ,41 + ,71 + ,36 + ,40735 + ,21 + ,86 + ,116 + ,31 + ,91413 + ,22 + ,16 + ,4 + ,0 + ,855 + ,22 + ,42 + ,62 + ,24 + ,97068 + ,23 + ,19 + ,12 + ,13 + ,44339 + ,21 + ,19 + ,18 + ,8 + ,14116 + ,21 + ,45 + ,14 + ,13 + ,10288 + ,20 + ,65 + ,60 + ,19 + ,65622 + ,19 + ,95 + ,98 + ,33 + ,76643 + ,22 + ,64 + ,32 + ,38 + ,92696 + ,21 + ,38 + ,25 + ,24 + ,94785 + ,21 + ,65 + ,100 + ,43 + ,93815 + ,21 + ,52 + ,46 + ,43 + ,86687 + ,21 + ,62 + ,45 + ,14 + ,34553 + ,21 + ,65 + ,129 + ,41 + ,105547 + ,21 + ,95 + ,136 + ,45 + ,213688 + ,22 + ,29 + ,59 + ,31 + ,71220 + ,22 + ,247 + ,63 + ,31 + ,91721 + ,22 + ,29 + ,14 + ,30 + ,111194 + ,22 + ,118 + ,36 + ,16 + ,51009 + ,18 + ,110 + ,113 + ,37 + ,135777 + ,21 + ,67 + ,47 + ,30 + ,51513 + ,23 + ,42 + ,92 + ,35 + ,74163 + ,21 + ,64 + ,50 + ,20 + ,33416 + ,19 + ,81 + ,41 + ,18 + ,83305 + ,19 + ,95 + ,91 + ,31 + ,98952 + ,23 + ,67 + ,111 + ,31 + ,102372 + ,21 + ,63 + ,41 + ,21 + ,37238 + ,21 + ,83 + ,120 + ,39 + ,103772 + ,21 + ,32 + ,25 + ,18 + ,21399 + ,21 + ,83 + ,131 + ,39 + ,130115 + ,20 + ,31 + ,45 + ,14 + ,24874 + ,19 + ,67 + ,29 + ,7 + ,34988 + ,21 + ,66 + ,58 + ,17 + ,45549 + ,22 + ,70 + ,47 + ,30 + ,64466 + ,21 + ,103 + ,109 + ,37 + ,54990 + ,25 + ,34 + ,37 + ,32 + ,34777 + ,23 + ,40 + ,15 + ,17 + ,27114 + ,19 + ,31 + ,7 + ,24 + ,37636 + ,19 + ,42 + ,54 + ,22 + ,65461 + ,19 + ,46 + ,54 + ,12 + ,30080 + ,19 + ,33 + ,14 + ,19 + ,24094 + ,19 + ,18 + ,16 + ,13 + ,69008 + ,20 + ,35 + ,32 + ,15 + ,46090 + ,19 + ,66 + ,38 + ,15 + ,34029 + ,19 + ,60 + ,22 + ,17 + ,46300 + ,19 + ,54 + ,32 + ,16 + ,40662 + ,19 + ,53 + ,32 + ,18 + ,28987 + ,19 + ,39 + ,37 + ,17 + ,30594 + ,20 + ,45 + ,32 + ,16 + ,27913 + ,19 + ,36 + ,0 + ,23 + ,42744 + ,19 + ,28 + ,5 + ,22 + ,12934 + ,18 + ,30 + ,10 + ,13 + ,41385 + ,19 + ,22 + ,27 + ,16 + ,18653 + ,19 + ,31 + ,29 + ,20 + ,30976 + ,21 + ,55 + ,25 + ,22 + ,63339 + ,18 + ,54 + ,55 + ,17 + ,25568 + ,18 + ,14 + ,5 + ,17 + ,4154 + ,21 + ,81 + ,43 + ,12 + ,19474 + ,20 + ,43 + ,34 + ,17 + ,39067 + ,19 + ,30 + ,35 + ,23 + ,65892 + ,21 + ,23 + ,0 + ,17 + ,4143 + ,21 + ,38 + ,37 + ,14 + ,28579 + ,20 + ,53 + ,26 + ,21 + ,38084 + ,24 + ,45 + ,38 + ,18 + ,27717 + ,22 + ,39 + ,23 + ,18 + ,32928 + ,21 + ,24 + ,30 + ,17 + ,19499 + ,21 + ,35 + ,18 + ,15 + ,36874 + ,19 + ,151 + ,28 + ,21 + ,48259 + ,18 + ,30 + ,21 + ,14 + ,28207 + ,19 + ,57 + ,50 + ,15 + ,45833 + ,19 + ,40 + ,12 + ,15 + ,29156 + ,19 + ,77 + ,27 + ,22 + ,45588 + ,20 + ,35 + ,41 + ,21 + ,45097 + ,18 + ,63 + ,12 + ,18 + ,28394 + ,19 + ,44 + ,21 + ,17 + ,18632 + ,19 + ,19 + ,8 + ,4 + ,2325 + ,20 + ,13 + ,26 + ,10 + ,25139 + ,20 + ,42 + ,27 + ,16 + ,27975 + ,21 + ,42 + ,37 + ,18 + ,21792 + ,20 + ,49 + ,29 + ,12 + ,26263 + ,21 + ,30 + ,32 + ,16 + ,23686 + ,18 + ,49 + ,35 + ,21 + ,49303 + ,19 + ,12 + ,10 + ,2 + ,5752 + ,19 + ,20 + ,17 + ,17 + ,20055 + ,19 + ,27 + ,10 + ,16 + ,20154 + ,19 + ,14 + ,17 + ,16 + ,19540 + ,19) + ,dim=c(5 + ,171) + ,dimnames=list(c('log' + ,'blog' + ,'PR' + ,'size' + ,'age ') + ,1:171)) > y <- array(NA,dim=c(5,171),dimnames=list(c('log','blog','PR','size','age '),1:171)) > 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] "log" > x[,par1] [1] 56 56 54 92 44 33 84 55 154 53 119 41 58 75 33 100 112 73 [19] 40 60 62 77 99 17 30 76 146 56 107 58 34 119 66 66 24 259 [37] 41 68 168 43 105 94 57 53 103 121 62 32 45 46 75 88 53 78 [55] 45 46 41 144 91 63 53 62 63 32 62 117 34 92 93 54 144 109 [73] 75 50 61 55 77 72 53 42 71 10 65 66 41 86 16 42 19 19 [91] 45 65 95 64 38 65 52 62 65 95 29 247 29 118 110 67 42 64 [109] 81 95 67 63 83 32 83 31 67 66 70 103 34 40 31 42 46 33 [127] 18 35 66 60 54 53 39 45 36 28 30 22 31 55 54 14 81 43 [145] 30 23 38 53 45 39 24 35 151 30 57 40 77 35 63 44 19 13 [163] 42 42 49 30 49 12 20 27 14 > 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]) 10 12 13 14 16 17 18 19 20 22 23 24 27 28 29 30 31 32 33 34 1 1 1 2 1 1 1 3 1 1 1 2 1 1 2 5 3 3 3 3 35 36 38 39 40 41 42 43 44 45 46 49 50 52 53 54 55 56 57 58 3 1 2 2 3 4 6 2 2 5 3 2 1 1 7 4 3 3 2 2 60 61 62 63 64 65 66 67 68 70 71 72 73 75 76 77 78 81 83 84 2 1 5 4 2 4 5 3 1 1 1 1 1 3 1 3 1 2 2 1 86 88 91 92 93 94 95 99 100 103 105 107 109 110 112 117 118 119 121 144 1 1 1 2 1 1 3 1 1 2 1 1 1 1 1 1 1 2 1 2 146 151 154 168 247 259 1 1 1 1 1 1 > colnames(x) [1] "log" "blog" "PR" "size" "age." > colnames(x)[par1] [1] "log" > x[,par1] [1] 56 56 54 92 44 33 84 55 154 53 119 41 58 75 33 100 112 73 [19] 40 60 62 77 99 17 30 76 146 56 107 58 34 119 66 66 24 259 [37] 41 68 168 43 105 94 57 53 103 121 62 32 45 46 75 88 53 78 [55] 45 46 41 144 91 63 53 62 63 32 62 117 34 92 93 54 144 109 [73] 75 50 61 55 77 72 53 42 71 10 65 66 41 86 16 42 19 19 [91] 45 65 95 64 38 65 52 62 65 95 29 247 29 118 110 67 42 64 [109] 81 95 67 63 83 32 83 31 67 66 70 103 34 40 31 42 46 33 [127] 18 35 66 60 54 53 39 45 36 28 30 22 31 55 54 14 81 43 [145] 30 23 38 53 45 39 24 35 151 30 57 40 77 35 63 44 19 13 [163] 42 42 49 30 49 12 20 27 14 > 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/14wan1323864932.tab") + } + } > m Conditional inference tree with 4 terminal nodes Response: log Inputs: blog, PR, size, age. Number of observations: 171 1) blog <= 62; criterion = 1, statistic = 43.884 2) blog <= 26; criterion = 1, statistic = 22.77 3) PR <= 10; criterion = 0.996, statistic = 10.712 4)* weights = 8 3) PR > 10 5)* weights = 28 2) blog > 26 6)* weights = 72 1) blog > 62 7)* weights = 63 > postscript(file="/var/www/rcomp/tmp/2hdcb1323864932.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/3dbe71323864932.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 56 85.63492 -29.6349206 2 56 56.54167 -0.5416667 3 54 56.54167 -2.5416667 4 92 85.63492 6.3650794 5 44 56.54167 -12.5416667 6 33 85.63492 -52.6349206 7 84 85.63492 -1.6349206 8 55 56.54167 -1.5416667 9 154 85.63492 68.3650794 10 53 85.63492 -32.6349206 11 119 85.63492 33.3650794 12 41 85.63492 -44.6349206 13 58 85.63492 -27.6349206 14 75 85.63492 -10.6349206 15 33 56.54167 -23.5416667 16 100 85.63492 14.3650794 17 112 85.63492 26.3650794 18 73 85.63492 -12.6349206 19 40 56.54167 -16.5416667 20 60 85.63492 -25.6349206 21 62 56.54167 5.4583333 22 77 85.63492 -8.6349206 23 99 85.63492 13.3650794 24 17 16.25000 0.7500000 25 30 56.54167 -26.5416667 26 76 56.54167 19.4583333 27 146 85.63492 60.3650794 28 56 56.54167 -0.5416667 29 107 56.54167 50.4583333 30 58 56.54167 1.4583333 31 34 56.54167 -22.5416667 32 119 85.63492 33.3650794 33 66 85.63492 -19.6349206 34 66 85.63492 -19.6349206 35 24 16.25000 7.7500000 36 259 85.63492 173.3650794 37 41 85.63492 -44.6349206 38 68 85.63492 -17.6349206 39 168 85.63492 82.3650794 40 43 56.54167 -13.5416667 41 105 85.63492 19.3650794 42 94 85.63492 8.3650794 43 57 56.54167 0.4583333 44 53 85.63492 -32.6349206 45 103 85.63492 17.3650794 46 121 85.63492 35.3650794 47 62 85.63492 -23.6349206 48 32 34.75000 -2.7500000 49 45 85.63492 -40.6349206 50 46 85.63492 -39.6349206 51 75 85.63492 -10.6349206 52 88 85.63492 2.3650794 53 53 56.54167 -3.5416667 54 78 85.63492 -7.6349206 55 45 34.75000 10.2500000 56 46 85.63492 -39.6349206 57 41 56.54167 -15.5416667 58 144 56.54167 87.4583333 59 91 85.63492 5.3650794 60 63 85.63492 -22.6349206 61 53 56.54167 -3.5416667 62 62 85.63492 -23.6349206 63 63 56.54167 6.4583333 64 32 85.63492 -53.6349206 65 62 85.63492 -23.6349206 66 117 85.63492 31.3650794 67 34 56.54167 -22.5416667 68 92 85.63492 6.3650794 69 93 85.63492 7.3650794 70 54 85.63492 -31.6349206 71 144 56.54167 87.4583333 72 109 85.63492 23.3650794 73 75 56.54167 18.4583333 74 50 56.54167 -6.5416667 75 61 56.54167 4.4583333 76 55 56.54167 -1.5416667 77 77 56.54167 20.4583333 78 72 85.63492 -13.6349206 79 53 56.54167 -3.5416667 80 42 56.54167 -14.5416667 81 71 85.63492 -14.6349206 82 10 16.25000 -6.2500000 83 65 85.63492 -20.6349206 84 66 56.54167 9.4583333 85 41 85.63492 -44.6349206 86 86 85.63492 0.3650794 87 16 16.25000 -0.2500000 88 42 56.54167 -14.5416667 89 19 34.75000 -15.7500000 90 19 16.25000 2.7500000 91 45 34.75000 10.2500000 92 65 56.54167 8.4583333 93 95 85.63492 9.3650794 94 64 56.54167 7.4583333 95 38 34.75000 3.2500000 96 65 85.63492 -20.6349206 97 52 56.54167 -4.5416667 98 62 56.54167 5.4583333 99 65 85.63492 -20.6349206 100 95 85.63492 9.3650794 101 29 56.54167 -27.5416667 102 247 85.63492 161.3650794 103 29 34.75000 -5.7500000 104 118 56.54167 61.4583333 105 110 85.63492 24.3650794 106 67 56.54167 10.4583333 107 42 85.63492 -43.6349206 108 64 56.54167 7.4583333 109 81 56.54167 24.4583333 110 95 85.63492 9.3650794 111 67 85.63492 -18.6349206 112 63 56.54167 6.4583333 113 83 85.63492 -2.6349206 114 32 34.75000 -2.7500000 115 83 85.63492 -2.6349206 116 31 56.54167 -25.5416667 117 67 56.54167 10.4583333 118 66 56.54167 9.4583333 119 70 56.54167 13.4583333 120 103 85.63492 17.3650794 121 34 56.54167 -22.5416667 122 40 34.75000 5.2500000 123 31 34.75000 -3.7500000 124 42 56.54167 -14.5416667 125 46 56.54167 -10.5416667 126 33 34.75000 -1.7500000 127 18 34.75000 -16.7500000 128 35 56.54167 -21.5416667 129 66 56.54167 9.4583333 130 60 34.75000 25.2500000 131 54 56.54167 -2.5416667 132 53 56.54167 -3.5416667 133 39 56.54167 -17.5416667 134 45 56.54167 -11.5416667 135 36 34.75000 1.2500000 136 28 34.75000 -6.7500000 137 30 34.75000 -4.7500000 138 22 56.54167 -34.5416667 139 31 56.54167 -25.5416667 140 55 34.75000 20.2500000 141 54 56.54167 -2.5416667 142 14 34.75000 -20.7500000 143 81 56.54167 24.4583333 144 43 56.54167 -13.5416667 145 30 56.54167 -26.5416667 146 23 34.75000 -11.7500000 147 38 56.54167 -18.5416667 148 53 34.75000 18.2500000 149 45 56.54167 -11.5416667 150 39 34.75000 4.2500000 151 24 56.54167 -32.5416667 152 35 34.75000 0.2500000 153 151 56.54167 94.4583333 154 30 34.75000 -4.7500000 155 57 56.54167 0.4583333 156 40 34.75000 5.2500000 157 77 56.54167 20.4583333 158 35 56.54167 -21.5416667 159 63 34.75000 28.2500000 160 44 34.75000 9.2500000 161 19 16.25000 2.7500000 162 13 16.25000 -3.2500000 163 42 56.54167 -14.5416667 164 42 56.54167 -14.5416667 165 49 56.54167 -7.5416667 166 30 56.54167 -26.5416667 167 49 56.54167 -7.5416667 168 12 16.25000 -4.2500000 169 20 34.75000 -14.7500000 170 27 34.75000 -7.7500000 171 14 34.75000 -20.7500000 > 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/47cyi1323864932.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/5ypzb1323864933.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/69tj11323864933.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/7ltuc1323864933.tab") + } > > try(system("convert tmp/2hdcb1323864932.ps tmp/2hdcb1323864932.png",intern=TRUE)) character(0) > try(system("convert tmp/3dbe71323864932.ps tmp/3dbe71323864932.png",intern=TRUE)) character(0) > try(system("convert tmp/47cyi1323864932.ps tmp/47cyi1323864932.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.970 0.120 3.086