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 = 'CSUQ' > par8 = 'CSUQ' > par7 = 'all' > par6 = 'bachelor' > par5 = 'all' > par4 = 'no' > par3 = '3' > par2 = 'none' > par1 = '0' > par9 <- 'CSUQ' > par8 <- 'CSUQ' > par7 <- 'all' > par6 <- 'bachelor' > 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] 100 110 107 107 93 106 121 112 98 93 107 96 110 84 119 134 139 149 [19] 118 95 120 120 107 121 61 118 118 109 113 124 93 143 112 100 87 130 [37] 106 121 120 111 110 115 133 100 126 102 115 126 123 114 76 115 112 81 [55] 77 92 114 99 38 107 92 141 120 124 129 103 118 111 84 84 123 124 [73] 112 114 97 132 104 110 127 131 136 87 87 94 135 124 102 138 90 71 [91] 112 105 108 118 80 112 105 122 128 126 107 110 126 131 123 125 117 144 [109] 128 127 136 120 102 97 115 119 118 87 107 95 125 118 136 105 116 115 [127] 123 97 104 129 104 91 121 113 120 106 104 94 133 124 107 80 112 115 [145] 66 126 128 133 122 140 133 130 92 141 118 119 129 94 138 114 125 116 [163] 132 116 110 117 122 130 98 86 128 142 121 109 133 89 115 66 117 89 [181] 124 144 123 103 112 136 94 122 140 112 126 133 141 119 114 142 149 91 [199] 130 132 99 > 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]) 38 61 66 71 76 77 80 81 84 86 87 89 90 91 92 93 94 95 96 97 1 1 2 1 1 1 2 1 3 1 4 2 1 2 3 3 4 2 1 3 98 99 100 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 2 2 3 3 2 4 3 3 8 1 2 6 2 9 2 5 7 3 3 8 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 138 139 4 6 5 4 5 6 3 6 2 4 3 4 2 3 6 1 1 4 2 1 140 141 142 143 144 149 2 3 2 1 2 2 > colnames(x) [1] "endo" "U1" "U2" "U3" "U4" "U5" "U6" "U7" "U8" "U9" [11] "U10" "U11" "U12" "U13" "U14" "U15" "U16" "U17" "U18" "U19" [21] "U20" "U21" "U22" "U23" "U24" "U25" "U26" "U27" "U28" "U29" [31] "U30" "U31" "U32" "U33" > colnames(x)[par1] [1] "endo" > x[,par1] [1] 100 110 107 107 93 106 121 112 98 93 107 96 110 84 119 134 139 149 [19] 118 95 120 120 107 121 61 118 118 109 113 124 93 143 112 100 87 130 [37] 106 121 120 111 110 115 133 100 126 102 115 126 123 114 76 115 112 81 [55] 77 92 114 99 38 107 92 141 120 124 129 103 118 111 84 84 123 124 [73] 112 114 97 132 104 110 127 131 136 87 87 94 135 124 102 138 90 71 [91] 112 105 108 118 80 112 105 122 128 126 107 110 126 131 123 125 117 144 [109] 128 127 136 120 102 97 115 119 118 87 107 95 125 118 136 105 116 115 [127] 123 97 104 129 104 91 121 113 120 106 104 94 133 124 107 80 112 115 [145] 66 126 128 133 122 140 133 130 92 141 118 119 129 94 138 114 125 116 [163] 132 116 110 117 122 130 98 86 128 142 121 109 133 89 115 66 117 89 [181] 124 144 123 103 112 136 94 122 140 112 126 133 141 119 114 142 149 91 [199] 130 132 99 > 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/1gao51337256723.tab") + } + } > m Conditional inference tree with 12 terminal nodes Response: endo Inputs: 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 Number of observations: 201 1) U20 <= 3; criterion = 1, statistic = 132.124 2) U20 <= 2; criterion = 1, statistic = 30.794 3) U31 <= 2; criterion = 0.989, statistic = 12.926 4)* weights = 9 3) U31 > 2 5)* weights = 17 2) U20 > 2 6) U24 <= 2; criterion = 1, statistic = 18.764 7)* weights = 15 6) U24 > 2 8)* weights = 23 1) U20 > 3 9) U1 <= 4; criterion = 1, statistic = 48.087 10) U21 <= 3; criterion = 1, statistic = 37.208 11) U16 <= 3; criterion = 0.982, statistic = 11.942 12)* weights = 14 11) U16 > 3 13) U24 <= 3; criterion = 0.961, statistic = 10.465 14)* weights = 12 13) U24 > 3 15)* weights = 10 10) U21 > 3 16) U30 <= 3; criterion = 1, statistic = 31.698 17)* weights = 20 16) U30 > 3 18) U18 <= 3; criterion = 0.999, statistic = 16.922 19)* weights = 23 18) U18 > 3 20)* weights = 32 9) U1 > 4 21) U23 <= 3; criterion = 0.995, statistic = 14.448 22)* weights = 8 21) U23 > 3 23)* weights = 18 > postscript(file="/var/wessaorg/rcomp/tmp/2hrsc1337256723.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/35jww1337256723.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 100 95.80000 4.20000000 2 110 115.30000 -5.30000000 3 107 95.80000 11.20000000 4 107 105.42857 1.57142857 5 93 95.80000 -2.80000000 6 106 95.80000 10.20000000 7 121 123.12500 -2.12500000 8 112 106.95652 5.04347826 9 98 90.29412 7.70588235 10 93 90.29412 2.70588235 11 107 115.30000 -8.30000000 12 96 105.42857 -9.42857143 13 110 121.39130 -11.39130435 14 84 90.29412 -6.29411765 15 119 117.50000 1.50000000 16 134 128.59375 5.40625000 17 139 138.33333 0.66666667 18 149 138.33333 10.66666667 19 118 117.50000 0.50000000 20 95 115.30000 -20.30000000 21 120 112.50000 7.50000000 22 120 117.50000 2.50000000 23 107 105.42857 1.57142857 24 121 123.12500 -2.12500000 25 61 71.33333 -10.33333333 26 118 121.39130 -3.39130435 27 118 115.30000 2.70000000 28 109 121.39130 -12.39130435 29 113 115.30000 -2.30000000 30 124 128.59375 -4.59375000 31 93 90.29412 2.70588235 32 143 138.33333 4.66666667 33 112 115.30000 -3.30000000 34 100 105.42857 -5.42857143 35 87 95.80000 -8.80000000 36 130 123.12500 6.87500000 37 106 112.50000 -6.50000000 38 121 128.59375 -7.59375000 39 120 117.50000 2.50000000 40 111 115.30000 -4.30000000 41 110 106.95652 3.04347826 42 115 115.30000 -0.30000000 43 133 138.33333 -5.33333333 44 100 106.95652 -6.95652174 45 126 128.59375 -2.59375000 46 102 90.29412 11.70588235 47 115 112.50000 2.50000000 48 126 128.59375 -2.59375000 49 123 115.30000 7.70000000 50 114 117.50000 -3.50000000 51 76 71.33333 4.66666667 52 115 112.50000 2.50000000 53 112 117.50000 -5.50000000 54 81 90.29412 -9.29411765 55 77 90.29412 -13.29411765 56 92 71.33333 20.66666667 57 114 112.50000 1.50000000 58 99 105.42857 -6.42857143 59 38 71.33333 -33.33333333 60 107 106.95652 0.04347826 61 92 95.80000 -3.80000000 62 141 138.33333 2.66666667 63 120 106.95652 13.04347826 64 124 121.39130 2.60869565 65 129 128.59375 0.40625000 66 103 95.80000 7.20000000 67 118 105.42857 12.57142857 68 111 112.50000 -1.50000000 69 84 105.42857 -21.42857143 70 84 90.29412 -6.29411765 71 123 123.12500 -0.12500000 72 124 128.59375 -4.59375000 73 112 112.50000 -0.50000000 74 114 121.39130 -7.39130435 75 97 106.95652 -9.95652174 76 132 138.33333 -6.33333333 77 104 105.42857 -1.42857143 78 110 112.50000 -2.50000000 79 127 115.30000 11.70000000 80 131 128.59375 2.40625000 81 136 138.33333 -2.33333333 82 87 90.29412 -3.29411765 83 87 90.29412 -3.29411765 84 94 106.95652 -12.95652174 85 135 128.59375 6.40625000 86 124 128.59375 -4.59375000 87 102 106.95652 -4.95652174 88 138 138.33333 -0.33333333 89 90 90.29412 -0.29411765 90 71 71.33333 -0.33333333 91 112 115.30000 -3.30000000 92 105 105.42857 -0.42857143 93 108 105.42857 2.57142857 94 118 117.50000 0.50000000 95 80 90.29412 -10.29411765 96 112 115.30000 -3.30000000 97 105 106.95652 -1.95652174 98 122 121.39130 0.60869565 99 128 128.59375 -0.59375000 100 126 138.33333 -12.33333333 101 107 95.80000 11.20000000 102 110 106.95652 3.04347826 103 126 128.59375 -2.59375000 104 131 128.59375 2.40625000 105 123 121.39130 1.60869565 106 125 121.39130 3.60869565 107 117 121.39130 -4.39130435 108 144 138.33333 5.66666667 109 128 121.39130 6.60869565 110 127 138.33333 -11.33333333 111 136 128.59375 7.40625000 112 120 121.39130 -1.39130435 113 102 105.42857 -3.42857143 114 97 90.29412 6.70588235 115 115 115.30000 -0.30000000 116 119 117.50000 1.50000000 117 118 123.12500 -5.12500000 118 87 90.29412 -3.29411765 119 107 106.95652 0.04347826 120 95 95.80000 -0.80000000 121 125 121.39130 3.60869565 122 118 128.59375 -10.59375000 123 136 128.59375 7.40625000 124 105 106.95652 -1.95652174 125 116 106.95652 9.04347826 126 115 115.30000 -0.30000000 127 123 128.59375 -5.59375000 128 97 106.95652 -9.95652174 129 104 106.95652 -2.95652174 130 129 128.59375 0.40625000 131 104 106.95652 -2.95652174 132 91 95.80000 -4.80000000 133 121 128.59375 -7.59375000 134 113 117.50000 -4.50000000 135 120 121.39130 -1.39130435 136 106 115.30000 -9.30000000 137 104 106.95652 -2.95652174 138 94 90.29412 3.70588235 139 133 128.59375 4.40625000 140 124 138.33333 -14.33333333 141 107 106.95652 0.04347826 142 80 71.33333 8.66666667 143 112 123.12500 -11.12500000 144 115 105.42857 9.57142857 145 66 71.33333 -5.33333333 146 126 128.59375 -2.59375000 147 128 121.39130 6.60869565 148 133 128.59375 4.40625000 149 122 105.42857 16.57142857 150 140 128.59375 11.40625000 151 133 106.95652 26.04347826 152 130 121.39130 8.60869565 153 92 71.33333 20.66666667 154 141 128.59375 12.40625000 155 118 115.30000 2.70000000 156 119 106.95652 12.04347826 157 129 115.30000 13.70000000 158 94 106.95652 -12.95652174 159 138 128.59375 9.40625000 160 114 121.39130 -7.39130435 161 125 121.39130 3.60869565 162 116 115.30000 0.70000000 163 132 123.12500 8.87500000 164 116 115.30000 0.70000000 165 110 90.29412 19.70588235 166 117 112.50000 4.50000000 167 122 121.39130 0.60869565 168 130 128.59375 1.40625000 169 98 95.80000 2.20000000 170 86 95.80000 -9.80000000 171 128 123.12500 4.87500000 172 142 138.33333 3.66666667 173 121 121.39130 -0.39130435 174 109 105.42857 3.57142857 175 133 128.59375 4.40625000 176 89 95.80000 -6.80000000 177 115 112.50000 2.50000000 178 66 71.33333 -5.33333333 179 117 128.59375 -11.59375000 180 89 95.80000 -6.80000000 181 124 128.59375 -4.59375000 182 144 138.33333 5.66666667 183 123 121.39130 1.60869565 184 103 112.50000 -9.50000000 185 112 121.39130 -9.39130435 186 136 115.30000 20.70000000 187 94 95.80000 -1.80000000 188 122 117.50000 4.50000000 189 140 138.33333 1.66666667 190 112 112.50000 -0.50000000 191 126 128.59375 -2.59375000 192 133 128.59375 4.40625000 193 141 138.33333 2.66666667 194 119 128.59375 -9.59375000 195 114 106.95652 7.04347826 196 142 138.33333 3.66666667 197 149 138.33333 10.66666667 198 91 90.29412 0.70588235 199 130 121.39130 8.60869565 200 132 121.39130 10.60869565 201 99 106.95652 -7.95652174 > 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/45ea41337256723.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/51q9n1337256723.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/679gd1337256723.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/7ftuh1337256723.tab") + } > > try(system("convert tmp/2hrsc1337256723.ps tmp/2hrsc1337256723.png",intern=TRUE)) character(0) > try(system("convert tmp/35jww1337256723.ps tmp/35jww1337256723.png",intern=TRUE)) character(0) > try(system("convert tmp/45ea41337256723.ps tmp/45ea41337256723.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.632 0.359 5.059