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 = 'male' > par4 = 'no' > par3 = '3' > par2 = 'none' > par1 = '0' > par9 <- 'ATTLES connected' > par8 <- 'ATTLES connected' > par7 <- 'all' > par6 <- 'bachelor' > par5 <- 'male' > 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] 28 36 36 30 36 33 16 31 39 32 30 34 34 26 21 35 35 34 19 36 32 33 37 22 33 [26] 31 33 31 26 27 38 34 32 38 33 34 37 33 34 35 32 32 33 35 38 36 24 34 41 34 [51] 39 32 29 33 30 39 39 32 35 36 34 29 34 31 38 36 33 37 41 39 29 37 39 42 42 [76] 37 35 33 39 29 30 35 33 34 35 37 42 39 40 42 41 30 34 36 35 42 39 38 37 43 [101] 44 38 38 33 37 42 30 42 31 40 30 32 39 34 37 37 38 37 36 35 40 37 30 33 28 [126] 31 33 40 36 36 33 40 30 35 32 25 38 37 33 30 38 38 34 36 28 40 36 29 40 36 [151] 41 40 36 22 35 40 38 35 33 39 49 36 41 35 35 42 37 36 39 32 37 35 39 39 25 [176] 35 38 42 34 26 34 26 33 39 32 42 34 38 41 36 36 34 34 30 35 32 42 38 30 33 [201] 40 33 38 26 42 34 36 36 29 44 33 34 33 38 41 32 31 30 37 30 18 31 48 33 37 > 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]) 16 18 19 21 22 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 1 1 1 1 2 1 2 5 1 3 6 14 8 13 23 21 18 21 17 17 15 10 7 12 1 2 48 49 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] 28 36 36 30 36 33 16 31 39 32 30 34 34 26 21 35 35 34 19 36 32 33 37 22 33 [26] 31 33 31 26 27 38 34 32 38 33 34 37 33 34 35 32 32 33 35 38 36 24 34 41 34 [51] 39 32 29 33 30 39 39 32 35 36 34 29 34 31 38 36 33 37 41 39 29 37 39 42 42 [76] 37 35 33 39 29 30 35 33 34 35 37 42 39 40 42 41 30 34 36 35 42 39 38 37 43 [101] 44 38 38 33 37 42 30 42 31 40 30 32 39 34 37 37 38 37 36 35 40 37 30 33 28 [126] 31 33 40 36 36 33 40 30 35 32 25 38 37 33 30 38 38 34 36 28 40 36 29 40 36 [151] 41 40 36 22 35 40 38 35 33 39 49 36 41 35 35 42 37 36 39 32 37 35 39 39 25 [176] 35 38 42 34 26 34 26 33 39 32 42 34 38 41 36 36 34 34 30 35 32 42 38 30 33 [201] 40 33 38 26 42 34 36 36 29 44 33 34 33 38 41 32 31 30 37 30 18 31 48 33 37 > 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/1xvpy1335900212.tab") + } + } > m Conditional inference tree with 14 terminal nodes Response: endo Inputs: A1, A2, A3, A4, A5, A6, A7, A8, A9, A10 Number of observations: 225 1) A6 <= 2; criterion = 1, statistic = 94.3 2) A10 <= 2; criterion = 0.998, statistic = 13.897 3)* weights = 13 2) A10 > 2 4)* weights = 13 1) A6 > 2 5) A8 <= 4; criterion = 1, statistic = 58.159 6) A6 <= 3; criterion = 1, statistic = 37.245 7) A3 <= 3; criterion = 0.995, statistic = 12.214 8)* weights = 16 7) A3 > 3 9)* weights = 23 6) A6 > 3 10) A7 <= 3; criterion = 1, statistic = 29.387 11) A10 <= 4; criterion = 0.983, statistic = 9.838 12)* weights = 30 11) A10 > 4 13)* weights = 7 10) A7 > 3 14) A1 <= 3; criterion = 1, statistic = 17.68 15) A4 <= 3; criterion = 0.953, statistic = 7.961 16)* weights = 13 15) A4 > 3 17)* weights = 12 14) A1 > 3 18) A9 <= 2; criterion = 0.997, statistic = 13.053 19)* weights = 20 18) A9 > 2 20) A4 <= 3; criterion = 0.997, statistic = 13.048 21)* weights = 18 20) A4 > 3 22)* weights = 13 5) A8 > 4 23) A9 <= 2; criterion = 1, statistic = 17.739 24)* weights = 17 23) A9 > 2 25) A1 <= 4; criterion = 0.998, statistic = 13.751 26)* weights = 20 25) A1 > 4 27)* weights = 10 > postscript(file="/var/wessaorg/rcomp/tmp/27o301335900212.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/39h2e1335900212.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 28 32.60000 -4.60000000 2 36 32.60000 3.40000000 3 36 35.91667 0.08333333 4 30 32.60000 -2.60000000 5 36 36.64706 -0.64705882 6 33 33.52174 -0.52173913 7 16 23.92308 -7.92307692 8 31 30.56250 0.43750000 9 39 39.15000 -0.15000000 10 32 34.38462 -2.38461538 11 30 30.56250 -0.56250000 12 34 36.00000 -2.00000000 13 34 36.00000 -2.00000000 14 26 30.53846 -4.53846154 15 21 23.92308 -2.92307692 16 35 36.00000 -1.00000000 17 35 36.64706 -1.64705882 18 34 36.64706 -2.64705882 19 19 23.92308 -4.92307692 20 36 36.64706 -0.64705882 21 32 30.56250 1.43750000 22 33 32.60000 0.40000000 23 37 37.16667 -0.16666667 24 22 30.53846 -8.53846154 25 33 33.52174 -0.52173913 26 31 32.60000 -1.60000000 27 33 32.60000 0.40000000 28 31 32.60000 -1.60000000 29 26 23.92308 2.07692308 30 27 30.56250 -3.56250000 31 38 37.16667 0.83333333 32 34 36.00000 -2.00000000 33 32 36.00000 -4.00000000 34 38 39.15000 -1.15000000 35 33 34.38462 -1.38461538 36 34 33.52174 0.47826087 37 37 36.85714 0.14285714 38 33 33.52174 -0.52173913 39 34 32.60000 1.40000000 40 35 37.16667 -2.16666667 41 32 33.52174 -1.52173913 42 32 30.53846 1.46153846 43 33 32.60000 0.40000000 44 35 36.00000 -1.00000000 45 38 37.16667 0.83333333 46 36 34.38462 1.61538462 47 24 23.92308 0.07692308 48 34 36.64706 -2.64705882 49 41 39.15000 1.85000000 50 34 36.00000 -2.00000000 51 39 35.91667 3.08333333 52 32 30.53846 1.46153846 53 29 30.56250 -1.56250000 54 33 36.00000 -3.00000000 55 30 33.52174 -3.52173913 56 39 37.16667 1.83333333 57 39 40.00000 -1.00000000 58 32 34.38462 -2.38461538 59 35 37.16667 -2.16666667 60 36 37.16667 -1.16666667 61 34 39.15000 -5.15000000 62 29 32.60000 -3.60000000 63 34 33.52174 0.47826087 64 31 34.38462 -3.38461538 65 38 36.00000 2.00000000 66 36 37.16667 -1.16666667 67 33 33.52174 -0.52173913 68 37 36.85714 0.14285714 69 41 40.00000 1.00000000 70 39 33.52174 5.47826087 71 29 23.92308 5.07692308 72 37 30.53846 6.46153846 73 39 36.64706 2.35294118 74 42 40.00000 2.00000000 75 42 43.20000 -1.20000000 76 37 36.00000 1.00000000 77 35 35.91667 -0.91666667 78 33 32.60000 0.40000000 79 39 36.00000 3.00000000 80 29 32.60000 -3.60000000 81 30 32.60000 -2.60000000 82 35 36.00000 -1.00000000 83 33 30.53846 2.46153846 84 34 30.56250 3.43750000 85 35 36.64706 -1.64705882 86 37 36.00000 1.00000000 87 42 43.20000 -1.20000000 88 39 37.16667 1.83333333 89 40 32.60000 7.40000000 90 42 40.00000 2.00000000 91 41 43.20000 -2.20000000 92 30 33.52174 -3.52173913 93 34 34.38462 -0.38461538 94 36 36.85714 -0.85714286 95 35 32.60000 2.40000000 96 42 39.15000 2.85000000 97 39 39.15000 -0.15000000 98 38 32.60000 5.40000000 99 37 36.64706 0.35294118 100 43 43.20000 -0.20000000 101 44 37.16667 6.83333333 102 38 36.00000 2.00000000 103 38 36.85714 1.14285714 104 33 30.56250 2.43750000 105 37 37.16667 -0.16666667 106 42 39.15000 2.85000000 107 30 30.56250 -0.56250000 108 42 33.52174 8.47826087 109 31 32.60000 -1.60000000 110 40 39.15000 0.85000000 111 30 30.56250 -0.56250000 112 32 33.52174 -1.52173913 113 39 36.00000 3.00000000 114 34 32.60000 1.40000000 115 37 36.00000 1.00000000 116 37 36.00000 1.00000000 117 38 37.16667 0.83333333 118 37 35.91667 1.08333333 119 36 36.64706 -0.64705882 120 35 37.16667 -2.16666667 121 40 40.00000 0.00000000 122 37 36.85714 0.14285714 123 30 32.60000 -2.60000000 124 33 33.52174 -0.52173913 125 28 30.53846 -2.53846154 126 31 30.53846 0.46153846 127 33 35.91667 -2.91666667 128 40 36.64706 3.35294118 129 36 39.15000 -3.15000000 130 36 40.00000 -4.00000000 131 33 32.60000 0.40000000 132 40 40.00000 0.00000000 133 30 30.56250 -0.56250000 134 35 33.52174 1.47826087 135 32 33.52174 -1.52173913 136 25 23.92308 1.07692308 137 38 39.15000 -1.15000000 138 37 36.00000 1.00000000 139 33 33.52174 -0.52173913 140 30 32.60000 -2.60000000 141 38 39.15000 -1.15000000 142 38 39.15000 -1.15000000 143 34 39.15000 -5.15000000 144 36 33.52174 2.47826087 145 28 30.53846 -2.53846154 146 40 39.15000 0.85000000 147 36 34.38462 1.61538462 148 29 33.52174 -4.52173913 149 40 40.00000 0.00000000 150 36 37.16667 -1.16666667 151 41 36.64706 4.35294118 152 40 39.15000 0.85000000 153 36 34.38462 1.61538462 154 22 30.56250 -8.56250000 155 35 37.16667 -2.16666667 156 40 43.20000 -3.20000000 157 38 39.15000 -1.15000000 158 35 30.53846 4.46153846 159 33 36.64706 -3.64705882 160 39 36.64706 2.35294118 161 49 43.20000 5.80000000 162 36 37.16667 -1.16666667 163 41 39.15000 1.85000000 164 35 35.91667 -0.91666667 165 35 30.56250 4.43750000 166 42 40.00000 2.00000000 167 37 34.38462 2.61538462 168 36 36.64706 -0.64705882 169 39 40.00000 -1.00000000 170 32 33.52174 -1.52173913 171 37 37.16667 -0.16666667 172 35 35.91667 -0.91666667 173 39 40.00000 -1.00000000 174 39 35.91667 3.08333333 175 25 23.92308 1.07692308 176 35 32.60000 2.40000000 177 38 36.64706 1.35294118 178 42 39.15000 2.85000000 179 34 34.38462 -0.38461538 180 26 23.92308 2.07692308 181 34 36.64706 -2.64705882 182 26 23.92308 2.07692308 183 33 33.52174 -0.52173913 184 39 36.85714 2.14285714 185 32 32.60000 -0.60000000 186 42 43.20000 -1.20000000 187 34 34.38462 -0.38461538 188 38 34.38462 3.61538462 189 41 43.20000 -2.20000000 190 36 32.60000 3.40000000 191 36 35.91667 0.08333333 192 34 32.60000 1.40000000 193 34 34.38462 -0.38461538 194 30 30.56250 -0.56250000 195 35 32.60000 2.40000000 196 32 32.60000 -0.60000000 197 42 40.00000 2.00000000 198 38 37.16667 0.83333333 199 30 30.53846 -0.53846154 200 33 33.52174 -0.52173913 201 40 36.64706 3.35294118 202 33 32.60000 0.40000000 203 38 36.00000 2.00000000 204 26 23.92308 2.07692308 205 42 39.15000 2.85000000 206 34 36.85714 -2.85714286 207 36 35.91667 0.08333333 208 36 35.91667 0.08333333 209 29 32.60000 -3.60000000 210 44 43.20000 0.80000000 211 33 30.56250 2.43750000 212 34 35.91667 -1.91666667 213 33 30.56250 2.43750000 214 38 40.00000 -2.00000000 215 41 39.15000 1.85000000 216 32 30.53846 1.46153846 217 31 32.60000 -1.60000000 218 30 30.56250 -0.56250000 219 37 33.52174 3.47826087 220 30 23.92308 6.07692308 221 18 23.92308 -5.92307692 222 31 30.53846 0.46153846 223 48 43.20000 4.80000000 224 33 33.52174 -0.52173913 225 37 36.00000 1.00000000 > 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/4geeb1335900212.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/5pene1335900212.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/68txc1335900212.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/7a7tk1335900213.tab") + } > > try(system("convert tmp/27o301335900212.ps tmp/27o301335900212.png",intern=TRUE)) character(0) > try(system("convert tmp/39h2e1335900212.ps tmp/39h2e1335900212.png",intern=TRUE)) character(0) > try(system("convert tmp/4geeb1335900212.ps tmp/4geeb1335900212.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.047 0.359 5.405