R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-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(1.593 + ,1.613 + ,1.524 + ,1.619 + ,1.638 + ,1.486 + ,1.619 + ,1.638 + ,1.486 + ,1.618 + ,1.638 + ,1.486 + ,1.618 + ,1.638 + ,1.486 + ,1.618 + ,1.638 + ,1.486 + ,1.653 + ,1.673 + ,1.523 + ,1.653 + ,1.673 + ,1.523 + ,1.653 + ,1.673 + ,1.523 + ,1.653 + ,1.673 + ,1.523 + ,1.653 + ,1.673 + ,1.523 + ,1.653 + ,1.673 + ,1.523 + ,1.653 + ,1.673 + ,1.523 + ,1.653 + ,1.673 + ,1.55 + ,1.667 + ,1.688 + ,1.55 + ,1.667 + ,1.688 + ,1.55 + ,1.667 + ,1.688 + ,1.55 + ,1.667 + ,1.688 + ,1.55 + ,1.667 + ,1.688 + ,1.55 + ,1.667 + ,1.688 + ,1.55 + ,1.667 + ,1.688 + ,1.516 + ,1.667 + ,1.688 + ,1.516 + ,1.667 + ,1.688 + ,1.516 + ,1.667 + ,1.688 + ,1.516 + ,1.667 + ,1.688 + ,1.516 + ,1.667 + ,1.688 + ,1.516 + ,1.667 + ,1.688 + ,1.516 + ,1.667 + ,1.688 + ,1.516 + ,1.667 + ,1.688 + ,1.498 + ,1.667 + ,1.688 + ,1.498 + ,1.667 + ,1.688 + ,1.498 + ,1.667 + ,1.688 + ,1.498 + ,1.667 + ,1.688 + ,1.498 + ,1.667 + ,1.688 + ,1.498 + ,1.667 + ,1.688 + ,1.498 + ,1.667 + ,1.688 + ,1.498 + ,1.667 + ,1.688 + ,1.498 + ,1.667 + ,1.688 + ,1.498 + ,1.667 + ,1.688 + ,1.498 + ,1.667 + ,1.688 + ,1.542 + ,1.667 + ,1.688 + ,1.542 + ,1.667 + ,1.688 + ,1.526 + ,1.687 + ,1.707 + ,1.526 + ,1.687 + ,1.707 + ,1.526 + ,1.687 + ,1.707 + ,1.526 + ,1.687 + ,1.707 + ,1.526 + ,1.687 + ,1.707 + ,1.526 + ,1.687 + ,1.707 + ,1.526 + ,1.687 + ,1.707 + ,1.55 + ,1.687 + ,1.707 + ,1.55 + ,1.687 + ,1.707 + ,1.55 + ,1.687 + ,1.707 + ,1.55 + ,1.713 + ,1.733 + ,1.55 + ,1.713 + ,1.733 + ,1.55 + ,1.713 + ,1.733 + ,1.55 + ,1.713 + ,1.733 + ,1.55 + ,1.713 + ,1.733 + ,1.55 + ,1.713 + ,1.733 + ,1.55 + ,1.713 + ,1.733 + ,1.55 + ,1.713 + ,1.733 + ,1.55 + ,1.713 + ,1.733 + ,1.55 + ,1.713 + ,1.733 + ,1.55 + ,1.713 + ,1.733 + ,1.55 + ,1.713 + ,1.733 + ,1.55 + ,1.713 + ,1.733 + ,1.55 + ,1.713 + ,1.733 + ,1.55 + ,1.741 + ,1.76 + ,1.55 + ,1.741 + ,1.76 + ,1.55 + ,1.741 + ,1.76 + ,1.55 + ,1.741 + ,1.76 + ,1.55 + ,1.741 + ,1.76 + ,1.55 + ,1.741 + ,1.76 + ,1.55 + ,1.741 + ,1.76 + ,1.55 + ,1.741 + ,1.76 + ,1.55 + ,1.741 + ,1.76 + ,1.55 + ,1.741 + ,1.76 + ,1.579 + ,1.769 + ,1.789 + ,1.579 + ,1.769 + ,1.789 + ,1.579 + ,1.769 + ,1.789 + ,1.579 + ,1.769 + ,1.789 + ,1.579 + ,1.769 + ,1.789 + ,1.579 + ,1.769 + ,1.789 + ,1.579 + ,1.769 + ,1.789 + ,1.579 + ,1.769 + ,1.789 + ,1.579 + ,1.743 + ,1.762 + ,1.552 + ,1.743 + ,1.762 + ,1.552 + ,1.743 + ,1.762 + ,1.552 + ,1.743 + ,1.762 + ,1.552 + ,1.743 + ,1.762 + ,1.552 + ,1.743 + ,1.762 + ,1.552 + ,1.789 + ,1.808 + ,1.552 + ,1.789 + ,1.808 + ,1.552 + ,1.789 + ,1.808 + ,1.552 + ,1.789 + ,1.808 + ,1.552 + ,1.789 + ,1.809 + ,1.553 + ,1.789 + ,1.809 + ,1.553 + ,1.789 + ,1.809 + ,1.553 + ,1.789 + ,1.809 + ,1.553 + ,1.804 + ,1.824 + ,1.553 + ,1.804 + ,1.824 + ,1.553 + ,1.804 + ,1.824 + ,1.553 + ,1.804 + ,1.824 + ,1.553 + ,1.804 + ,1.824 + ,1.553 + ,1.804 + ,1.824 + ,1.553 + ,1.804 + ,1.824 + ,1.553 + ,1.804 + ,1.824 + ,1.553 + ,1.804 + ,1.824 + ,1.553 + ,1.804 + ,1.824 + ,1.553 + ,1.804 + ,1.824 + ,1.553 + ,1.804 + ,1.824 + ,1.553 + ,1.777 + ,1.797 + ,1.553 + ,1.777 + ,1.797 + ,1.538 + ,1.777 + ,1.797 + ,1.538 + ,1.777 + ,1.797 + ,1.538 + ,1.777 + ,1.797 + ,1.538 + ,1.777 + ,1.797 + ,1.538 + ,1.777 + ,1.797 + ,1.538 + ,1.736 + ,1.756 + ,1.538 + ,1.736 + ,1.756 + ,1.538 + ,1.736 + ,1.756 + ,1.538 + ,1.736 + ,1.756 + ,1.538 + ,1.736 + ,1.756 + ,1.538 + ,1.736 + ,1.756 + ,1.538 + ,1.736 + ,1.756 + ,1.538 + ,1.736 + ,1.756 + ,1.538 + ,1.736 + ,1.756 + ,1.538 + ,1.719 + ,1.759 + ,1.538 + ,1.719 + ,1.759 + ,1.538 + ,1.719 + ,1.759 + ,1.538 + ,1.719 + ,1.759 + ,1.538 + ,1.719 + ,1.759 + ,1.538 + ,1.719 + ,1.759 + ,1.503 + ,1.719 + ,1.759 + ,1.503 + ,1.719 + ,1.759 + ,1.503 + ,1.719 + ,1.759 + ,1.503 + ,1.719 + ,1.759 + ,1.503 + ,1.693 + ,1.733 + ,1.503 + ,1.693 + ,1.733 + ,1.503 + ,1.693 + ,1.733 + ,1.503 + ,1.693 + ,1.733 + ,1.503 + ,1.693 + ,1.733 + ,1.503 + ,1.693 + ,1.733 + ,1.503 + ,1.693 + ,1.733 + ,1.503 + ,1.693 + ,1.733 + ,1.503 + ,1.693 + ,1.733 + ,1.503 + ,1.693 + ,1.733 + ,1.503 + ,1.693 + ,1.733 + ,1.503 + ,1.693 + ,1.733 + ,1.503 + ,1.693 + ,1.733 + ,1.503 + ,1.693 + ,1.733 + ,1.503 + ,1.693 + ,1.733 + ,1.503 + ,1.693 + ,1.733 + ,1.503 + ,1.71 + ,1.752 + ,1.503 + ,1.71 + ,1.752 + ,1.503 + ,1.71 + ,1.752 + ,1.503 + ,1.71 + ,1.752 + ,1.503 + ,1.71 + ,1.752 + ,1.503 + ,1.71 + ,1.752 + ,1.467 + ,1.71 + ,1.752 + ,1.467 + ,1.687 + ,1.729 + ,1.467 + ,1.687 + ,1.729 + ,1.467 + ,1.687 + ,1.729 + ,1.467 + ,1.687 + ,1.729 + ,1.467 + ,1.687 + ,1.729 + ,1.467 + ,1.687 + ,1.729 + ,1.467 + ,1.659 + ,1.7 + ,1.467 + ,1.659 + ,1.7 + ,1.467 + ,1.659 + ,1.7 + ,1.467 + ,1.659 + ,1.7 + ,1.467 + ,1.659 + ,1.7 + ,1.467 + ,1.659 + ,1.7 + ,1.467 + ,1.659 + ,1.7 + ,1.467 + ,1.659 + ,1.7 + ,1.45 + ,1.659 + ,1.7 + ,1.45 + ,1.641 + ,1.682 + ,1.45 + ,1.641 + ,1.682 + ,1.45 + ,1.641 + ,1.682 + ,1.45 + ,1.641 + ,1.682 + ,1.45 + ,1.641 + ,1.682 + ,1.45 + ,1.641 + ,1.682 + ,1.45 + ,1.641 + ,1.682 + ,1.45 + ,1.641 + ,1.682 + ,1.45 + ,1.641 + ,1.682 + ,1.45) + ,dim=c(3 + ,183) + ,dimnames=list(c('Super98' + ,'Super95' + ,'Diesel') + ,1:183)) > y <- array(NA,dim=c(3,183),dimnames=list(c('Super98','Super95','Diesel'),1:183)) > 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 = '3' > 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 Attaching package: 'zoo' The following object(s) are masked from 'package:base': as.Date, as.Date.numeric Loading required package: sandwich Loading required package: strucchange Loading required package: vcd Loading required package: MASS Loading required package: colorspace > library(Hmisc) Hmisc library by Frank E Harrell Jr Type library(help='Hmisc'), ?Overview, or ?Hmisc.Overview') to see overall documentation. NOTE:Hmisc no longer redefines [.factor to drop unused levels when subsetting. To get the old behavior of Hmisc type dropUnusedLevels(). 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] "Diesel" > x[,par1] [1] 1.524 1.486 1.486 1.486 1.486 1.486 1.523 1.523 1.523 1.523 1.523 1.523 [13] 1.523 1.550 1.550 1.550 1.550 1.550 1.550 1.550 1.516 1.516 1.516 1.516 [25] 1.516 1.516 1.516 1.516 1.498 1.498 1.498 1.498 1.498 1.498 1.498 1.498 [37] 1.498 1.498 1.498 1.542 1.542 1.526 1.526 1.526 1.526 1.526 1.526 1.526 [49] 1.550 1.550 1.550 1.550 1.550 1.550 1.550 1.550 1.550 1.550 1.550 1.550 [61] 1.550 1.550 1.550 1.550 1.550 1.550 1.550 1.550 1.550 1.550 1.550 1.550 [73] 1.550 1.550 1.550 1.579 1.579 1.579 1.579 1.579 1.579 1.579 1.579 1.579 [85] 1.552 1.552 1.552 1.552 1.552 1.552 1.552 1.552 1.552 1.552 1.553 1.553 [97] 1.553 1.553 1.553 1.553 1.553 1.553 1.553 1.553 1.553 1.553 1.553 1.553 [109] 1.553 1.553 1.553 1.538 1.538 1.538 1.538 1.538 1.538 1.538 1.538 1.538 [121] 1.538 1.538 1.538 1.538 1.538 1.538 1.538 1.538 1.538 1.538 1.538 1.503 [133] 1.503 1.503 1.503 1.503 1.503 1.503 1.503 1.503 1.503 1.503 1.503 1.503 [145] 1.503 1.503 1.503 1.503 1.503 1.503 1.503 1.503 1.503 1.503 1.503 1.503 [157] 1.503 1.467 1.467 1.467 1.467 1.467 1.467 1.467 1.467 1.467 1.467 1.467 [169] 1.467 1.467 1.467 1.467 1.450 1.450 1.450 1.450 1.450 1.450 1.450 1.450 [181] 1.450 1.450 1.450 > 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]) 1.45 1.467 1.486 1.498 1.503 1.516 1.523 1.524 1.526 1.538 1.542 1.55 1.552 11 15 5 11 26 8 7 1 7 20 2 34 10 1.553 1.579 17 9 > colnames(x) [1] "Super98" "Super95" "Diesel" > colnames(x)[par1] [1] "Diesel" > x[,par1] [1] 1.524 1.486 1.486 1.486 1.486 1.486 1.523 1.523 1.523 1.523 1.523 1.523 [13] 1.523 1.550 1.550 1.550 1.550 1.550 1.550 1.550 1.516 1.516 1.516 1.516 [25] 1.516 1.516 1.516 1.516 1.498 1.498 1.498 1.498 1.498 1.498 1.498 1.498 [37] 1.498 1.498 1.498 1.542 1.542 1.526 1.526 1.526 1.526 1.526 1.526 1.526 [49] 1.550 1.550 1.550 1.550 1.550 1.550 1.550 1.550 1.550 1.550 1.550 1.550 [61] 1.550 1.550 1.550 1.550 1.550 1.550 1.550 1.550 1.550 1.550 1.550 1.550 [73] 1.550 1.550 1.550 1.579 1.579 1.579 1.579 1.579 1.579 1.579 1.579 1.579 [85] 1.552 1.552 1.552 1.552 1.552 1.552 1.552 1.552 1.552 1.552 1.553 1.553 [97] 1.553 1.553 1.553 1.553 1.553 1.553 1.553 1.553 1.553 1.553 1.553 1.553 [109] 1.553 1.553 1.553 1.538 1.538 1.538 1.538 1.538 1.538 1.538 1.538 1.538 [121] 1.538 1.538 1.538 1.538 1.538 1.538 1.538 1.538 1.538 1.538 1.538 1.503 [133] 1.503 1.503 1.503 1.503 1.503 1.503 1.503 1.503 1.503 1.503 1.503 1.503 [145] 1.503 1.503 1.503 1.503 1.503 1.503 1.503 1.503 1.503 1.503 1.503 1.503 [157] 1.503 1.467 1.467 1.467 1.467 1.467 1.467 1.467 1.467 1.467 1.467 1.467 [169] 1.467 1.467 1.467 1.467 1.450 1.450 1.450 1.450 1.450 1.450 1.450 1.450 [181] 1.450 1.450 1.450 > 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/1pytv1355168779.tab") + } + } > m Conditional inference tree with 5 terminal nodes Response: Diesel Inputs: Super98, Super95 Number of observations: 183 1) Super98 <= 1.71; criterion = 1, statistic = 84.031 2)* weights = 99 1) Super98 > 1.71 3) Super98 <= 1.736; criterion = 0.999, statistic = 11.413 4) Super95 <= 1.756; criterion = 1, statistic = 15.855 5) Super98 <= 1.713; criterion = 1, statistic = 22 6)* weights = 14 5) Super98 > 1.713 7)* weights = 9 4) Super95 > 1.756 8)* weights = 10 3) Super98 > 1.736 9)* weights = 51 > postscript(file="/var/wessaorg/rcomp/tmp/2m5q61355168779.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/3a0st1355168779.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 1.524 1.500556 0.023444444 2 1.486 1.500556 -0.014555556 3 1.486 1.500556 -0.014555556 4 1.486 1.500556 -0.014555556 5 1.486 1.500556 -0.014555556 6 1.486 1.500556 -0.014555556 7 1.523 1.500556 0.022444444 8 1.523 1.500556 0.022444444 9 1.523 1.500556 0.022444444 10 1.523 1.500556 0.022444444 11 1.523 1.500556 0.022444444 12 1.523 1.500556 0.022444444 13 1.523 1.500556 0.022444444 14 1.550 1.500556 0.049444444 15 1.550 1.500556 0.049444444 16 1.550 1.500556 0.049444444 17 1.550 1.500556 0.049444444 18 1.550 1.500556 0.049444444 19 1.550 1.500556 0.049444444 20 1.550 1.500556 0.049444444 21 1.516 1.500556 0.015444444 22 1.516 1.500556 0.015444444 23 1.516 1.500556 0.015444444 24 1.516 1.500556 0.015444444 25 1.516 1.500556 0.015444444 26 1.516 1.500556 0.015444444 27 1.516 1.500556 0.015444444 28 1.516 1.500556 0.015444444 29 1.498 1.500556 -0.002555556 30 1.498 1.500556 -0.002555556 31 1.498 1.500556 -0.002555556 32 1.498 1.500556 -0.002555556 33 1.498 1.500556 -0.002555556 34 1.498 1.500556 -0.002555556 35 1.498 1.500556 -0.002555556 36 1.498 1.500556 -0.002555556 37 1.498 1.500556 -0.002555556 38 1.498 1.500556 -0.002555556 39 1.498 1.500556 -0.002555556 40 1.542 1.500556 0.041444444 41 1.542 1.500556 0.041444444 42 1.526 1.500556 0.025444444 43 1.526 1.500556 0.025444444 44 1.526 1.500556 0.025444444 45 1.526 1.500556 0.025444444 46 1.526 1.500556 0.025444444 47 1.526 1.500556 0.025444444 48 1.526 1.500556 0.025444444 49 1.550 1.500556 0.049444444 50 1.550 1.500556 0.049444444 51 1.550 1.500556 0.049444444 52 1.550 1.500556 0.049444444 53 1.550 1.550000 0.000000000 54 1.550 1.550000 0.000000000 55 1.550 1.550000 0.000000000 56 1.550 1.550000 0.000000000 57 1.550 1.550000 0.000000000 58 1.550 1.550000 0.000000000 59 1.550 1.550000 0.000000000 60 1.550 1.550000 0.000000000 61 1.550 1.550000 0.000000000 62 1.550 1.550000 0.000000000 63 1.550 1.550000 0.000000000 64 1.550 1.550000 0.000000000 65 1.550 1.550000 0.000000000 66 1.550 1.550000 0.000000000 67 1.550 1.555098 -0.005098039 68 1.550 1.555098 -0.005098039 69 1.550 1.555098 -0.005098039 70 1.550 1.555098 -0.005098039 71 1.550 1.555098 -0.005098039 72 1.550 1.555098 -0.005098039 73 1.550 1.555098 -0.005098039 74 1.550 1.555098 -0.005098039 75 1.550 1.555098 -0.005098039 76 1.579 1.555098 0.023901961 77 1.579 1.555098 0.023901961 78 1.579 1.555098 0.023901961 79 1.579 1.555098 0.023901961 80 1.579 1.555098 0.023901961 81 1.579 1.555098 0.023901961 82 1.579 1.555098 0.023901961 83 1.579 1.555098 0.023901961 84 1.579 1.555098 0.023901961 85 1.552 1.555098 -0.003098039 86 1.552 1.555098 -0.003098039 87 1.552 1.555098 -0.003098039 88 1.552 1.555098 -0.003098039 89 1.552 1.555098 -0.003098039 90 1.552 1.555098 -0.003098039 91 1.552 1.555098 -0.003098039 92 1.552 1.555098 -0.003098039 93 1.552 1.555098 -0.003098039 94 1.552 1.555098 -0.003098039 95 1.553 1.555098 -0.002098039 96 1.553 1.555098 -0.002098039 97 1.553 1.555098 -0.002098039 98 1.553 1.555098 -0.002098039 99 1.553 1.555098 -0.002098039 100 1.553 1.555098 -0.002098039 101 1.553 1.555098 -0.002098039 102 1.553 1.555098 -0.002098039 103 1.553 1.555098 -0.002098039 104 1.553 1.555098 -0.002098039 105 1.553 1.555098 -0.002098039 106 1.553 1.555098 -0.002098039 107 1.553 1.555098 -0.002098039 108 1.553 1.555098 -0.002098039 109 1.553 1.555098 -0.002098039 110 1.553 1.555098 -0.002098039 111 1.553 1.555098 -0.002098039 112 1.538 1.555098 -0.017098039 113 1.538 1.555098 -0.017098039 114 1.538 1.555098 -0.017098039 115 1.538 1.555098 -0.017098039 116 1.538 1.555098 -0.017098039 117 1.538 1.555098 -0.017098039 118 1.538 1.538000 0.000000000 119 1.538 1.538000 0.000000000 120 1.538 1.538000 0.000000000 121 1.538 1.538000 0.000000000 122 1.538 1.538000 0.000000000 123 1.538 1.538000 0.000000000 124 1.538 1.538000 0.000000000 125 1.538 1.538000 0.000000000 126 1.538 1.538000 0.000000000 127 1.538 1.520500 0.017500000 128 1.538 1.520500 0.017500000 129 1.538 1.520500 0.017500000 130 1.538 1.520500 0.017500000 131 1.538 1.520500 0.017500000 132 1.503 1.520500 -0.017500000 133 1.503 1.520500 -0.017500000 134 1.503 1.520500 -0.017500000 135 1.503 1.520500 -0.017500000 136 1.503 1.520500 -0.017500000 137 1.503 1.500556 0.002444444 138 1.503 1.500556 0.002444444 139 1.503 1.500556 0.002444444 140 1.503 1.500556 0.002444444 141 1.503 1.500556 0.002444444 142 1.503 1.500556 0.002444444 143 1.503 1.500556 0.002444444 144 1.503 1.500556 0.002444444 145 1.503 1.500556 0.002444444 146 1.503 1.500556 0.002444444 147 1.503 1.500556 0.002444444 148 1.503 1.500556 0.002444444 149 1.503 1.500556 0.002444444 150 1.503 1.500556 0.002444444 151 1.503 1.500556 0.002444444 152 1.503 1.500556 0.002444444 153 1.503 1.500556 0.002444444 154 1.503 1.500556 0.002444444 155 1.503 1.500556 0.002444444 156 1.503 1.500556 0.002444444 157 1.503 1.500556 0.002444444 158 1.467 1.500556 -0.033555556 159 1.467 1.500556 -0.033555556 160 1.467 1.500556 -0.033555556 161 1.467 1.500556 -0.033555556 162 1.467 1.500556 -0.033555556 163 1.467 1.500556 -0.033555556 164 1.467 1.500556 -0.033555556 165 1.467 1.500556 -0.033555556 166 1.467 1.500556 -0.033555556 167 1.467 1.500556 -0.033555556 168 1.467 1.500556 -0.033555556 169 1.467 1.500556 -0.033555556 170 1.467 1.500556 -0.033555556 171 1.467 1.500556 -0.033555556 172 1.467 1.500556 -0.033555556 173 1.450 1.500556 -0.050555556 174 1.450 1.500556 -0.050555556 175 1.450 1.500556 -0.050555556 176 1.450 1.500556 -0.050555556 177 1.450 1.500556 -0.050555556 178 1.450 1.500556 -0.050555556 179 1.450 1.500556 -0.050555556 180 1.450 1.500556 -0.050555556 181 1.450 1.500556 -0.050555556 182 1.450 1.500556 -0.050555556 183 1.450 1.500556 -0.050555556 > 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/455sq1355168779.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/5mxmc1355168779.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/6yzvd1355168779.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/7o6d71355168779.tab") + } > > try(system("convert tmp/2m5q61355168779.ps tmp/2m5q61355168779.png",intern=TRUE)) character(0) > try(system("convert tmp/3a0st1355168779.ps tmp/3a0st1355168779.png",intern=TRUE)) character(0) > try(system("convert tmp/455sq1355168779.ps tmp/455sq1355168779.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.077 0.421 5.482