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. > par9 = 'Exam Items' > par8 = 'Learning Activities' > par7 = 'all' > par6 = 'all' > par5 = 'all' > par4 = 'no' > par3 = '3' > par2 = 'none' > par1 = '0' > par9 <- 'Exam Items' > par8 <- 'Learning Activities' > par7 <- 'all' > par6 <- 'all' > par5 <- 'all' > par4 <- 'no' > par3 <- '3' > par2 <- 'none' > par1 <- '0' > #'GNU S' R Code compiled by R2WASP v. 1.2.291 () > #Author: root > #To cite this work: Wessa P., 2012, Recursive Partitioning (Regression Trees) in Information Management (v1.0.8) 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 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 <- as.data.frame(read.table(file='http://www.wessa.net/download/utaut.csv',sep=',',header=T)) > x$U25 <- 6-x$U25 > if(par5 == 'female') x <- x[x$Gender==0,] > if(par5 == 'male') x <- x[x$Gender==1,] > if(par6 == 'prep') x <- x[x$Pop==1,] > if(par6 == 'bachelor') x <- x[x$Pop==0,] > if(par7 != 'all') { + x <- x[x$Year==as.numeric(par7),] + } > cAc <- with(x,cbind( A1, A2, A3, A4, A5, A6, A7, A8, A9,A10)) > cAs <- with(x,cbind(A11,A12,A13,A14,A15,A16,A17,A18,A19,A20)) > cA <- cbind(cAc,cAs) > cCa <- with(x,cbind(C1,C3,C5,C7, C9,C11,C13,C15,C17,C19,C21,C23,C25,C27,C29,C31,C33,C35,C37,C39,C41,C43,C45,C47)) > cCp <- with(x,cbind(C2,C4,C6,C8,C10,C12,C14,C16,C18,C20,C22,C24,C26,C28,C30,C32,C34,C36,C38,C40,C42,C44,C46,C48)) > cC <- cbind(cCa,cCp) > cU <- with(x,cbind(U1,U2,U3,U4,U5,U6,U7,U8,U9,U10,U11,U12,U13,U14,U15,U16,U17,U18,U19,U20,U21,U22,U23,U24,U25,U26,U27,U28,U29,U30,U31,U32,U33)) > cE <- with(x,cbind(BC,NNZFG,MRT,AFL,LPM,LPC,W,WPA)) > cX <- with(x,cbind(X1,X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12,X13,X14,X15,X16,X17,X18)) > if (par8=='ATTLES connected') x <- cAc > if (par8=='ATTLES separate') x <- cAs > if (par8=='ATTLES all') x <- cA > if (par8=='COLLES actuals') x <- cCa > if (par8=='COLLES preferred') x <- cCp > if (par8=='COLLES all') x <- cC > if (par8=='CSUQ') x <- cU > if (par8=='Learning Activities') x <- cE > if (par8=='Exam Items') x <- cX > if (par9=='ATTLES connected') y <- cAc > if (par9=='ATTLES separate') y <- cAs > if (par9=='ATTLES all') y <- cA > if (par9=='COLLES actuals') y <- cCa > if (par9=='COLLES preferred') y <- cCp > if (par9=='COLLES all') y <- cC > if (par9=='CSUQ') y <- cU > if (par9=='Learning Activities') y <- cE > if (par9=='Exam Items') y <- cX > if (par1==0) { + nr <- length(y[,1]) + nc <- length(y[1,]) + mysum <- array(0,dim=nr) + for(jjj in 1:nr) { + for(iii in 1:nc) { + mysum[jjj] = mysum[jjj] + y[jjj,iii] + } + } + y <- mysum + } else { + y <- y[,par1] + } > nx <- cbind(y,x) > colnames(nx) <- c('endo',colnames(x)) > x <- nx > par1=1 > ncol <- length(x[1,]) > for (jjj in 1:ncol) { + x <- x[!is.na(x[,jjj]),] + } > x <- as.data.frame(x) > k <- length(x[1,]) > n <- length(x[,1]) > colnames(x)[par1] [1] "endo" > x[,par1] [1] 12 8 1 2 5 12 11 9 2 4 5 4 5 4 -1 6 6 2 11 5 7 6 7 10 11 [26] 9 3 5 4 5 7 5 1 4 4 5 7 8 2 0 9 8 3 5 3 6 7 7 3 7 [51] 8 8 6 9 5 6 7 5 8 4 14 4 3 11 8 8 9 12 2 4 2 3 11 11 9 [76] 4 1 5 2 5 -1 7 4 3 7 7 5 8 7 5 10 7 5 9 4 2 5 12 4 6 [101] 5 7 8 11 3 1 13 7 2 5 3 -1 0 6 10 -2 8 11 11 9 10 2 8 12 10 [126] 2 0 9 -2 6 6 6 12 9 7 4 6 6 3 4 8 10 6 6 4 6 5 9 2 7 [151] 2 -1 3 6 10 10 2 10 4 7 8 9 5 10 5 8 8 4 6 0 0 9 8 9 4 [176] 9 10 2 8 -2 3 -1 12 9 5 6 4 13 11 3 5 9 7 11 7 1 13 3 6 7 [201] 5 3 2 3 12 14 10 11 4 4 10 10 12 6 7 9 2 8 2 5 10 4 6 0 6 [226] 4 12 11 10 10 4 1 10 8 3 6 11 8 6 4 2 6 5 5 8 5 9 7 6 8 [251] 8 10 3 8 9 11 0 4 11 5 4 9 9 8 4 1 5 3 3 5 8 0 -1 2 8 [276] 8 6 4 1 9 10 7 4 11 4 11 15 13 7 14 10 16 14 14 11 14 0 14 3 14 [301] 4 8 8 7 6 10 11 3 13 10 10 15 4 10 13 12 10 4 11 6 -4 0 6 7 11 [326] 13 6 10 5 0 0 7 8 6 11 0 8 0 0 8 17 9 -2 6 6 2 14 4 -1 2 [351] 10 9 -1 8 8 8 2 8 12 5 6 3 6 9 15 11 10 2 11 7 11 9 11 12 5 [376] 4 -2 11 7 13 6 -3 9 9 8 11 3 5 13 3 12 9 15 14 8 7 9 13 8 11 [401] 8 9 10 11 -3 7 3 15 7 4 10 10 0 4 15 4 15 6 2 6 14 13 6 11 0 [426] 9 8 3 8 7 7 -2 0 6 10 8 5 2 12 2 14 8 8 0 11 7 12 10 3 -1 [451] 10 3 9 11 10 11 16 8 6 10 12 13 10 10 6 8 7 10 1 10 16 7 13 0 14 [476] 1 11 10 8 0 7 12 12 6 7 12 9 11 14 9 11 12 0 12 7 5 0 8 10 7 [501] 8 1 7 0 3 11 4 16 6 16 0 6 6 3 1 8 7 5 0 5 11 5 7 11 10 [526] -2 18 12 14 3 8 6 4 7 8 11 8 8 7 2 11 10 8 8 10 6 9 0 14 8 [551] 5 8 6 0 1 9 6 > 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]) -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 2 7 9 28 13 28 32 42 42 52 47 61 38 46 43 23 13 16 7 5 1 1 > colnames(x) [1] "endo" "BC" "NNZFG" "MRT" "AFL" "LPM" "LPC" "W" "WPA" > colnames(x)[par1] [1] "endo" > x[,par1] [1] 12 8 1 2 5 12 11 9 2 4 5 4 5 4 -1 6 6 2 11 5 7 6 7 10 11 [26] 9 3 5 4 5 7 5 1 4 4 5 7 8 2 0 9 8 3 5 3 6 7 7 3 7 [51] 8 8 6 9 5 6 7 5 8 4 14 4 3 11 8 8 9 12 2 4 2 3 11 11 9 [76] 4 1 5 2 5 -1 7 4 3 7 7 5 8 7 5 10 7 5 9 4 2 5 12 4 6 [101] 5 7 8 11 3 1 13 7 2 5 3 -1 0 6 10 -2 8 11 11 9 10 2 8 12 10 [126] 2 0 9 -2 6 6 6 12 9 7 4 6 6 3 4 8 10 6 6 4 6 5 9 2 7 [151] 2 -1 3 6 10 10 2 10 4 7 8 9 5 10 5 8 8 4 6 0 0 9 8 9 4 [176] 9 10 2 8 -2 3 -1 12 9 5 6 4 13 11 3 5 9 7 11 7 1 13 3 6 7 [201] 5 3 2 3 12 14 10 11 4 4 10 10 12 6 7 9 2 8 2 5 10 4 6 0 6 [226] 4 12 11 10 10 4 1 10 8 3 6 11 8 6 4 2 6 5 5 8 5 9 7 6 8 [251] 8 10 3 8 9 11 0 4 11 5 4 9 9 8 4 1 5 3 3 5 8 0 -1 2 8 [276] 8 6 4 1 9 10 7 4 11 4 11 15 13 7 14 10 16 14 14 11 14 0 14 3 14 [301] 4 8 8 7 6 10 11 3 13 10 10 15 4 10 13 12 10 4 11 6 -4 0 6 7 11 [326] 13 6 10 5 0 0 7 8 6 11 0 8 0 0 8 17 9 -2 6 6 2 14 4 -1 2 [351] 10 9 -1 8 8 8 2 8 12 5 6 3 6 9 15 11 10 2 11 7 11 9 11 12 5 [376] 4 -2 11 7 13 6 -3 9 9 8 11 3 5 13 3 12 9 15 14 8 7 9 13 8 11 [401] 8 9 10 11 -3 7 3 15 7 4 10 10 0 4 15 4 15 6 2 6 14 13 6 11 0 [426] 9 8 3 8 7 7 -2 0 6 10 8 5 2 12 2 14 8 8 0 11 7 12 10 3 -1 [451] 10 3 9 11 10 11 16 8 6 10 12 13 10 10 6 8 7 10 1 10 16 7 13 0 14 [476] 1 11 10 8 0 7 12 12 6 7 12 9 11 14 9 11 12 0 12 7 5 0 8 10 7 [501] 8 1 7 0 3 11 4 16 6 16 0 6 6 3 1 8 7 5 0 5 11 5 7 11 10 [526] -2 18 12 14 3 8 6 4 7 8 11 8 8 7 2 11 10 8 8 10 6 9 0 14 8 [551] 5 8 6 0 1 9 6 > 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/1o4ig1336496918.tab") + } + } > m Conditional inference tree with 4 terminal nodes Response: endo Inputs: BC, NNZFG, MRT, AFL, LPM, LPC, W, WPA Number of observations: 557 1) WPA <= 1994.333; criterion = 1, statistic = 46.339 2) NNZFG <= 24; criterion = 0.996, statistic = 12.042 3)* weights = 14 2) NNZFG > 24 4)* weights = 98 1) WPA > 1994.333 5) W <= 6756; criterion = 1, statistic = 22.921 6)* weights = 365 5) W > 6756 7)* weights = 80 > postscript(file="/var/wessaorg/rcomp/tmp/2gy8b1336496918.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/37p2k1336496918.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 12 6.9232877 5.07671233 2 8 6.9232877 1.07671233 3 1 6.9232877 -5.92328767 4 2 6.9232877 -4.92328767 5 5 6.9232877 -1.92328767 6 12 6.9232877 5.07671233 7 11 6.9232877 4.07671233 8 9 6.9232877 2.07671233 9 2 6.9232877 -4.92328767 10 4 5.3571429 -1.35714286 11 5 6.9232877 -1.92328767 12 4 6.9232877 -2.92328767 13 5 5.3571429 -0.35714286 14 4 6.9232877 -2.92328767 15 -1 6.9232877 -7.92328767 16 6 5.3571429 0.64285714 17 6 6.9232877 -0.92328767 18 2 6.9232877 -4.92328767 19 11 6.9232877 4.07671233 20 5 9.3125000 -4.31250000 21 7 6.9232877 0.07671233 22 6 6.9232877 -0.92328767 23 7 9.3125000 -2.31250000 24 10 5.3571429 4.64285714 25 11 6.9232877 4.07671233 26 9 6.9232877 2.07671233 27 3 6.9232877 -3.92328767 28 5 6.9232877 -1.92328767 29 4 6.9232877 -2.92328767 30 5 6.9232877 -1.92328767 31 7 6.9232877 0.07671233 32 5 6.9232877 -1.92328767 33 1 6.9232877 -5.92328767 34 4 6.9232877 -2.92328767 35 4 5.3571429 -1.35714286 36 5 6.9232877 -1.92328767 37 7 6.9232877 0.07671233 38 8 6.9232877 1.07671233 39 2 6.9232877 -4.92328767 40 0 6.9232877 -6.92328767 41 9 9.3125000 -0.31250000 42 8 6.9232877 1.07671233 43 3 6.9232877 -3.92328767 44 5 5.3571429 -0.35714286 45 3 6.9232877 -3.92328767 46 6 5.3571429 0.64285714 47 7 6.9232877 0.07671233 48 7 6.9232877 0.07671233 49 3 6.9232877 -3.92328767 50 7 6.9232877 0.07671233 51 8 6.9232877 1.07671233 52 8 6.9232877 1.07671233 53 6 6.9232877 -0.92328767 54 9 6.9232877 2.07671233 55 5 6.9232877 -1.92328767 56 6 6.9232877 -0.92328767 57 7 6.9232877 0.07671233 58 5 6.9232877 -1.92328767 59 8 6.9232877 1.07671233 60 4 6.9232877 -2.92328767 61 14 6.9232877 7.07671233 62 4 6.9232877 -2.92328767 63 3 6.9232877 -3.92328767 64 11 6.9232877 4.07671233 65 8 6.9232877 1.07671233 66 8 5.3571429 2.64285714 67 9 5.3571429 3.64285714 68 12 6.9232877 5.07671233 69 2 6.9232877 -4.92328767 70 4 6.9232877 -2.92328767 71 2 5.3571429 -3.35714286 72 3 5.3571429 -2.35714286 73 11 6.9232877 4.07671233 74 11 6.9232877 4.07671233 75 9 6.9232877 2.07671233 76 4 6.9232877 -2.92328767 77 1 6.9232877 -5.92328767 78 5 5.3571429 -0.35714286 79 2 6.9232877 -4.92328767 80 5 6.9232877 -1.92328767 81 -1 6.9232877 -7.92328767 82 7 6.9232877 0.07671233 83 4 6.9232877 -2.92328767 84 3 5.3571429 -2.35714286 85 7 6.9232877 0.07671233 86 7 6.9232877 0.07671233 87 5 6.9232877 -1.92328767 88 8 6.9232877 1.07671233 89 7 6.9232877 0.07671233 90 5 6.9232877 -1.92328767 91 10 6.9232877 3.07671233 92 7 6.9232877 0.07671233 93 5 5.3571429 -0.35714286 94 9 6.9232877 2.07671233 95 4 5.3571429 -1.35714286 96 2 5.3571429 -3.35714286 97 5 6.9232877 -1.92328767 98 12 6.9232877 5.07671233 99 4 6.9232877 -2.92328767 100 6 6.9232877 -0.92328767 101 5 6.9232877 -1.92328767 102 7 5.3571429 1.64285714 103 8 6.9232877 1.07671233 104 11 6.9232877 4.07671233 105 3 5.3571429 -2.35714286 106 1 6.9232877 -5.92328767 107 13 6.9232877 6.07671233 108 7 5.3571429 1.64285714 109 2 5.3571429 -3.35714286 110 5 5.3571429 -0.35714286 111 3 5.3571429 -2.35714286 112 -1 6.9232877 -7.92328767 113 0 6.9232877 -6.92328767 114 6 6.9232877 -0.92328767 115 10 6.9232877 3.07671233 116 -2 5.3571429 -7.35714286 117 8 6.9232877 1.07671233 118 11 6.9232877 4.07671233 119 11 5.3571429 5.64285714 120 9 5.3571429 3.64285714 121 10 6.9232877 3.07671233 122 2 6.9232877 -4.92328767 123 8 6.9232877 1.07671233 124 12 6.9232877 5.07671233 125 10 9.3125000 0.68750000 126 2 6.9232877 -4.92328767 127 0 6.9232877 -6.92328767 128 9 6.9232877 2.07671233 129 -2 6.9232877 -8.92328767 130 6 6.9232877 -0.92328767 131 6 6.9232877 -0.92328767 132 6 9.3125000 -3.31250000 133 12 6.9232877 5.07671233 134 9 9.3125000 -0.31250000 135 7 6.9232877 0.07671233 136 4 6.9232877 -2.92328767 137 6 6.9232877 -0.92328767 138 6 6.9232877 -0.92328767 139 3 6.9232877 -3.92328767 140 4 6.9232877 -2.92328767 141 8 6.9232877 1.07671233 142 10 6.9232877 3.07671233 143 6 6.9232877 -0.92328767 144 6 6.9232877 -0.92328767 145 4 6.9232877 -2.92328767 146 6 5.3571429 0.64285714 147 5 5.3571429 -0.35714286 148 9 5.3571429 3.64285714 149 2 9.3125000 -7.31250000 150 7 6.9232877 0.07671233 151 2 6.9232877 -4.92328767 152 -1 6.9232877 -7.92328767 153 3 6.9232877 -3.92328767 154 6 5.3571429 0.64285714 155 10 5.3571429 4.64285714 156 10 5.3571429 4.64285714 157 2 6.9232877 -4.92328767 158 10 6.9232877 3.07671233 159 4 9.3125000 -5.31250000 160 7 6.9232877 0.07671233 161 8 5.3571429 2.64285714 162 9 6.9232877 2.07671233 163 5 6.9232877 -1.92328767 164 10 6.9232877 3.07671233 165 5 5.3571429 -0.35714286 166 8 6.9232877 1.07671233 167 8 6.9232877 1.07671233 168 4 6.9232877 -2.92328767 169 6 5.3571429 0.64285714 170 0 5.3571429 -5.35714286 171 0 5.3571429 -5.35714286 172 9 5.3571429 3.64285714 173 8 5.3571429 2.64285714 174 9 6.9232877 2.07671233 175 4 5.3571429 -1.35714286 176 9 6.9232877 2.07671233 177 10 6.9232877 3.07671233 178 2 6.9232877 -4.92328767 179 8 6.9232877 1.07671233 180 -2 5.3571429 -7.35714286 181 3 5.3571429 -2.35714286 182 -1 6.9232877 -7.92328767 183 12 6.9232877 5.07671233 184 9 6.9232877 2.07671233 185 5 6.9232877 -1.92328767 186 6 5.3571429 0.64285714 187 4 5.3571429 -1.35714286 188 13 9.3125000 3.68750000 189 11 6.9232877 4.07671233 190 3 6.9232877 -3.92328767 191 5 5.3571429 -0.35714286 192 9 6.9232877 2.07671233 193 7 6.9232877 0.07671233 194 11 6.9232877 4.07671233 195 7 6.9232877 0.07671233 196 1 6.9232877 -5.92328767 197 13 6.9232877 6.07671233 198 3 5.3571429 -2.35714286 199 6 6.9232877 -0.92328767 200 7 9.3125000 -2.31250000 201 5 6.9232877 -1.92328767 202 3 6.9232877 -3.92328767 203 2 5.3571429 -3.35714286 204 3 6.9232877 -3.92328767 205 12 6.9232877 5.07671233 206 14 5.3571429 8.64285714 207 10 6.9232877 3.07671233 208 11 6.9232877 4.07671233 209 4 5.3571429 -1.35714286 210 4 6.9232877 -2.92328767 211 10 5.3571429 4.64285714 212 10 6.9232877 3.07671233 213 12 6.9232877 5.07671233 214 6 6.9232877 -0.92328767 215 7 5.3571429 1.64285714 216 9 5.3571429 3.64285714 217 2 5.3571429 -3.35714286 218 8 6.9232877 1.07671233 219 2 9.3125000 -7.31250000 220 5 5.3571429 -0.35714286 221 10 6.9232877 3.07671233 222 4 6.9232877 -2.92328767 223 6 6.9232877 -0.92328767 224 0 6.9232877 -6.92328767 225 6 6.9232877 -0.92328767 226 4 5.3571429 -1.35714286 227 12 6.9232877 5.07671233 228 11 6.9232877 4.07671233 229 10 6.9232877 3.07671233 230 10 6.9232877 3.07671233 231 4 9.3125000 -5.31250000 232 1 6.9232877 -5.92328767 233 10 6.9232877 3.07671233 234 8 5.3571429 2.64285714 235 3 6.9232877 -3.92328767 236 6 6.9232877 -0.92328767 237 11 5.3571429 5.64285714 238 8 5.3571429 2.64285714 239 6 6.9232877 -0.92328767 240 4 6.9232877 -2.92328767 241 2 6.9232877 -4.92328767 242 6 6.9232877 -0.92328767 243 5 6.9232877 -1.92328767 244 5 5.3571429 -0.35714286 245 8 6.9232877 1.07671233 246 5 5.3571429 -0.35714286 247 9 6.9232877 2.07671233 248 7 6.9232877 0.07671233 249 6 5.3571429 0.64285714 250 8 6.9232877 1.07671233 251 8 5.3571429 2.64285714 252 10 6.9232877 3.07671233 253 3 6.9232877 -3.92328767 254 8 6.9232877 1.07671233 255 9 5.3571429 3.64285714 256 11 6.9232877 4.07671233 257 0 6.9232877 -6.92328767 258 4 6.9232877 -2.92328767 259 11 6.9232877 4.07671233 260 5 6.9232877 -1.92328767 261 4 6.9232877 -2.92328767 262 9 6.9232877 2.07671233 263 9 6.9232877 2.07671233 264 8 6.9232877 1.07671233 265 4 5.3571429 -1.35714286 266 1 6.9232877 -5.92328767 267 5 5.3571429 -0.35714286 268 3 6.9232877 -3.92328767 269 3 5.3571429 -2.35714286 270 5 5.3571429 -0.35714286 271 8 6.9232877 1.07671233 272 0 5.3571429 -5.35714286 273 -1 5.3571429 -6.35714286 274 2 5.3571429 -3.35714286 275 8 6.9232877 1.07671233 276 8 5.3571429 2.64285714 277 6 5.3571429 0.64285714 278 4 6.9232877 -2.92328767 279 1 6.9232877 -5.92328767 280 9 5.3571429 3.64285714 281 10 9.3125000 0.68750000 282 7 5.3571429 1.64285714 283 4 5.3571429 -1.35714286 284 11 6.9232877 4.07671233 285 4 6.9232877 -2.92328767 286 11 9.3125000 1.68750000 287 15 9.3125000 5.68750000 288 13 6.9232877 6.07671233 289 7 9.3125000 -2.31250000 290 14 9.3125000 4.68750000 291 10 6.9232877 3.07671233 292 16 6.9232877 9.07671233 293 14 6.9232877 7.07671233 294 14 9.3125000 4.68750000 295 11 6.9232877 4.07671233 296 14 5.3571429 8.64285714 297 0 9.3125000 -9.31250000 298 14 9.3125000 4.68750000 299 3 6.9232877 -3.92328767 300 14 9.3125000 4.68750000 301 4 6.9232877 -2.92328767 302 8 6.9232877 1.07671233 303 8 6.9232877 1.07671233 304 7 6.9232877 0.07671233 305 6 6.9232877 -0.92328767 306 10 6.9232877 3.07671233 307 11 9.3125000 1.68750000 308 3 5.3571429 -2.35714286 309 13 9.3125000 3.68750000 310 10 5.3571429 4.64285714 311 10 6.9232877 3.07671233 312 15 9.3125000 5.68750000 313 4 9.3125000 -5.31250000 314 10 6.9232877 3.07671233 315 13 6.9232877 6.07671233 316 12 9.3125000 2.68750000 317 10 9.3125000 0.68750000 318 4 9.3125000 -5.31250000 319 11 9.3125000 1.68750000 320 6 6.9232877 -0.92328767 321 -4 0.4285714 -4.42857143 322 0 6.9232877 -6.92328767 323 6 6.9232877 -0.92328767 324 7 6.9232877 0.07671233 325 11 6.9232877 4.07671233 326 13 9.3125000 3.68750000 327 6 6.9232877 -0.92328767 328 10 9.3125000 0.68750000 329 5 5.3571429 -0.35714286 330 0 6.9232877 -6.92328767 331 0 6.9232877 -6.92328767 332 7 9.3125000 -2.31250000 333 8 6.9232877 1.07671233 334 6 9.3125000 -3.31250000 335 11 6.9232877 4.07671233 336 0 0.4285714 -0.42857143 337 8 6.9232877 1.07671233 338 0 6.9232877 -6.92328767 339 0 0.4285714 -0.42857143 340 8 9.3125000 -1.31250000 341 17 6.9232877 10.07671233 342 9 9.3125000 -0.31250000 343 -2 0.4285714 -2.42857143 344 6 9.3125000 -3.31250000 345 6 9.3125000 -3.31250000 346 2 9.3125000 -7.31250000 347 14 9.3125000 4.68750000 348 4 6.9232877 -2.92328767 349 -1 6.9232877 -7.92328767 350 2 6.9232877 -4.92328767 351 10 9.3125000 0.68750000 352 9 6.9232877 2.07671233 353 -1 5.3571429 -6.35714286 354 8 9.3125000 -1.31250000 355 8 6.9232877 1.07671233 356 8 6.9232877 1.07671233 357 2 6.9232877 -4.92328767 358 8 6.9232877 1.07671233 359 12 9.3125000 2.68750000 360 5 9.3125000 -4.31250000 361 6 9.3125000 -3.31250000 362 3 6.9232877 -3.92328767 363 6 6.9232877 -0.92328767 364 9 5.3571429 3.64285714 365 15 6.9232877 8.07671233 366 11 5.3571429 5.64285714 367 10 6.9232877 3.07671233 368 2 6.9232877 -4.92328767 369 11 9.3125000 1.68750000 370 7 6.9232877 0.07671233 371 11 6.9232877 4.07671233 372 9 6.9232877 2.07671233 373 11 6.9232877 4.07671233 374 12 9.3125000 2.68750000 375 5 6.9232877 -1.92328767 376 4 5.3571429 -1.35714286 377 -2 6.9232877 -8.92328767 378 11 9.3125000 1.68750000 379 7 6.9232877 0.07671233 380 13 9.3125000 3.68750000 381 6 9.3125000 -3.31250000 382 -3 6.9232877 -9.92328767 383 9 6.9232877 2.07671233 384 9 6.9232877 2.07671233 385 8 6.9232877 1.07671233 386 11 9.3125000 1.68750000 387 3 9.3125000 -6.31250000 388 5 5.3571429 -0.35714286 389 13 6.9232877 6.07671233 390 3 5.3571429 -2.35714286 391 12 6.9232877 5.07671233 392 9 9.3125000 -0.31250000 393 15 6.9232877 8.07671233 394 14 9.3125000 4.68750000 395 8 9.3125000 -1.31250000 396 7 9.3125000 -2.31250000 397 9 6.9232877 2.07671233 398 13 9.3125000 3.68750000 399 8 6.9232877 1.07671233 400 11 6.9232877 4.07671233 401 8 6.9232877 1.07671233 402 9 6.9232877 2.07671233 403 10 6.9232877 3.07671233 404 11 6.9232877 4.07671233 405 -3 5.3571429 -8.35714286 406 7 9.3125000 -2.31250000 407 3 6.9232877 -3.92328767 408 15 9.3125000 5.68750000 409 7 6.9232877 0.07671233 410 4 6.9232877 -2.92328767 411 10 6.9232877 3.07671233 412 10 6.9232877 3.07671233 413 0 0.4285714 -0.42857143 414 4 6.9232877 -2.92328767 415 15 9.3125000 5.68750000 416 4 5.3571429 -1.35714286 417 15 6.9232877 8.07671233 418 6 6.9232877 -0.92328767 419 2 6.9232877 -4.92328767 420 6 9.3125000 -3.31250000 421 14 6.9232877 7.07671233 422 13 6.9232877 6.07671233 423 6 6.9232877 -0.92328767 424 11 9.3125000 1.68750000 425 0 5.3571429 -5.35714286 426 9 6.9232877 2.07671233 427 8 6.9232877 1.07671233 428 3 5.3571429 -2.35714286 429 8 5.3571429 2.64285714 430 7 6.9232877 0.07671233 431 7 6.9232877 0.07671233 432 -2 6.9232877 -8.92328767 433 0 0.4285714 -0.42857143 434 6 9.3125000 -3.31250000 435 10 9.3125000 0.68750000 436 8 6.9232877 1.07671233 437 5 6.9232877 -1.92328767 438 2 6.9232877 -4.92328767 439 12 6.9232877 5.07671233 440 2 6.9232877 -4.92328767 441 14 6.9232877 7.07671233 442 8 9.3125000 -1.31250000 443 8 6.9232877 1.07671233 444 0 6.9232877 -6.92328767 445 11 6.9232877 4.07671233 446 7 6.9232877 0.07671233 447 12 9.3125000 2.68750000 448 10 5.3571429 4.64285714 449 3 6.9232877 -3.92328767 450 -1 6.9232877 -7.92328767 451 10 6.9232877 3.07671233 452 3 5.3571429 -2.35714286 453 9 9.3125000 -0.31250000 454 11 9.3125000 1.68750000 455 10 6.9232877 3.07671233 456 11 6.9232877 4.07671233 457 16 6.9232877 9.07671233 458 8 6.9232877 1.07671233 459 6 6.9232877 -0.92328767 460 10 6.9232877 3.07671233 461 12 6.9232877 5.07671233 462 13 9.3125000 3.68750000 463 10 5.3571429 4.64285714 464 10 6.9232877 3.07671233 465 6 6.9232877 -0.92328767 466 8 6.9232877 1.07671233 467 7 6.9232877 0.07671233 468 10 6.9232877 3.07671233 469 1 6.9232877 -5.92328767 470 10 6.9232877 3.07671233 471 16 6.9232877 9.07671233 472 7 6.9232877 0.07671233 473 13 9.3125000 3.68750000 474 0 6.9232877 -6.92328767 475 14 6.9232877 7.07671233 476 1 0.4285714 0.57142857 477 11 5.3571429 5.64285714 478 10 6.9232877 3.07671233 479 8 6.9232877 1.07671233 480 0 5.3571429 -5.35714286 481 7 6.9232877 0.07671233 482 12 6.9232877 5.07671233 483 12 9.3125000 2.68750000 484 6 6.9232877 -0.92328767 485 7 6.9232877 0.07671233 486 12 6.9232877 5.07671233 487 9 6.9232877 2.07671233 488 11 6.9232877 4.07671233 489 14 6.9232877 7.07671233 490 9 9.3125000 -0.31250000 491 11 6.9232877 4.07671233 492 12 9.3125000 2.68750000 493 0 6.9232877 -6.92328767 494 12 6.9232877 5.07671233 495 7 6.9232877 0.07671233 496 5 6.9232877 -1.92328767 497 0 6.9232877 -6.92328767 498 8 5.3571429 2.64285714 499 10 6.9232877 3.07671233 500 7 9.3125000 -2.31250000 501 8 6.9232877 1.07671233 502 1 0.4285714 0.57142857 503 7 6.9232877 0.07671233 504 0 0.4285714 -0.42857143 505 3 0.4285714 2.57142857 506 11 6.9232877 4.07671233 507 4 6.9232877 -2.92328767 508 16 6.9232877 9.07671233 509 6 6.9232877 -0.92328767 510 16 9.3125000 6.68750000 511 0 5.3571429 -5.35714286 512 6 6.9232877 -0.92328767 513 6 9.3125000 -3.31250000 514 3 6.9232877 -3.92328767 515 1 6.9232877 -5.92328767 516 8 5.3571429 2.64285714 517 7 9.3125000 -2.31250000 518 5 6.9232877 -1.92328767 519 0 5.3571429 -5.35714286 520 5 0.4285714 4.57142857 521 11 9.3125000 1.68750000 522 5 6.9232877 -1.92328767 523 7 6.9232877 0.07671233 524 11 6.9232877 4.07671233 525 10 6.9232877 3.07671233 526 -2 6.9232877 -8.92328767 527 18 6.9232877 11.07671233 528 12 6.9232877 5.07671233 529 14 9.3125000 4.68750000 530 3 6.9232877 -3.92328767 531 8 6.9232877 1.07671233 532 6 6.9232877 -0.92328767 533 4 6.9232877 -2.92328767 534 7 6.9232877 0.07671233 535 8 9.3125000 -1.31250000 536 11 6.9232877 4.07671233 537 8 6.9232877 1.07671233 538 8 6.9232877 1.07671233 539 7 6.9232877 0.07671233 540 2 0.4285714 1.57142857 541 11 6.9232877 4.07671233 542 10 9.3125000 0.68750000 543 8 6.9232877 1.07671233 544 8 6.9232877 1.07671233 545 10 6.9232877 3.07671233 546 6 6.9232877 -0.92328767 547 9 6.9232877 2.07671233 548 0 0.4285714 -0.42857143 549 14 6.9232877 7.07671233 550 8 6.9232877 1.07671233 551 5 6.9232877 -1.92328767 552 8 6.9232877 1.07671233 553 6 6.9232877 -0.92328767 554 0 0.4285714 -0.42857143 555 1 6.9232877 -5.92328767 556 9 6.9232877 2.07671233 557 6 6.9232877 -0.92328767 > 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/4nucn1336496918.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/59tzy1336496918.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/6lr8w1336496918.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/79vr71336496918.tab") + } > > try(system("convert tmp/2gy8b1336496918.ps tmp/2gy8b1336496918.png",intern=TRUE)) character(0) > try(system("convert tmp/37p2k1336496918.ps tmp/37p2k1336496918.png",intern=TRUE)) character(0) > try(system("convert tmp/4nucn1336496918.ps tmp/4nucn1336496918.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 9.398 0.306 9.705