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 separate' > par8 = 'ATTLES separate' > par7 = 'all' > par6 = 'prep' > par5 = 'female' > par4 = 'no' > par3 = '3' > par2 = 'none' > par1 = '0' > par9 <- 'ATTLES separate' > par8 <- 'ATTLES separate' > par7 <- 'all' > par6 <- 'prep' > 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] 27 41 37 30 35 30 31 32 33 39 33 35 28 32 36 33 33 35 36 32 32 32 32 37 30 [26] 36 33 38 38 32 38 37 32 33 33 35 28 33 32 35 27 37 34 36 32 39 32 27 31 32 [51] 31 33 23 31 34 36 35 33 33 22 33 28 31 35 35 30 39 38 35 37 36 27 32 39 38 [76] 39 36 34 36 42 38 34 36 40 35 31 41 33 47 38 40 29 35 42 27 34 39 30 40 37 [101] 32 37 35 32 37 35 35 37 36 30 36 37 37 36 28 36 38 37 35 31 37 30 36 36 33 [126] 36 25 32 33 33 37 30 34 30 38 31 31 39 37 33 34 37 36 39 33 34 25 34 34 25 [151] 35 32 30 40 36 36 39 29 24 31 38 37 26 35 34 35 29 38 28 35 29 39 37 34 33 [176] 29 35 40 29 32 35 29 29 21 31 29 32 30 36 34 35 34 29 33 36 37 33 37 33 30 [201] 30 29 26 33 33 33 32 30 32 40 32 30 32 34 34 31 32 35 40 29 30 33 34 30 35 [226] 30 > 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 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 47 1 1 1 1 3 2 5 5 12 18 12 24 26 17 24 21 20 11 10 7 2 2 1 > colnames(x) [1] "endo" "A11" "A12" "A13" "A14" "A15" "A16" "A17" "A18" "A19" [11] "A20" > colnames(x)[par1] [1] "endo" > x[,par1] [1] 27 41 37 30 35 30 31 32 33 39 33 35 28 32 36 33 33 35 36 32 32 32 32 37 30 [26] 36 33 38 38 32 38 37 32 33 33 35 28 33 32 35 27 37 34 36 32 39 32 27 31 32 [51] 31 33 23 31 34 36 35 33 33 22 33 28 31 35 35 30 39 38 35 37 36 27 32 39 38 [76] 39 36 34 36 42 38 34 36 40 35 31 41 33 47 38 40 29 35 42 27 34 39 30 40 37 [101] 32 37 35 32 37 35 35 37 36 30 36 37 37 36 28 36 38 37 35 31 37 30 36 36 33 [126] 36 25 32 33 33 37 30 34 30 38 31 31 39 37 33 34 37 36 39 33 34 25 34 34 25 [151] 35 32 30 40 36 36 39 29 24 31 38 37 26 35 34 35 29 38 28 35 29 39 37 34 33 [176] 29 35 40 29 32 35 29 29 21 31 29 32 30 36 34 35 34 29 33 36 37 33 37 33 30 [201] 30 29 26 33 33 33 32 30 32 40 32 30 32 34 34 31 32 35 40 29 30 33 34 30 35 [226] 30 > 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/121m61335895752.tab") + } + } > m Conditional inference tree with 14 terminal nodes Response: endo Inputs: A11, A12, A13, A14, A15, A16, A17, A18, A19, A20 Number of observations: 226 1) A18 <= 3; criterion = 1, statistic = 70.62 2) A15 <= 3; criterion = 1, statistic = 30.99 3) A20 <= 2; criterion = 1, statistic = 16.784 4) A16 <= 2; criterion = 0.972, statistic = 8.88 5)* weights = 15 4) A16 > 2 6)* weights = 10 3) A20 > 2 7)* weights = 22 2) A15 > 3 8) A14 <= 3; criterion = 0.999, statistic = 15.491 9) A17 <= 2; criterion = 0.991, statistic = 11.051 10)* weights = 7 9) A17 > 2 11)* weights = 20 8) A14 > 3 12)* weights = 19 1) A18 > 3 13) A19 <= 3; criterion = 1, statistic = 36.126 14) A14 <= 3; criterion = 0.997, statistic = 13.404 15) A20 <= 2; criterion = 0.977, statistic = 9.27 16)* weights = 9 15) A20 > 2 17)* weights = 14 14) A14 > 3 18)* weights = 22 13) A19 > 3 19) A20 <= 2; criterion = 1, statistic = 25.387 20) A15 <= 3; criterion = 0.997, statistic = 13.145 21)* weights = 8 20) A15 > 3 22)* weights = 21 19) A20 > 2 23) A18 <= 4; criterion = 0.999, statistic = 14.698 24) A16 <= 2; criterion = 0.995, statistic = 12.014 25)* weights = 11 24) A16 > 2 26)* weights = 33 23) A18 > 4 27)* weights = 15 > postscript(file="/var/wessaorg/rcomp/tmp/2fh881335895752.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/3ofhk1335895752.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 27 29.50000 -2.5000000 2 41 39.60000 1.4000000 3 37 34.50000 2.5000000 4 30 29.57143 0.4285714 5 35 34.78947 0.2105263 6 30 33.00000 -3.0000000 7 31 34.78947 -3.7894737 8 32 34.45455 -2.4545455 9 33 35.14286 -2.1428571 10 39 36.84848 2.1515152 11 33 34.45455 -1.4545455 12 35 34.50000 0.5000000 13 28 33.00000 -5.0000000 14 32 29.50000 2.5000000 15 36 34.50000 1.5000000 16 33 33.14286 -0.1428571 17 33 29.66667 3.3333333 18 35 35.14286 -0.1428571 19 36 35.14286 0.8571429 20 32 33.14286 -1.1428571 21 32 34.50000 -2.5000000 22 32 34.45455 -2.4545455 23 32 36.84848 -4.8484848 24 37 35.14286 1.8571429 25 30 29.66667 0.3333333 26 36 36.84848 -0.8484848 27 33 31.75000 1.2500000 28 38 35.14286 2.8571429 29 38 39.60000 -1.6000000 30 32 36.84848 -4.8484848 31 38 39.60000 -1.6000000 32 37 36.84848 0.1515152 33 32 29.66667 2.3333333 34 33 33.00000 0.0000000 35 33 35.14286 -2.1428571 36 35 35.14286 -0.1428571 37 28 26.66667 1.3333333 38 33 35.14286 -2.1428571 39 32 34.50000 -2.5000000 40 35 36.84848 -1.8484848 41 27 29.50000 -2.5000000 42 37 36.84848 0.1515152 43 34 33.14286 0.8571429 44 36 31.77273 4.2272727 45 32 33.00000 -1.0000000 46 39 39.60000 -0.6000000 47 32 35.14286 -3.1428571 48 27 29.66667 -2.6666667 49 31 26.66667 4.3333333 50 32 31.77273 0.2272727 51 31 35.14286 -4.1428571 52 33 29.66667 3.3333333 53 23 31.77273 -8.7727273 54 31 34.50000 -3.5000000 55 34 31.77273 2.2272727 56 36 36.84848 -0.8484848 57 35 33.00000 2.0000000 58 33 33.00000 0.0000000 59 33 29.50000 3.5000000 60 22 26.66667 -4.6666667 61 33 31.77273 1.2272727 62 28 26.66667 1.3333333 63 31 29.57143 1.4285714 64 35 33.00000 2.0000000 65 35 34.78947 0.2105263 66 30 29.57143 0.4285714 67 39 36.84848 2.1515152 68 38 36.84848 1.1515152 69 35 34.78947 0.2105263 70 37 33.00000 4.0000000 71 36 34.50000 1.5000000 72 27 29.66667 -2.6666667 73 32 35.14286 -3.1428571 74 39 39.60000 -0.6000000 75 38 35.14286 2.8571429 76 39 36.84848 2.1515152 77 36 35.14286 0.8571429 78 34 33.14286 0.8571429 79 36 35.14286 0.8571429 80 42 39.60000 2.4000000 81 38 34.50000 3.5000000 82 34 35.14286 -1.1428571 83 36 36.84848 -0.8484848 84 40 34.78947 5.2105263 85 35 36.84848 -1.8484848 86 31 33.00000 -2.0000000 87 41 39.60000 1.4000000 88 33 33.00000 0.0000000 89 47 39.60000 7.4000000 90 38 33.14286 4.8571429 91 40 36.84848 3.1515152 92 29 29.50000 -0.5000000 93 35 34.50000 0.5000000 94 42 36.84848 5.1515152 95 27 26.66667 0.3333333 96 34 33.00000 1.0000000 97 39 36.84848 2.1515152 98 30 29.50000 0.5000000 99 40 39.60000 0.4000000 100 37 36.84848 0.1515152 101 32 31.75000 0.2500000 102 37 34.45455 2.5454545 103 35 35.14286 -0.1428571 104 32 33.00000 -1.0000000 105 37 31.77273 5.2272727 106 35 34.78947 0.2105263 107 35 33.00000 2.0000000 108 37 35.14286 1.8571429 109 36 36.84848 -0.8484848 110 30 33.14286 -3.1428571 111 36 36.84848 -0.8484848 112 37 35.14286 1.8571429 113 37 35.14286 1.8571429 114 36 33.14286 2.8571429 115 28 29.57143 -1.5714286 116 36 34.78947 1.2105263 117 38 35.14286 2.8571429 118 37 34.45455 2.5454545 119 35 34.45455 0.5454545 120 31 33.00000 -2.0000000 121 37 33.00000 4.0000000 122 30 31.77273 -1.7727273 123 36 34.78947 1.2105263 124 36 36.84848 -0.8484848 125 33 34.78947 -1.7894737 126 36 36.84848 -0.8484848 127 25 29.66667 -4.6666667 128 32 33.00000 -1.0000000 129 33 31.77273 1.2272727 130 33 34.50000 -1.5000000 131 37 39.60000 -2.6000000 132 30 29.50000 0.5000000 133 34 34.50000 -0.5000000 134 30 31.77273 -1.7727273 135 38 36.84848 1.1515152 136 31 26.66667 4.3333333 137 31 31.77273 -0.7727273 138 39 39.60000 -0.6000000 139 37 39.60000 -2.6000000 140 33 33.00000 0.0000000 141 34 34.50000 -0.5000000 142 37 36.84848 0.1515152 143 36 36.84848 -0.8484848 144 39 36.84848 2.1515152 145 33 34.50000 -1.5000000 146 34 33.14286 0.8571429 147 25 26.66667 -1.6666667 148 34 34.78947 -0.7894737 149 34 34.78947 -0.7894737 150 25 26.66667 -1.6666667 151 35 34.78947 0.2105263 152 32 33.00000 -1.0000000 153 30 31.77273 -1.7727273 154 40 34.50000 5.5000000 155 36 34.78947 1.2105263 156 36 34.50000 1.5000000 157 39 36.84848 2.1515152 158 29 29.57143 -0.5714286 159 24 26.66667 -2.6666667 160 31 31.77273 -0.7727273 161 38 36.84848 1.1515152 162 37 36.84848 0.1515152 163 26 26.66667 -0.6666667 164 35 31.77273 3.2272727 165 34 34.50000 -0.5000000 166 35 36.84848 -1.8484848 167 29 29.50000 -0.5000000 168 38 34.78947 3.2105263 169 28 26.66667 1.3333333 170 35 34.50000 0.5000000 171 29 29.50000 -0.5000000 172 39 39.60000 -0.6000000 173 37 34.78947 2.2105263 174 34 33.14286 0.8571429 175 33 34.78947 -1.7894737 176 29 31.75000 -2.7500000 177 35 35.14286 -0.1428571 178 40 36.84848 3.1515152 179 29 26.66667 2.3333333 180 32 31.77273 0.2272727 181 35 34.50000 0.5000000 182 29 31.77273 -2.7727273 183 29 29.57143 -0.5714286 184 21 26.66667 -5.6666667 185 31 31.77273 -0.7727273 186 29 31.77273 -2.7727273 187 32 33.14286 -1.1428571 188 30 29.57143 0.4285714 189 36 34.45455 1.5454545 190 34 33.14286 0.8571429 191 35 36.84848 -1.8484848 192 34 36.84848 -2.8484848 193 29 26.66667 2.3333333 194 33 34.78947 -1.7894737 195 36 31.75000 4.2500000 196 37 34.50000 2.5000000 197 33 34.50000 -1.5000000 198 37 39.60000 -2.6000000 199 33 31.75000 1.2500000 200 30 33.14286 -3.1428571 201 30 34.50000 -4.5000000 202 29 31.75000 -2.7500000 203 26 26.66667 -0.6666667 204 33 33.00000 0.0000000 205 33 33.14286 -0.1428571 206 33 34.50000 -1.5000000 207 32 31.75000 0.2500000 208 30 29.66667 0.3333333 209 32 34.45455 -2.4545455 210 40 34.45455 5.5454545 211 32 34.45455 -2.4545455 212 30 34.78947 -4.7894737 213 32 31.77273 0.2272727 214 34 33.00000 1.0000000 215 34 31.77273 2.2272727 216 31 31.77273 -0.7727273 217 32 31.77273 0.2272727 218 35 34.78947 0.2105263 219 40 39.60000 0.4000000 220 29 29.50000 -0.5000000 221 30 29.66667 0.3333333 222 33 34.45455 -1.4545455 223 34 31.77273 2.2272727 224 30 33.14286 -3.1428571 225 35 36.84848 -1.8484848 226 30 31.75000 -1.7500000 > 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/47s7n1335895752.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/5rilv1335895752.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/67nlh1335895752.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/7p0ir1335895752.tab") + } > > try(system("convert tmp/2fh881335895752.ps tmp/2fh881335895752.png",intern=TRUE)) character(0) > try(system("convert tmp/3ofhk1335895752.ps tmp/3ofhk1335895752.png",intern=TRUE)) character(0) > try(system("convert tmp/47s7n1335895752.ps tmp/47s7n1335895752.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.584 0.392 5.976