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 = 'ATTLES connected' > par8 = 'ATTLES connected' > par7 = 'all' > par6 = 'bachelor' > par5 = 'female' > par4 = 'no' > par3 = '3' > par2 = 'none' > par1 = '0' > par9 <- 'ATTLES connected' > par8 <- 'ATTLES connected' > par7 <- 'all' > par6 <- 'bachelor' > par5 <- 'female' > 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] 37 32 24 21 36 30 38 39 32 35 36 27 34 34 37 38 30 24 30 36 36 30 26 36 34 [26] 37 37 35 35 38 36 28 41 33 32 34 35 29 36 32 29 40 34 38 34 32 37 34 28 31 [51] 32 35 35 37 34 35 21 21 33 41 30 31 27 34 38 22 33 32 30 35 31 33 27 28 33 [76] 38 31 35 40 31 42 38 38 40 30 36 34 39 44 40 37 39 38 34 36 34 33 33 35 37 [101] 31 36 39 37 32 32 31 35 30 32 34 49 38 35 35 35 34 34 41 38 37 38 36 27 36 [126] 38 39 42 38 37 37 38 41 38 43 35 37 32 37 30 35 38 32 36 36 37 35 40 34 39 [151] 36 35 36 26 35 36 34 35 32 38 37 36 40 45 42 39 32 38 41 36 35 39 42 33 36 [176] 36 38 35 40 38 38 37 37 38 33 33 36 35 31 33 36 41 38 37 33 30 43 41 38 40 [201] 35 35 37 35 35 42 37 41 41 34 32 40 35 32 46 39 41 34 36 38 38 32 41 29 21 [226] 34 36 > 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]) 21 22 24 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 49 4 1 2 2 4 3 3 10 8 17 12 20 28 25 21 27 9 9 11 5 2 1 1 1 1 > colnames(x) [1] "endo" "A1" "A2" "A3" "A4" "A5" "A6" "A7" "A8" "A9" [11] "A10" > colnames(x)[par1] [1] "endo" > x[,par1] [1] 37 32 24 21 36 30 38 39 32 35 36 27 34 34 37 38 30 24 30 36 36 30 26 36 34 [26] 37 37 35 35 38 36 28 41 33 32 34 35 29 36 32 29 40 34 38 34 32 37 34 28 31 [51] 32 35 35 37 34 35 21 21 33 41 30 31 27 34 38 22 33 32 30 35 31 33 27 28 33 [76] 38 31 35 40 31 42 38 38 40 30 36 34 39 44 40 37 39 38 34 36 34 33 33 35 37 [101] 31 36 39 37 32 32 31 35 30 32 34 49 38 35 35 35 34 34 41 38 37 38 36 27 36 [126] 38 39 42 38 37 37 38 41 38 43 35 37 32 37 30 35 38 32 36 36 37 35 40 34 39 [151] 36 35 36 26 35 36 34 35 32 38 37 36 40 45 42 39 32 38 41 36 35 39 42 33 36 [176] 36 38 35 40 38 38 37 37 38 33 33 36 35 31 33 36 41 38 37 33 30 43 41 38 40 [201] 35 35 37 35 35 42 37 41 41 34 32 40 35 32 46 39 41 34 36 38 38 32 41 29 21 [226] 34 36 > 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/10ot31335174467.tab") + } + } > m Conditional inference tree with 15 terminal nodes Response: endo Inputs: A1, A2, A3, A4, A5, A6, A7, A8, A9, A10 Number of observations: 227 1) A8 <= 2; criterion = 1, statistic = 86.807 2)* weights = 19 1) A8 > 2 3) A9 <= 2; criterion = 1, statistic = 52.877 4) A3 <= 3; criterion = 1, statistic = 32.045 5) A5 <= 3; criterion = 0.999, statistic = 14.921 6)* weights = 10 5) A5 > 3 7) A4 <= 3; criterion = 0.979, statistic = 9.424 8)* weights = 10 7) A4 > 3 9)* weights = 12 4) A3 > 3 10) A2 <= 2; criterion = 1, statistic = 21.297 11) A4 <= 3; criterion = 0.998, statistic = 14.033 12)* weights = 19 11) A4 > 3 13)* weights = 14 10) A2 > 2 14) A6 <= 3; criterion = 0.996, statistic = 12.466 15)* weights = 8 14) A6 > 3 16)* weights = 31 3) A9 > 2 17) A8 <= 4; criterion = 1, statistic = 31.572 18) A4 <= 3; criterion = 1, statistic = 26.504 19) A7 <= 3; criterion = 0.996, statistic = 12.481 20)* weights = 15 19) A7 > 3 21)* weights = 21 18) A4 > 3 22) A3 <= 3; criterion = 0.982, statistic = 9.742 23)* weights = 10 22) A3 > 3 24)* weights = 27 17) A8 > 4 25) A1 <= 3; criterion = 0.996, statistic = 12.355 26)* weights = 7 25) A1 > 3 27) A9 <= 3; criterion = 0.962, statistic = 8.336 28)* weights = 13 27) A9 > 3 29)* weights = 11 > postscript(file="/var/wessaorg/rcomp/tmp/2bif71335174467.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/3sjqw1335174467.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 37 38.00000 -1.0000000 2 32 32.26316 -0.2631579 3 24 29.00000 -5.0000000 4 21 28.05263 -7.0526316 5 36 38.00000 -2.0000000 6 30 28.05263 1.9473684 7 38 35.71429 2.2857143 8 39 37.38710 1.6129032 9 32 32.26316 -0.2631579 10 35 32.26316 2.7368421 11 36 37.38710 -1.3870968 12 27 30.90000 -3.9000000 13 34 35.28571 -1.2857143 14 34 28.05263 5.9473684 15 37 38.00000 -1.0000000 16 38 35.71429 2.2857143 17 30 28.05263 1.9473684 18 24 28.05263 -4.0526316 19 30 32.26316 -2.2631579 20 36 32.26316 3.7368421 21 36 37.38710 -1.3870968 22 30 30.90000 -0.9000000 23 26 29.00000 -3.0000000 24 36 35.28571 0.7142857 25 34 33.33333 0.6666667 26 37 35.71429 1.2857143 27 37 35.71429 1.2857143 28 35 37.38710 -2.3870968 29 35 37.38710 -2.3870968 30 38 37.38710 0.6129032 31 36 35.28571 0.7142857 32 28 30.90000 -2.9000000 33 41 42.27273 -1.2727273 34 33 33.33333 -0.3333333 35 32 33.33333 -1.3333333 36 34 35.71429 -1.7142857 37 35 33.33333 1.6666667 38 29 30.90000 -1.9000000 39 36 37.38710 -1.3870968 40 32 32.26316 -0.2631579 41 29 32.26316 -3.2631579 42 40 37.38710 2.6129032 43 34 32.26316 1.7368421 44 38 37.38710 0.6129032 45 34 34.25000 -0.2500000 46 32 33.33333 -1.3333333 47 37 35.28571 1.7142857 48 34 30.90000 3.1000000 49 28 29.00000 -1.0000000 50 31 32.26316 -1.2631579 51 32 32.26316 -0.2631579 52 35 35.71429 -0.7142857 53 35 34.58333 0.4166667 54 37 37.38710 -0.3870968 55 34 30.90000 3.1000000 56 35 35.28571 -0.2857143 57 21 28.05263 -7.0526316 58 21 28.05263 -7.0526316 59 33 32.26316 0.7368421 60 41 42.27273 -1.2727273 61 30 33.33333 -3.3333333 62 31 30.90000 0.1000000 63 27 32.26316 -5.2631579 64 34 33.33333 0.6666667 65 38 34.25000 3.7500000 66 22 28.05263 -6.0526316 67 33 32.26316 0.7368421 68 32 32.26316 -0.2631579 69 30 32.26316 -2.2631579 70 35 34.58333 0.4166667 71 31 29.00000 2.0000000 72 33 35.28571 -2.2857143 73 27 29.00000 -2.0000000 74 28 29.00000 -1.0000000 75 33 35.28571 -2.2857143 76 38 35.71429 2.2857143 77 31 33.33333 -2.3333333 78 35 37.38710 -2.3870968 79 40 37.38710 2.6129032 80 31 32.26316 -1.2631579 81 42 42.27273 -0.2727273 82 38 35.28571 2.7142857 83 38 37.38710 0.6129032 84 40 40.38462 -0.3846154 85 30 29.00000 1.0000000 86 36 35.28571 0.7142857 87 34 37.38710 -3.3870968 88 39 40.38462 -1.3846154 89 44 42.27273 1.7272727 90 40 38.00000 2.0000000 91 37 38.00000 -1.0000000 92 39 38.00000 1.0000000 93 38 35.28571 2.7142857 94 34 32.26316 1.7368421 95 36 37.38710 -1.3870968 96 34 35.71429 -1.7142857 97 33 28.05263 4.9473684 98 33 35.28571 -2.2857143 99 35 37.38710 -2.3870968 100 37 34.58333 2.4166667 101 31 29.00000 2.0000000 102 36 36.00000 0.0000000 103 39 37.38710 1.6129032 104 37 37.38710 -0.3870968 105 32 30.90000 1.1000000 106 32 35.28571 -3.2857143 107 31 28.05263 2.9473684 108 35 37.38710 -2.3870968 109 30 28.05263 1.9473684 110 32 34.25000 -2.2500000 111 34 36.00000 -2.0000000 112 49 42.27273 6.7272727 113 38 37.38710 0.6129032 114 35 32.26316 2.7368421 115 35 32.26316 2.7368421 116 35 30.90000 4.1000000 117 34 34.25000 -0.2500000 118 34 35.71429 -1.7142857 119 41 38.00000 3.0000000 120 38 37.38710 0.6129032 121 37 37.38710 -0.3870968 122 38 35.71429 2.2857143 123 36 37.85714 -1.8571429 124 27 28.05263 -1.0526316 125 36 35.71429 0.2857143 126 38 38.00000 0.0000000 127 39 37.38710 1.6129032 128 42 42.27273 -0.2727273 129 38 37.85714 0.1428571 130 37 38.00000 -1.0000000 131 37 38.00000 -1.0000000 132 38 38.00000 0.0000000 133 41 40.38462 0.6153846 134 38 37.38710 0.6129032 135 43 37.38710 5.6129032 136 35 35.71429 -0.7142857 137 37 36.00000 1.0000000 138 32 28.05263 3.9473684 139 37 38.00000 -1.0000000 140 30 28.05263 1.9473684 141 35 35.71429 -0.7142857 142 38 37.38710 0.6129032 143 32 28.05263 3.9473684 144 36 38.00000 -2.0000000 145 36 33.33333 2.6666667 146 37 38.00000 -1.0000000 147 35 35.28571 -0.2857143 148 40 38.00000 2.0000000 149 34 38.00000 -4.0000000 150 39 38.00000 1.0000000 151 36 36.00000 0.0000000 152 35 35.71429 -0.7142857 153 36 34.25000 1.7500000 154 26 28.05263 -2.0526316 155 35 37.85714 -2.8571429 156 36 37.38710 -1.3870968 157 34 33.33333 0.6666667 158 35 34.58333 0.4166667 159 32 36.00000 -4.0000000 160 38 38.00000 0.0000000 161 37 34.58333 2.4166667 162 36 35.71429 0.2857143 163 40 37.85714 2.1428571 164 45 42.27273 2.7272727 165 42 40.38462 1.6153846 166 39 40.38462 -1.3846154 167 32 34.25000 -2.2500000 168 38 37.38710 0.6129032 169 41 40.38462 0.6153846 170 36 34.58333 1.4166667 171 35 38.00000 -3.0000000 172 39 42.27273 -3.2727273 173 42 42.27273 -0.2727273 174 33 34.25000 -1.2500000 175 36 35.71429 0.2857143 176 36 33.33333 2.6666667 177 38 37.38710 0.6129032 178 35 33.33333 1.6666667 179 40 40.38462 -0.3846154 180 38 38.00000 0.0000000 181 38 35.28571 2.7142857 182 37 38.00000 -1.0000000 183 37 37.85714 -0.8571429 184 38 40.38462 -2.3846154 185 33 34.58333 -1.5833333 186 33 33.33333 -0.3333333 187 36 36.00000 0.0000000 188 35 37.38710 -2.3870968 189 31 29.00000 2.0000000 190 33 35.71429 -2.7142857 191 36 38.00000 -2.0000000 192 41 40.38462 0.6153846 193 38 37.85714 0.1428571 194 37 38.00000 -1.0000000 195 33 35.71429 -2.7142857 196 30 33.33333 -3.3333333 197 43 40.38462 2.6153846 198 41 42.27273 -1.2727273 199 38 36.00000 2.0000000 200 40 40.38462 -0.3846154 201 35 36.00000 -1.0000000 202 35 35.71429 -0.7142857 203 37 35.71429 1.2857143 204 35 34.25000 0.7500000 205 35 34.58333 0.4166667 206 42 37.38710 4.6129032 207 37 38.00000 -1.0000000 208 41 38.00000 3.0000000 209 41 37.85714 3.1428571 210 34 34.58333 -0.5833333 211 32 34.58333 -2.5833333 212 40 40.38462 -0.3846154 213 35 33.33333 1.6666667 214 32 28.05263 3.9473684 215 46 38.00000 8.0000000 216 39 42.27273 -3.2727273 217 41 38.00000 3.0000000 218 34 29.00000 5.0000000 219 36 35.71429 0.2857143 220 38 36.00000 2.0000000 221 38 36.00000 2.0000000 222 32 34.58333 -2.5833333 223 41 40.38462 0.6153846 224 29 30.90000 -1.9000000 225 21 28.05263 -7.0526316 226 34 34.58333 -0.5833333 227 36 28.05263 7.9473684 > 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/49qcs1335174467.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/55cxh1335174467.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/6jgsm1335174467.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/732ii1335174467.tab") + } > > try(system("convert tmp/2bif71335174467.ps tmp/2bif71335174467.png",intern=TRUE)) character(0) > try(system("convert tmp/3sjqw1335174467.ps tmp/3sjqw1335174467.png",intern=TRUE)) character(0) > try(system("convert tmp/49qcs1335174467.ps tmp/49qcs1335174467.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.568 0.275 4.841