R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing 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 + ,-4.813031 + ,0.266482 + ,1 + ,-4.075192 + ,0.33559 + ,1 + ,-4.443179 + ,0.311173 + ,1 + ,-4.117501 + ,0.334147 + ,1 + ,-3.747787 + ,0.234513 + ,1 + ,-4.242867 + ,0.299111 + ,1 + ,-5.634322 + ,0.257682 + ,1 + ,-6.167603 + ,0.183721 + ,1 + ,-5.498678 + ,0.327769 + ,1 + ,-5.011879 + ,0.325996 + ,1 + ,-5.24977 + ,0.391002 + ,1 + ,-4.960234 + ,0.363566 + ,1 + ,-6.547148 + ,0.152813 + ,1 + ,-5.660217 + ,0.254989 + ,1 + ,-6.105098 + ,0.203653 + ,1 + ,-5.340115 + ,0.210185 + ,1 + ,-5.44004 + ,0.239764 + ,1 + ,-2.93107 + ,0.434326 + ,1 + ,-3.949079 + ,0.35787 + ,1 + ,-4.554466 + ,0.340176 + ,1 + ,-4.095442 + ,0.262564 + ,1 + ,-5.18696 + ,0.237622 + ,1 + ,-4.330956 + ,0.262384 + ,1 + ,-5.248776 + ,0.210279 + ,1 + ,-5.557447 + ,0.22089 + ,1 + ,-5.571843 + ,0.236853 + ,1 + ,-6.18359 + ,0.226278 + ,1 + ,-6.27169 + ,0.196102 + ,1 + ,-7.120925 + ,0.279789 + ,1 + ,-6.635729 + ,0.209866 + ,0 + ,-7.3483 + ,0.177551 + ,0 + ,-7.682587 + ,0.173319 + ,0 + ,-7.067931 + ,0.175181 + ,0 + ,-7.695734 + ,0.17854 + ,0 + ,-7.964984 + ,0.163519 + ,0 + ,-7.777685 + ,0.170183 + ,1 + ,-6.149653 + ,0.218037 + ,1 + ,-6.006414 + ,0.196371 + ,1 + ,-6.452058 + ,0.212294 + ,1 + ,-6.006647 + ,0.266892 + ,1 + ,-6.647379 + ,0.201095 + ,1 + ,-7.044105 + ,0.063412 + ,0 + ,-7.31055 + ,0.098648 + ,0 + ,-6.793547 + ,0.158266 + ,0 + ,-7.057869 + ,0.091608 + ,0 + ,-6.99582 + ,0.102083 + ,0 + ,-7.156076 + ,0.127642 + ,0 + ,-7.31951 + ,0.200873 + ,0 + ,-6.439398 + ,0.266392 + ,0 + ,-6.482096 + ,0.264967 + ,0 + ,-6.650471 + ,0.254498 + ,0 + ,-6.689151 + ,0.291954 + ,0 + ,-7.072419 + ,0.220434 + ,0 + ,-6.836811 + ,0.269866 + ,1 + ,-4.649573 + ,0.205558 + ,1 + ,-4.333543 + ,0.221727 + ,1 + ,-4.438453 + ,0.238298 + ,1 + ,-4.60826 + ,0.290024 + ,1 + ,-4.476755 + ,0.262633 + ,1 + ,-4.609161 + ,0.221711 + ,0 + ,-7.040508 + ,0.066994 + ,0 + ,-7.293801 + ,0.086372 + ,0 + ,-6.966321 + ,0.095882 + ,0 + ,-7.24562 + ,0.018689 + ,0 + ,-7.496264 + ,0.056844 + ,0 + ,-7.314237 + ,0.006274 + ,1 + ,-5.409423 + ,0.22685 + ,1 + ,-5.324574 + ,0.20566 + ,1 + ,-5.86975 + ,0.151814 + ,1 + ,-6.261141 + ,0.120956 + ,1 + ,-5.720868 + ,0.15883 + ,1 + ,-5.207985 + ,0.224852 + ,1 + ,-5.79182 + ,0.329066 + ,1 + ,-5.389129 + ,0.306636 + ,1 + ,-5.31336 + ,0.201861 + ,1 + ,-5.477592 + ,0.315074 + ,1 + ,-5.775966 + ,0.341169 + ,1 + ,-5.391029 + ,0.250572 + ,1 + ,-5.115212 + ,0.249494 + ,1 + ,-4.913885 + ,0.265699 + ,1 + ,-4.441519 + ,0.155097 + ,1 + ,-5.132032 + ,0.210458 + ,1 + ,-5.022288 + ,0.146948 + ,1 + ,-6.025367 + ,0.078202 + ,1 + ,-5.288912 + ,0.343073 + ,1 + ,-5.657899 + ,0.315903 + ,1 + ,-6.366916 + ,0.335753 + ,1 + ,-5.515071 + ,0.299549 + ,1 + ,-5.783272 + ,0.299793 + ,1 + ,-4.379411 + ,0.375531 + ,1 + ,-4.508984 + ,0.389232 + ,1 + ,-6.411497 + ,0.207156 + ,1 + ,-5.952058 + ,0.08784 + ,1 + ,-6.152551 + ,0.17352 + ,1 + ,-6.251425 + ,0.188056 + ,1 + ,-6.247076 + ,0.180528 + ,1 + ,-6.41744 + ,0.194627 + ,1 + ,-4.020042 + ,0.265315 + ,1 + ,-5.159169 + ,0.202146 + ,1 + ,-3.760348 + ,0.242861 + ,1 + ,-3.700544 + ,0.260481 + ,1 + ,-4.20273 + ,0.310163 + ,1 + ,-3.269487 + ,0.270641 + ,1 + ,-6.878393 + ,0.089267 + ,1 + ,-7.111576 + ,0.14478 + ,1 + ,-6.997403 + ,0.210279 + ,1 + ,-6.981201 + ,0.18455 + ,1 + ,-6.600023 + ,0.249172 + ,1 + ,-6.739151 + ,0.160686 + ,1 + ,-5.845099 + ,0.278679 + ,1 + ,-5.25832 + ,0.256454 + ,1 + ,-6.471427 + ,0.184378 + ,1 + ,-4.876336 + ,0.212054 + ,1 + ,-5.96304 + ,0.250283 + ,1 + ,-6.729713 + ,0.181701 + ,1 + ,-4.673241 + ,0.261549 + ,1 + ,-6.051233 + ,0.27328 + ,1 + ,-4.597834 + ,0.372114 + ,1 + ,-4.913137 + ,0.393056 + ,1 + ,-5.517173 + ,0.389295 + ,1 + ,-6.186128 + ,0.279933 + ,1 + ,-4.711007 + ,0.281618 + ,1 + ,-5.418787 + ,0.160267 + ,1 + ,-5.44514 + ,0.142466 + ,1 + ,-5.944191 + ,0.143359 + ,1 + ,-5.594275 + ,0.12795 + ,1 + ,-5.540351 + ,0.087165 + ,1 + ,-5.825257 + ,0.115697 + ,1 + ,-6.890021 + ,0.152941 + ,1 + ,-5.892061 + ,0.195976 + ,1 + ,-6.135296 + ,0.20363 + ,1 + ,-6.112667 + ,0.217013 + ,1 + ,-5.436135 + ,0.254909 + ,1 + ,-6.448134 + ,0.178713 + ,1 + ,-5.301321 + ,0.320385 + ,1 + ,-5.333619 + ,0.322044 + ,1 + ,-4.378916 + ,0.300067 + ,1 + ,-4.654894 + ,0.304107 + ,1 + ,-5.634576 + ,0.306014 + ,1 + ,-5.866357 + ,0.23307 + ,1 + ,-4.796845 + ,0.397749 + ,1 + ,-5.410336 + ,0.288917 + ,1 + ,-5.585259 + ,0.310746 + ,1 + ,-5.898673 + ,0.213353 + ,1 + ,-6.132663 + ,0.220617 + ,1 + ,-5.456811 + ,0.345238 + ,1 + ,-3.297668 + ,0.414758 + ,1 + ,-4.276605 + ,0.355736 + ,1 + ,-3.377325 + ,0.335357 + ,1 + ,-4.892495 + ,0.262281 + ,1 + ,-4.484303 + ,0.340256 + ,1 + ,-2.434031 + ,0.450493 + ,1 + ,-2.839756 + ,0.356224 + ,1 + ,-4.865194 + ,0.246404 + ,1 + ,-4.239028 + ,0.175691 + ,1 + ,-3.583722 + ,0.207914 + ,1 + ,-5.4351 + ,0.230532 + ,1 + ,-3.444478 + ,0.303214 + ,1 + ,-5.070096 + ,0.280091 + ,1 + ,-5.498456 + ,0.234196 + ,1 + ,-5.185987 + ,0.259229 + ,1 + ,-5.283009 + ,0.226528 + ,1 + ,-5.529833 + ,0.24275 + ,1 + ,-5.617124 + ,0.184896 + ,1 + ,-2.929379 + ,0.396746 + ,0 + ,-6.816086 + ,0.17227 + ,0 + ,-7.018057 + ,0.176316 + ,0 + ,-7.517934 + ,0.160414 + ,0 + ,-5.736781 + ,0.164529 + ,0 + ,-7.169701 + ,0.073298 + ,0 + ,-7.3045 + ,0.171088 + ,0 + ,-6.323531 + ,0.218885 + ,0 + ,-6.085567 + ,0.192375 + ,0 + ,-5.943501 + ,0.19215 + ,0 + ,-6.012559 + ,0.229298 + ,0 + ,-5.966779 + ,0.197938 + ,0 + ,-6.016891 + ,0.109256 + ,1 + ,-6.486822 + ,0.197919 + ,1 + ,-6.311987 + ,0.182459 + ,1 + ,-5.711205 + ,0.240875 + ,1 + ,-6.261446 + ,0.183218 + ,1 + ,-5.704053 + ,0.216204 + ,1 + ,-6.27717 + ,0.109397 + ,0 + ,-5.61907 + ,0.191576 + ,0 + ,-5.198864 + ,0.206768 + ,0 + ,-5.592584 + ,0.133917 + ,0 + ,-6.431119 + ,0.15331 + ,0 + ,-6.359018 + ,0.116636 + ,0 + ,-6.710219 + ,0.149694 + ,0 + ,-6.934474 + ,0.15989 + ,0 + ,-6.538586 + ,0.121952 + ,0 + ,-6.195325 + ,0.129303 + ,0 + ,-6.787197 + ,0.158453 + ,0 + ,-6.744577 + ,0.207454 + ,0 + ,-5.724056 + ,0.190667) + ,dim=c(3 + ,195) + ,dimnames=list(c('status' + ,'spread1' + ,'spread2') + ,1:195)) > y <- array(NA,dim=c(3,195),dimnames=list(c('status','spread1','spread2'),1:195)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par4 = 'yes' > par3 = '2' > par2 = 'equal' > par1 = '1' > par4 <- 'yes' > par3 <- '2' > par2 <- 'equal' > par1 <- '1' > #'GNU S' R Code compiled by R2WASP v. 1.2.291 () > #Author: root > #To cite this work: Wessa P., 2012, Recursive Partitioning (Regression Trees) (v1.0.3) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_regression_trees.wasp/ > #Source of accompanying publication: > # > 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 objects 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 is masked from 'package:survival': untangle.specials The following objects 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] "status" > x[,par1] [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 [38] 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 [75] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [112] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [149] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 [186] 0 0 0 0 0 0 0 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]) C1 C2 48 147 > colnames(x) [1] "status" "spread1" "spread2" > colnames(x)[par1] [1] "status" > x[,par1] [1] C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 [26] C2 C2 C2 C2 C2 C1 C1 C1 C1 C1 C1 C2 C2 C2 C2 C2 C2 C1 C1 C1 C1 C1 C1 C1 C1 [51] C1 C1 C1 C1 C2 C2 C2 C2 C2 C2 C1 C1 C1 C1 C1 C1 C2 C2 C2 C2 C2 C2 C2 C2 C2 [76] C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 [101] C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 [126] C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 [151] C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C2 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 [176] C1 C1 C2 C2 C2 C2 C2 C2 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 C1 Levels: C1 C2 > 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/1u1yl1386781097.tab") + } + } m.ct.i.pred m.ct.i.actu 1 2 1 278 155 2 81 1222 [1] 0.6420323 [1] 0.9378358 [1] 0.8640553 m.ct.x.pred m.ct.x.actu 1 2 1 32 15 2 9 158 [1] 0.6808511 [1] 0.9461078 [1] 0.8878505 > m Conditional inference tree with 4 terminal nodes Response: as.factor(status) Inputs: spread1, spread2 Number of observations: 195 1) spread1 <= -6.650471; criterion = 1, statistic = 61.894 2)* weights = 40 1) spread1 > -6.650471 3) spread2 <= 0.192375; criterion = 1, statistic = 13.619 4)* weights = 36 3) spread2 > 0.192375 5) spread1 <= -5.966779; criterion = 0.978, statistic = 6.475 6)* weights = 24 5) spread1 > -5.966779 7)* weights = 95 > postscript(file="/var/wessaorg/rcomp/tmp/2p6wd1386781097.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/37dfs1386781097.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) + } > if (par2 != 'none') { + print(cbind(as.factor(x[,par1]),predict(m))) + myt <- table(as.factor(x[,par1]),predict(m)) + print(myt) + } [,1] [,2] [1,] 2 2 [2,] 2 2 [3,] 2 2 [4,] 2 2 [5,] 2 2 [6,] 2 2 [7,] 2 2 [8,] 2 2 [9,] 2 2 [10,] 2 2 [11,] 2 2 [12,] 2 2 [13,] 2 2 [14,] 2 2 [15,] 2 2 [16,] 2 2 [17,] 2 2 [18,] 2 2 [19,] 2 2 [20,] 2 2 [21,] 2 2 [22,] 2 2 [23,] 2 2 [24,] 2 2 [25,] 2 2 [26,] 2 2 [27,] 2 2 [28,] 2 2 [29,] 2 1 [30,] 2 2 [31,] 1 1 [32,] 1 1 [33,] 1 1 [34,] 1 1 [35,] 1 1 [36,] 1 1 [37,] 2 2 [38,] 2 2 [39,] 2 2 [40,] 2 2 [41,] 2 2 [42,] 2 1 [43,] 1 1 [44,] 1 1 [45,] 1 1 [46,] 1 1 [47,] 1 1 [48,] 1 1 [49,] 1 2 [50,] 1 2 [51,] 1 1 [52,] 1 1 [53,] 1 1 [54,] 1 1 [55,] 2 2 [56,] 2 2 [57,] 2 2 [58,] 2 2 [59,] 2 2 [60,] 2 2 [61,] 1 1 [62,] 1 1 [63,] 1 1 [64,] 1 1 [65,] 1 1 [66,] 1 1 [67,] 2 2 [68,] 2 2 [69,] 2 2 [70,] 2 2 [71,] 2 2 [72,] 2 2 [73,] 2 2 [74,] 2 2 [75,] 2 2 [76,] 2 2 [77,] 2 2 [78,] 2 2 [79,] 2 2 [80,] 2 2 [81,] 2 2 [82,] 2 2 [83,] 2 2 [84,] 2 2 [85,] 2 2 [86,] 2 2 [87,] 2 2 [88,] 2 2 [89,] 2 2 [90,] 2 2 [91,] 2 2 [92,] 2 2 [93,] 2 2 [94,] 2 2 [95,] 2 2 [96,] 2 2 [97,] 2 2 [98,] 2 2 [99,] 2 2 [100,] 2 2 [101,] 2 2 [102,] 2 2 [103,] 2 2 [104,] 2 1 [105,] 2 1 [106,] 2 1 [107,] 2 1 [108,] 2 2 [109,] 2 1 [110,] 2 2 [111,] 2 2 [112,] 2 2 [113,] 2 2 [114,] 2 2 [115,] 2 1 [116,] 2 2 [117,] 2 2 [118,] 2 2 [119,] 2 2 [120,] 2 2 [121,] 2 2 [122,] 2 2 [123,] 2 2 [124,] 2 2 [125,] 2 2 [126,] 2 2 [127,] 2 2 [128,] 2 2 [129,] 2 1 [130,] 2 2 [131,] 2 2 [132,] 2 2 [133,] 2 2 [134,] 2 2 [135,] 2 2 [136,] 2 2 [137,] 2 2 [138,] 2 2 [139,] 2 2 [140,] 2 2 [141,] 2 2 [142,] 2 2 [143,] 2 2 [144,] 2 2 [145,] 2 2 [146,] 2 2 [147,] 2 2 [148,] 2 2 [149,] 2 2 [150,] 2 2 [151,] 2 2 [152,] 2 2 [153,] 2 2 [154,] 2 2 [155,] 2 2 [156,] 2 2 [157,] 2 2 [158,] 2 2 [159,] 2 2 [160,] 2 2 [161,] 2 2 [162,] 2 2 [163,] 2 2 [164,] 2 2 [165,] 2 2 [166,] 1 1 [167,] 1 1 [168,] 1 1 [169,] 1 2 [170,] 1 1 [171,] 1 1 [172,] 1 2 [173,] 1 2 [174,] 1 2 [175,] 1 2 [176,] 1 2 [177,] 1 2 [178,] 2 2 [179,] 2 2 [180,] 2 2 [181,] 2 2 [182,] 2 2 [183,] 2 2 [184,] 1 2 [185,] 1 2 [186,] 1 2 [187,] 1 2 [188,] 1 2 [189,] 1 1 [190,] 1 1 [191,] 1 2 [192,] 1 2 [193,] 1 1 [194,] 1 1 [195,] 1 2 C1 C2 C1 31 17 C2 9 138 > postscript(file="/var/wessaorg/rcomp/tmp/497n61386781097.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/5kzeq1386781097.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/65lu01386781098.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/7spty1386781098.tab") + } > > try(system("convert tmp/2p6wd1386781097.ps tmp/2p6wd1386781097.png",intern=TRUE)) character(0) > try(system("convert tmp/37dfs1386781097.ps tmp/37dfs1386781097.png",intern=TRUE)) character(0) > try(system("convert tmp/497n61386781097.ps tmp/497n61386781097.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.725 0.911 6.613