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(1 + ,0 + ,80 + ,1 + ,0 + ,128 + ,1 + ,1 + ,123 + ,1 + ,NA + ,0 + ,1 + ,NA + ,0 + ,1 + ,NA + ,0 + ,1 + ,0 + ,125 + ,1 + ,NA + ,0 + ,0 + ,NA + ,0 + ,1 + ,0 + ,96 + ,1 + ,1 + ,138 + ,1 + ,1 + ,142 + ,1 + ,NA + ,0 + ,1 + ,0 + ,101 + ,1 + ,NA + ,0 + ,1 + ,NA + ,0 + ,1 + ,1 + ,126 + ,1 + ,0 + ,133 + ,1 + ,1 + ,106 + ,1 + ,0 + ,121 + ,1 + ,NA + ,0 + ,1 + ,0 + ,114 + ,1 + ,1 + ,172 + ,1 + ,0 + ,115 + ,1 + ,NA + ,0 + ,1 + ,1 + ,113 + ,1 + ,1 + ,121 + ,1 + ,0 + ,126 + ,1 + ,1 + ,139 + ,1 + ,1 + ,138 + ,1 + ,NA + ,0 + ,1 + ,0 + ,123 + ,1 + ,0 + ,127 + ,1 + ,NA + ,0 + ,1 + ,NA + ,0 + ,1 + ,0 + ,135 + ,0 + ,NA + ,0 + ,1 + ,NA + ,0 + ,1 + ,1 + ,113 + ,0 + ,1 + ,131 + ,1 + ,NA + ,0 + ,1 + ,0 + ,147 + ,0 + ,0 + ,145 + ,1 + ,1 + ,113 + ,1 + ,NA + ,0 + ,1 + ,0 + ,130 + ,0 + ,1 + ,123 + ,1 + ,0 + ,161 + ,1 + ,1 + ,140 + ,1 + ,NA + ,0 + ,1 + ,1 + ,140 + ,1 + ,NA + ,0 + ,1 + ,0 + ,134 + ,1 + ,NA + ,0 + ,1 + ,NA + ,0 + ,1 + ,1 + ,124 + ,1 + ,1 + ,128 + ,1 + ,1 + ,133 + ,1 + ,NA + ,0 + ,1 + ,NA + ,0 + ,1 + ,1 + ,140 + ,1 + ,1 + ,127 + ,0 + ,1 + ,132 + ,0 + ,0 + ,122 + ,1 + ,NA + ,0 + ,1 + ,1 + ,141 + ,1 + ,NA + ,0 + ,1 + ,NA + ,0 + ,1 + ,0 + ,110 + ,1 + ,NA + ,0 + ,1 + ,NA + ,0 + ,1 + ,1 + ,135 + ,1 + ,1 + ,139 + ,1 + ,0 + ,133 + ,1 + ,1 + ,129 + ,1 + ,0 + ,122 + ,1 + ,NA + ,0 + ,1 + ,NA + ,0 + ,1 + ,1 + ,122 + ,1 + ,NA + ,0 + ,1 + ,0 + ,106 + ,1 + ,0 + ,126 + ,1 + ,NA + ,0 + ,1 + ,0 + ,158 + ,1 + ,1 + ,132 + ,1 + ,NA + ,0 + ,1 + ,1 + ,137 + ,1 + ,NA + ,0 + ,1 + ,1 + ,117 + ,1 + ,NA + ,0 + ,1 + ,1 + ,130 + ,1 + ,NA + ,0 + ,1 + ,1 + ,120 + ,1 + ,0 + ,128 + ,0 + ,1 + ,129 + ,1 + ,1 + ,126 + ,1 + ,NA + ,0 + ,1 + ,1 + ,117 + ,1 + ,NA + ,0 + ,1 + ,0 + ,127 + ,1 + ,1 + ,95 + ,1 + ,1 + ,111 + ,1 + ,1 + ,122 + ,1 + ,1 + ,111 + ,1 + ,NA + ,0 + ,1 + ,1 + ,115 + ,1 + ,0 + ,100 + ,0 + ,1 + ,98 + ,1 + ,0 + ,126 + ,1 + ,0 + ,135 + ,1 + ,1 + ,130 + ,1 + ,0 + ,126 + ,1 + ,NA + ,0 + ,1 + ,NA + ,0 + ,1 + ,1 + ,115 + ,1 + ,NA + ,0 + ,1 + ,NA + ,0 + ,0 + ,1 + ,134 + ,1 + ,0 + ,147 + ,0 + ,1 + ,114 + ,0 + ,1 + ,135 + ,0 + ,1 + ,121 + ,0 + ,NA + ,0 + ,1 + ,1 + ,107 + ,1 + ,NA + ,0 + ,0 + ,NA + ,0 + ,0 + ,0 + ,142 + ,0 + ,1 + ,144 + ,1 + ,1 + ,129 + ,1 + ,1 + ,145 + ,0 + ,NA + ,0 + ,1 + ,1 + ,131 + ,1 + ,NA + ,0 + ,0 + ,0 + ,123 + ,1 + ,1 + ,132 + ,1 + ,0 + ,119 + ,1 + ,1 + ,94 + ,1 + ,1 + ,111 + ,0 + ,0 + ,112 + ,1 + ,0 + ,127 + ,0 + ,1 + ,123 + ,0 + ,1 + ,115 + ,0 + ,NA + ,0 + ,1 + ,1 + ,129 + ,1 + ,NA + ,0 + ,0 + ,NA + ,0 + ,1 + ,0 + ,131 + ,1 + ,0 + ,131 + ,1 + ,NA + ,0 + ,1 + ,NA + ,0 + ,1 + ,1 + ,109 + ,1 + ,NA + ,123 + ,0 + ,1 + ,115 + ,1 + ,0 + ,147 + ,1 + ,NA + ,0 + ,1 + ,1 + ,123 + ,1 + ,0 + ,117 + ,0 + ,NA + ,0 + ,1 + ,NA + ,0 + ,1 + ,1 + ,117 + ,1 + ,NA + ,0 + ,1 + ,1 + ,117 + ,0 + ,0 + ,105 + ,1 + ,0 + ,119 + ,1 + ,0 + ,119 + ,1 + ,0 + ,121 + ,1 + ,NA + ,0 + ,1 + ,NA + ,0 + ,0 + ,0 + ,122 + ,0 + ,1 + ,126 + ,1 + ,1 + ,118 + ,1 + ,0 + ,119 + ,1 + ,1 + ,118 + ,1 + ,0 + ,116 + ,1 + ,NA + ,0 + ,0 + ,NA + ,0 + ,1 + ,NA + ,0 + ,0 + ,1 + ,102 + ,1 + ,0 + ,136 + ,0 + ,0 + ,106 + ,0 + ,1 + ,127 + ,0 + ,0 + ,121 + ,1 + ,NA + ,0 + ,1 + ,1 + ,128 + ,1 + ,1 + ,144 + ,1 + ,NA + ,0 + ,1 + ,NA + ,0 + ,1 + ,NA + ,0 + ,0 + ,NA + ,0 + ,1 + ,1 + ,122 + ,1 + ,NA + ,0 + ,0 + ,0 + ,119 + ,0 + ,NA + ,0 + ,0 + ,0 + ,132 + ,0 + ,1 + ,122 + ,0 + ,0 + ,125 + ,0 + ,1 + ,134 + ,0 + ,1 + ,136 + ,0 + ,NA + ,0 + ,0 + ,1 + ,114 + ,0 + ,NA + ,0 + ,0 + ,NA + ,0 + ,0 + ,0 + ,102 + ,0 + ,0 + ,109 + ,0 + ,NA + ,0 + ,0 + ,NA + ,0 + ,0 + ,NA + ,0 + ,0 + ,1 + ,129 + ,0 + ,1 + ,130 + ,0 + ,NA + ,0 + ,0 + ,NA + ,0 + ,0 + ,0 + ,145 + ,0 + ,NA + ,0 + ,0 + ,0 + ,118 + ,0 + ,0 + ,131 + ,0 + ,0 + ,131 + ,0 + ,NA + ,0 + ,0 + ,1 + ,122 + ,0 + ,1 + ,147 + ,0 + ,NA + ,0 + ,0 + ,1 + ,110 + ,0 + ,1 + ,143 + ,0 + ,0 + ,111 + ,0 + ,NA + ,0 + ,0 + ,1 + ,96 + ,0 + ,0 + ,132 + ,0 + ,NA + ,0 + ,0 + ,1 + ,113 + ,0 + ,NA + ,0 + ,0 + ,1 + ,138 + ,0 + ,0 + ,142 + ,0 + ,1 + ,131 + ,0 + ,NA + ,0 + ,0 + ,NA + ,0 + ,0 + ,1 + ,134 + ,0 + ,1 + ,110 + ,0 + ,1 + ,138 + ,0 + ,NA + ,0 + ,0 + ,1 + ,132 + ,0 + ,NA + ,0 + ,0 + ,1 + ,122 + ,0 + ,1 + ,134 + ,0 + ,NA + ,0 + ,0 + ,0 + ,145 + ,0 + ,NA + ,0 + ,0 + ,NA + ,0 + ,0 + ,0 + ,146 + ,0 + ,1 + ,99 + ,0 + ,NA + ,0 + ,0 + ,NA + ,0 + ,0 + ,1 + ,137 + ,0 + ,1 + ,123 + ,0 + ,NA + ,0 + ,0 + ,0 + ,117 + ,0 + ,0 + ,124 + ,0 + ,0 + ,126 + ,0 + ,1 + ,142 + ,0 + ,1 + ,119 + ,0 + ,NA + ,0 + ,0 + ,NA + ,0 + ,0 + ,NA + ,0 + ,0 + ,NA + ,0 + ,0 + ,NA + ,0 + ,0 + ,NA + ,0 + ,0 + ,NA + ,0 + ,0 + ,NA + ,0 + ,0 + ,0 + ,127 + ,0 + ,0 + ,131 + ,0 + ,0 + ,122 + ,0 + ,0 + ,115 + ,0 + ,NA + ,0 + ,0 + ,NA + ,0 + ,0 + ,NA + ,0 + ,0 + ,NA + ,0 + ,0 + ,NA + ,0 + ,0 + ,NA + ,0 + ,0 + ,NA + ,0 + ,0 + ,1 + ,103 + ,0 + ,NA + ,0 + ,0 + ,0 + ,136 + ,0 + ,NA + ,0 + ,0 + ,NA + ,0 + ,0 + ,NA + ,0 + ,0 + ,NA + ,0 + ,0 + ,1 + ,131 + ,0 + ,NA + ,0 + ,0 + ,NA + ,0 + ,0 + ,NA + ,0 + ,0 + ,1 + ,131) + ,dim=c(3 + ,289) + ,dimnames=list(c('Groep' + ,'Geslacht' + ,'ScoresMotivatie') + ,1:289)) > y <- array(NA,dim=c(3,289),dimnames=list(c('Groep','Geslacht','ScoresMotivatie'),1:289)) > 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 = '2' > par2 = 'none' > par1 = '2' > 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] "Geslacht" > x[,par1] [1] 0 0 1 0 0 1 1 0 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 1 0 0 1 0 1 0 1 1 0 1 1 1 [38] 1 1 1 0 1 0 1 1 0 1 0 1 0 0 0 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 0 0 1 0 1 [75] 1 0 1 1 1 1 0 1 1 1 1 0 1 0 1 1 0 0 1 1 1 0 0 1 1 0 1 0 1 1 0 0 0 0 0 1 1 [112] 0 1 0 1 0 0 1 0 1 1 1 0 0 1 0 1 1 1 0 0 1 1 0 0 0 0 1 1 1 1 0 1 0 1 1 0 1 [149] 1 1 1 1 1 1 0 0 1 1 1 0 0 0 1 1 0 0 0 0 1 0 1 1 > 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 73 99 > colnames(x) [1] "Groep" "Geslacht" "ScoresMotivatie" > colnames(x)[par1] [1] "Geslacht" > x[,par1] [1] 0 0 1 0 0 1 1 0 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 1 0 0 1 0 1 0 1 1 0 1 1 1 [38] 1 1 1 0 1 0 1 1 0 1 0 1 0 0 0 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 0 0 1 0 1 [75] 1 0 1 1 1 1 0 1 1 1 1 0 1 0 1 1 0 0 1 1 1 0 0 1 1 0 1 0 1 1 0 0 0 0 0 1 1 [112] 0 1 0 1 0 0 1 0 1 1 1 0 0 1 0 1 1 1 0 0 1 1 0 0 0 0 1 1 1 1 0 1 0 1 1 0 1 [149] 1 1 1 1 1 1 0 0 1 1 1 0 0 0 1 1 0 0 0 0 1 0 1 1 > 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/18j7f1323809598.tab") + } + } > m Conditional inference tree with 1 terminal nodes Response: Geslacht Inputs: Groep, ScoresMotivatie Number of observations: 172 1)* weights = 172 > postscript(file="/var/wessaorg/rcomp/tmp/2hvqj1323809598.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/36jki1323809598.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 0 0.5755814 -0.5755814 2 0 0.5755814 -0.5755814 3 1 0.5755814 0.4244186 4 0 0.5755814 -0.5755814 5 0 0.5755814 -0.5755814 6 1 0.5755814 0.4244186 7 1 0.5755814 0.4244186 8 0 0.5755814 -0.5755814 9 1 0.5755814 0.4244186 10 0 0.5755814 -0.5755814 11 1 0.5755814 0.4244186 12 0 0.5755814 -0.5755814 13 0 0.5755814 -0.5755814 14 1 0.5755814 0.4244186 15 0 0.5755814 -0.5755814 16 1 0.5755814 0.4244186 17 1 0.5755814 0.4244186 18 0 0.5755814 -0.5755814 19 1 0.5755814 0.4244186 20 1 0.5755814 0.4244186 21 0 0.5755814 -0.5755814 22 0 0.5755814 -0.5755814 23 0 0.5755814 -0.5755814 24 1 0.5755814 0.4244186 25 1 0.5755814 0.4244186 26 0 0.5755814 -0.5755814 27 0 0.5755814 -0.5755814 28 1 0.5755814 0.4244186 29 0 0.5755814 -0.5755814 30 1 0.5755814 0.4244186 31 0 0.5755814 -0.5755814 32 1 0.5755814 0.4244186 33 1 0.5755814 0.4244186 34 0 0.5755814 -0.5755814 35 1 0.5755814 0.4244186 36 1 0.5755814 0.4244186 37 1 0.5755814 0.4244186 38 1 0.5755814 0.4244186 39 1 0.5755814 0.4244186 40 1 0.5755814 0.4244186 41 0 0.5755814 -0.5755814 42 1 0.5755814 0.4244186 43 0 0.5755814 -0.5755814 44 1 0.5755814 0.4244186 45 1 0.5755814 0.4244186 46 0 0.5755814 -0.5755814 47 1 0.5755814 0.4244186 48 0 0.5755814 -0.5755814 49 1 0.5755814 0.4244186 50 0 0.5755814 -0.5755814 51 0 0.5755814 -0.5755814 52 0 0.5755814 -0.5755814 53 1 0.5755814 0.4244186 54 1 0.5755814 0.4244186 55 1 0.5755814 0.4244186 56 1 0.5755814 0.4244186 57 1 0.5755814 0.4244186 58 0 0.5755814 -0.5755814 59 1 0.5755814 0.4244186 60 1 0.5755814 0.4244186 61 1 0.5755814 0.4244186 62 0 0.5755814 -0.5755814 63 1 0.5755814 0.4244186 64 1 0.5755814 0.4244186 65 1 0.5755814 0.4244186 66 1 0.5755814 0.4244186 67 1 0.5755814 0.4244186 68 0 0.5755814 -0.5755814 69 1 0.5755814 0.4244186 70 0 0.5755814 -0.5755814 71 0 0.5755814 -0.5755814 72 1 0.5755814 0.4244186 73 0 0.5755814 -0.5755814 74 1 0.5755814 0.4244186 75 1 0.5755814 0.4244186 76 0 0.5755814 -0.5755814 77 1 0.5755814 0.4244186 78 1 0.5755814 0.4244186 79 1 0.5755814 0.4244186 80 1 0.5755814 0.4244186 81 0 0.5755814 -0.5755814 82 1 0.5755814 0.4244186 83 1 0.5755814 0.4244186 84 1 0.5755814 0.4244186 85 1 0.5755814 0.4244186 86 0 0.5755814 -0.5755814 87 1 0.5755814 0.4244186 88 0 0.5755814 -0.5755814 89 1 0.5755814 0.4244186 90 1 0.5755814 0.4244186 91 0 0.5755814 -0.5755814 92 0 0.5755814 -0.5755814 93 1 0.5755814 0.4244186 94 1 0.5755814 0.4244186 95 1 0.5755814 0.4244186 96 0 0.5755814 -0.5755814 97 0 0.5755814 -0.5755814 98 1 0.5755814 0.4244186 99 1 0.5755814 0.4244186 100 0 0.5755814 -0.5755814 101 1 0.5755814 0.4244186 102 0 0.5755814 -0.5755814 103 1 0.5755814 0.4244186 104 1 0.5755814 0.4244186 105 0 0.5755814 -0.5755814 106 0 0.5755814 -0.5755814 107 0 0.5755814 -0.5755814 108 0 0.5755814 -0.5755814 109 0 0.5755814 -0.5755814 110 1 0.5755814 0.4244186 111 1 0.5755814 0.4244186 112 0 0.5755814 -0.5755814 113 1 0.5755814 0.4244186 114 0 0.5755814 -0.5755814 115 1 0.5755814 0.4244186 116 0 0.5755814 -0.5755814 117 0 0.5755814 -0.5755814 118 1 0.5755814 0.4244186 119 0 0.5755814 -0.5755814 120 1 0.5755814 0.4244186 121 1 0.5755814 0.4244186 122 1 0.5755814 0.4244186 123 0 0.5755814 -0.5755814 124 0 0.5755814 -0.5755814 125 1 0.5755814 0.4244186 126 0 0.5755814 -0.5755814 127 1 0.5755814 0.4244186 128 1 0.5755814 0.4244186 129 1 0.5755814 0.4244186 130 0 0.5755814 -0.5755814 131 0 0.5755814 -0.5755814 132 1 0.5755814 0.4244186 133 1 0.5755814 0.4244186 134 0 0.5755814 -0.5755814 135 0 0.5755814 -0.5755814 136 0 0.5755814 -0.5755814 137 0 0.5755814 -0.5755814 138 1 0.5755814 0.4244186 139 1 0.5755814 0.4244186 140 1 0.5755814 0.4244186 141 1 0.5755814 0.4244186 142 0 0.5755814 -0.5755814 143 1 0.5755814 0.4244186 144 0 0.5755814 -0.5755814 145 1 0.5755814 0.4244186 146 1 0.5755814 0.4244186 147 0 0.5755814 -0.5755814 148 1 0.5755814 0.4244186 149 1 0.5755814 0.4244186 150 1 0.5755814 0.4244186 151 1 0.5755814 0.4244186 152 1 0.5755814 0.4244186 153 1 0.5755814 0.4244186 154 1 0.5755814 0.4244186 155 0 0.5755814 -0.5755814 156 0 0.5755814 -0.5755814 157 1 0.5755814 0.4244186 158 1 0.5755814 0.4244186 159 1 0.5755814 0.4244186 160 0 0.5755814 -0.5755814 161 0 0.5755814 -0.5755814 162 0 0.5755814 -0.5755814 163 1 0.5755814 0.4244186 164 1 0.5755814 0.4244186 165 0 0.5755814 -0.5755814 166 0 0.5755814 -0.5755814 167 0 0.5755814 -0.5755814 168 0 0.5755814 -0.5755814 169 1 0.5755814 0.4244186 170 0 0.5755814 -0.5755814 171 1 0.5755814 0.4244186 172 1 0.5755814 0.4244186 > 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/4gghb1323809598.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/5w6731323809598.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/6ro5n1323809598.tab") + } Warning message: In cor(result$Forecasts, result$Actuals) : the standard deviation is zero > 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/703hg1323809598.tab") + } > > try(system("convert tmp/2hvqj1323809598.ps tmp/2hvqj1323809598.png",intern=TRUE)) character(0) > try(system("convert tmp/36jki1323809598.ps tmp/36jki1323809598.png",intern=TRUE)) character(0) > try(system("convert tmp/4gghb1323809598.ps tmp/4gghb1323809598.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.859 0.253 3.609