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 = 'CSUQ' > par7 = 'all' > par6 = 'all' > par5 = 'all' > par4 = 'no' > par3 = '3' > par2 = 'none' > par1 = '0' > par9 <- 'ATTLES connected' > par8 <- 'CSUQ' > 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] 36 34 33 30 29 38 39 40 43 30 34 43 32 36 47 35 37 40 27 40 35 33 35 44 37 [26] 35 40 32 43 42 39 36 39 36 36 36 43 40 31 47 34 28 36 39 25 32 37 36 44 30 [51] 37 32 33 41 40 32 39 35 34 37 32 41 36 30 44 40 43 35 33 24 26 39 40 35 40 [76] 36 35 37 32 33 31 37 35 37 32 38 46 43 35 34 38 29 38 40 34 36 40 26 34 47 [101] 40 35 40 41 34 37 36 37 33 38 36 37 38 32 32 33 38 29 28 39 33 29 37 37 40 [126] 45 44 42 41 38 29 37 39 38 42 40 30 42 37 34 39 33 44 39 29 30 40 37 35 33 [151] 34 35 39 37 38 42 34 39 40 36 42 41 33 30 34 36 33 35 37 35 42 36 39 39 38 [176] 37 37 32 32 43 31 44 35 30 38 32 34 38 33 37 42 38 30 35 42 40 30 35 35 39 [201] 34 34 37 37 41 38 36 35 40 38 37 38 37 30 33 36 27 36 38 28 39 41 33 31 39 [226] 37 36 39 33 41 33 27 30 33 45 38 43 36 40 39 36 37 23 33 40 34 35 48 43 30 [251] 34 36 28 36 36 38 34 41 41 27 41 40 40 38 26 35 34 39 40 40 28 37 39 35 36 [276] 36 35 37 34 38 37 33 35 39 40 36 34 39 36 38 39 40 41 38 44 37 39 35 38 42 [301] 31 37 39 35 27 41 38 37 39 45 29 35 38 37 35 43 31 39 40 40 31 28 38 40 42 [326] 40 26 27 33 38 40 36 39 47 35 35 34 42 31 38 33 40 37 37 36 38 41 33 40 30 [351] 35 32 38 43 25 35 38 37 37 33 30 32 37 38 30 38 35 38 32 36 28 36 36 37 29 [376] 40 35 36 41 40 40 36 34 22 39 35 40 38 35 36 35 36 26 35 36 34 33 35 32 39 [401] 49 36 41 38 37 35 35 36 40 42 37 45 42 36 32 39 32 38 41 36 37 35 35 39 39 [426] 39 42 25 35 38 42 34 26 34 26 33 > 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]) 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 1 1 1 3 7 6 7 8 16 8 19 26 26 45 43 43 40 35 39 17 16 11 7 4 1 4 48 49 1 1 > 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] 36 34 33 30 29 38 39 40 43 30 34 43 32 36 47 35 37 40 27 40 35 33 35 44 37 [26] 35 40 32 43 42 39 36 39 36 36 36 43 40 31 47 34 28 36 39 25 32 37 36 44 30 [51] 37 32 33 41 40 32 39 35 34 37 32 41 36 30 44 40 43 35 33 24 26 39 40 35 40 [76] 36 35 37 32 33 31 37 35 37 32 38 46 43 35 34 38 29 38 40 34 36 40 26 34 47 [101] 40 35 40 41 34 37 36 37 33 38 36 37 38 32 32 33 38 29 28 39 33 29 37 37 40 [126] 45 44 42 41 38 29 37 39 38 42 40 30 42 37 34 39 33 44 39 29 30 40 37 35 33 [151] 34 35 39 37 38 42 34 39 40 36 42 41 33 30 34 36 33 35 37 35 42 36 39 39 38 [176] 37 37 32 32 43 31 44 35 30 38 32 34 38 33 37 42 38 30 35 42 40 30 35 35 39 [201] 34 34 37 37 41 38 36 35 40 38 37 38 37 30 33 36 27 36 38 28 39 41 33 31 39 [226] 37 36 39 33 41 33 27 30 33 45 38 43 36 40 39 36 37 23 33 40 34 35 48 43 30 [251] 34 36 28 36 36 38 34 41 41 27 41 40 40 38 26 35 34 39 40 40 28 37 39 35 36 [276] 36 35 37 34 38 37 33 35 39 40 36 34 39 36 38 39 40 41 38 44 37 39 35 38 42 [301] 31 37 39 35 27 41 38 37 39 45 29 35 38 37 35 43 31 39 40 40 31 28 38 40 42 [326] 40 26 27 33 38 40 36 39 47 35 35 34 42 31 38 33 40 37 37 36 38 41 33 40 30 [351] 35 32 38 43 25 35 38 37 37 33 30 32 37 38 30 38 35 38 32 36 28 36 36 37 29 [376] 40 35 36 41 40 40 36 34 22 39 35 40 38 35 36 35 36 26 35 36 34 33 35 32 39 [401] 49 36 41 38 37 35 35 36 40 42 37 45 42 36 32 39 32 38 41 36 37 35 35 39 39 [426] 39 42 25 35 38 42 34 26 34 26 33 > 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/1q4wb1335446327.tab") + } + } > m Conditional inference tree with 1 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: 436 1)* weights = 436 > postscript(file="/var/wessaorg/rcomp/tmp/25al01335446327.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/3wrhf1335446327.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 36 36.27064 -0.2706422 2 34 36.27064 -2.2706422 3 33 36.27064 -3.2706422 4 30 36.27064 -6.2706422 5 29 36.27064 -7.2706422 6 38 36.27064 1.7293578 7 39 36.27064 2.7293578 8 40 36.27064 3.7293578 9 43 36.27064 6.7293578 10 30 36.27064 -6.2706422 11 34 36.27064 -2.2706422 12 43 36.27064 6.7293578 13 32 36.27064 -4.2706422 14 36 36.27064 -0.2706422 15 47 36.27064 10.7293578 16 35 36.27064 -1.2706422 17 37 36.27064 0.7293578 18 40 36.27064 3.7293578 19 27 36.27064 -9.2706422 20 40 36.27064 3.7293578 21 35 36.27064 -1.2706422 22 33 36.27064 -3.2706422 23 35 36.27064 -1.2706422 24 44 36.27064 7.7293578 25 37 36.27064 0.7293578 26 35 36.27064 -1.2706422 27 40 36.27064 3.7293578 28 32 36.27064 -4.2706422 29 43 36.27064 6.7293578 30 42 36.27064 5.7293578 31 39 36.27064 2.7293578 32 36 36.27064 -0.2706422 33 39 36.27064 2.7293578 34 36 36.27064 -0.2706422 35 36 36.27064 -0.2706422 36 36 36.27064 -0.2706422 37 43 36.27064 6.7293578 38 40 36.27064 3.7293578 39 31 36.27064 -5.2706422 40 47 36.27064 10.7293578 41 34 36.27064 -2.2706422 42 28 36.27064 -8.2706422 43 36 36.27064 -0.2706422 44 39 36.27064 2.7293578 45 25 36.27064 -11.2706422 46 32 36.27064 -4.2706422 47 37 36.27064 0.7293578 48 36 36.27064 -0.2706422 49 44 36.27064 7.7293578 50 30 36.27064 -6.2706422 51 37 36.27064 0.7293578 52 32 36.27064 -4.2706422 53 33 36.27064 -3.2706422 54 41 36.27064 4.7293578 55 40 36.27064 3.7293578 56 32 36.27064 -4.2706422 57 39 36.27064 2.7293578 58 35 36.27064 -1.2706422 59 34 36.27064 -2.2706422 60 37 36.27064 0.7293578 61 32 36.27064 -4.2706422 62 41 36.27064 4.7293578 63 36 36.27064 -0.2706422 64 30 36.27064 -6.2706422 65 44 36.27064 7.7293578 66 40 36.27064 3.7293578 67 43 36.27064 6.7293578 68 35 36.27064 -1.2706422 69 33 36.27064 -3.2706422 70 24 36.27064 -12.2706422 71 26 36.27064 -10.2706422 72 39 36.27064 2.7293578 73 40 36.27064 3.7293578 74 35 36.27064 -1.2706422 75 40 36.27064 3.7293578 76 36 36.27064 -0.2706422 77 35 36.27064 -1.2706422 78 37 36.27064 0.7293578 79 32 36.27064 -4.2706422 80 33 36.27064 -3.2706422 81 31 36.27064 -5.2706422 82 37 36.27064 0.7293578 83 35 36.27064 -1.2706422 84 37 36.27064 0.7293578 85 32 36.27064 -4.2706422 86 38 36.27064 1.7293578 87 46 36.27064 9.7293578 88 43 36.27064 6.7293578 89 35 36.27064 -1.2706422 90 34 36.27064 -2.2706422 91 38 36.27064 1.7293578 92 29 36.27064 -7.2706422 93 38 36.27064 1.7293578 94 40 36.27064 3.7293578 95 34 36.27064 -2.2706422 96 36 36.27064 -0.2706422 97 40 36.27064 3.7293578 98 26 36.27064 -10.2706422 99 34 36.27064 -2.2706422 100 47 36.27064 10.7293578 101 40 36.27064 3.7293578 102 35 36.27064 -1.2706422 103 40 36.27064 3.7293578 104 41 36.27064 4.7293578 105 34 36.27064 -2.2706422 106 37 36.27064 0.7293578 107 36 36.27064 -0.2706422 108 37 36.27064 0.7293578 109 33 36.27064 -3.2706422 110 38 36.27064 1.7293578 111 36 36.27064 -0.2706422 112 37 36.27064 0.7293578 113 38 36.27064 1.7293578 114 32 36.27064 -4.2706422 115 32 36.27064 -4.2706422 116 33 36.27064 -3.2706422 117 38 36.27064 1.7293578 118 29 36.27064 -7.2706422 119 28 36.27064 -8.2706422 120 39 36.27064 2.7293578 121 33 36.27064 -3.2706422 122 29 36.27064 -7.2706422 123 37 36.27064 0.7293578 124 37 36.27064 0.7293578 125 40 36.27064 3.7293578 126 45 36.27064 8.7293578 127 44 36.27064 7.7293578 128 42 36.27064 5.7293578 129 41 36.27064 4.7293578 130 38 36.27064 1.7293578 131 29 36.27064 -7.2706422 132 37 36.27064 0.7293578 133 39 36.27064 2.7293578 134 38 36.27064 1.7293578 135 42 36.27064 5.7293578 136 40 36.27064 3.7293578 137 30 36.27064 -6.2706422 138 42 36.27064 5.7293578 139 37 36.27064 0.7293578 140 34 36.27064 -2.2706422 141 39 36.27064 2.7293578 142 33 36.27064 -3.2706422 143 44 36.27064 7.7293578 144 39 36.27064 2.7293578 145 29 36.27064 -7.2706422 146 30 36.27064 -6.2706422 147 40 36.27064 3.7293578 148 37 36.27064 0.7293578 149 35 36.27064 -1.2706422 150 33 36.27064 -3.2706422 151 34 36.27064 -2.2706422 152 35 36.27064 -1.2706422 153 39 36.27064 2.7293578 154 37 36.27064 0.7293578 155 38 36.27064 1.7293578 156 42 36.27064 5.7293578 157 34 36.27064 -2.2706422 158 39 36.27064 2.7293578 159 40 36.27064 3.7293578 160 36 36.27064 -0.2706422 161 42 36.27064 5.7293578 162 41 36.27064 4.7293578 163 33 36.27064 -3.2706422 164 30 36.27064 -6.2706422 165 34 36.27064 -2.2706422 166 36 36.27064 -0.2706422 167 33 36.27064 -3.2706422 168 35 36.27064 -1.2706422 169 37 36.27064 0.7293578 170 35 36.27064 -1.2706422 171 42 36.27064 5.7293578 172 36 36.27064 -0.2706422 173 39 36.27064 2.7293578 174 39 36.27064 2.7293578 175 38 36.27064 1.7293578 176 37 36.27064 0.7293578 177 37 36.27064 0.7293578 178 32 36.27064 -4.2706422 179 32 36.27064 -4.2706422 180 43 36.27064 6.7293578 181 31 36.27064 -5.2706422 182 44 36.27064 7.7293578 183 35 36.27064 -1.2706422 184 30 36.27064 -6.2706422 185 38 36.27064 1.7293578 186 32 36.27064 -4.2706422 187 34 36.27064 -2.2706422 188 38 36.27064 1.7293578 189 33 36.27064 -3.2706422 190 37 36.27064 0.7293578 191 42 36.27064 5.7293578 192 38 36.27064 1.7293578 193 30 36.27064 -6.2706422 194 35 36.27064 -1.2706422 195 42 36.27064 5.7293578 196 40 36.27064 3.7293578 197 30 36.27064 -6.2706422 198 35 36.27064 -1.2706422 199 35 36.27064 -1.2706422 200 39 36.27064 2.7293578 201 34 36.27064 -2.2706422 202 34 36.27064 -2.2706422 203 37 36.27064 0.7293578 204 37 36.27064 0.7293578 205 41 36.27064 4.7293578 206 38 36.27064 1.7293578 207 36 36.27064 -0.2706422 208 35 36.27064 -1.2706422 209 40 36.27064 3.7293578 210 38 36.27064 1.7293578 211 37 36.27064 0.7293578 212 38 36.27064 1.7293578 213 37 36.27064 0.7293578 214 30 36.27064 -6.2706422 215 33 36.27064 -3.2706422 216 36 36.27064 -0.2706422 217 27 36.27064 -9.2706422 218 36 36.27064 -0.2706422 219 38 36.27064 1.7293578 220 28 36.27064 -8.2706422 221 39 36.27064 2.7293578 222 41 36.27064 4.7293578 223 33 36.27064 -3.2706422 224 31 36.27064 -5.2706422 225 39 36.27064 2.7293578 226 37 36.27064 0.7293578 227 36 36.27064 -0.2706422 228 39 36.27064 2.7293578 229 33 36.27064 -3.2706422 230 41 36.27064 4.7293578 231 33 36.27064 -3.2706422 232 27 36.27064 -9.2706422 233 30 36.27064 -6.2706422 234 33 36.27064 -3.2706422 235 45 36.27064 8.7293578 236 38 36.27064 1.7293578 237 43 36.27064 6.7293578 238 36 36.27064 -0.2706422 239 40 36.27064 3.7293578 240 39 36.27064 2.7293578 241 36 36.27064 -0.2706422 242 37 36.27064 0.7293578 243 23 36.27064 -13.2706422 244 33 36.27064 -3.2706422 245 40 36.27064 3.7293578 246 34 36.27064 -2.2706422 247 35 36.27064 -1.2706422 248 48 36.27064 11.7293578 249 43 36.27064 6.7293578 250 30 36.27064 -6.2706422 251 34 36.27064 -2.2706422 252 36 36.27064 -0.2706422 253 28 36.27064 -8.2706422 254 36 36.27064 -0.2706422 255 36 36.27064 -0.2706422 256 38 36.27064 1.7293578 257 34 36.27064 -2.2706422 258 41 36.27064 4.7293578 259 41 36.27064 4.7293578 260 27 36.27064 -9.2706422 261 41 36.27064 4.7293578 262 40 36.27064 3.7293578 263 40 36.27064 3.7293578 264 38 36.27064 1.7293578 265 26 36.27064 -10.2706422 266 35 36.27064 -1.2706422 267 34 36.27064 -2.2706422 268 39 36.27064 2.7293578 269 40 36.27064 3.7293578 270 40 36.27064 3.7293578 271 28 36.27064 -8.2706422 272 37 36.27064 0.7293578 273 39 36.27064 2.7293578 274 35 36.27064 -1.2706422 275 36 36.27064 -0.2706422 276 36 36.27064 -0.2706422 277 35 36.27064 -1.2706422 278 37 36.27064 0.7293578 279 34 36.27064 -2.2706422 280 38 36.27064 1.7293578 281 37 36.27064 0.7293578 282 33 36.27064 -3.2706422 283 35 36.27064 -1.2706422 284 39 36.27064 2.7293578 285 40 36.27064 3.7293578 286 36 36.27064 -0.2706422 287 34 36.27064 -2.2706422 288 39 36.27064 2.7293578 289 36 36.27064 -0.2706422 290 38 36.27064 1.7293578 291 39 36.27064 2.7293578 292 40 36.27064 3.7293578 293 41 36.27064 4.7293578 294 38 36.27064 1.7293578 295 44 36.27064 7.7293578 296 37 36.27064 0.7293578 297 39 36.27064 2.7293578 298 35 36.27064 -1.2706422 299 38 36.27064 1.7293578 300 42 36.27064 5.7293578 301 31 36.27064 -5.2706422 302 37 36.27064 0.7293578 303 39 36.27064 2.7293578 304 35 36.27064 -1.2706422 305 27 36.27064 -9.2706422 306 41 36.27064 4.7293578 307 38 36.27064 1.7293578 308 37 36.27064 0.7293578 309 39 36.27064 2.7293578 310 45 36.27064 8.7293578 311 29 36.27064 -7.2706422 312 35 36.27064 -1.2706422 313 38 36.27064 1.7293578 314 37 36.27064 0.7293578 315 35 36.27064 -1.2706422 316 43 36.27064 6.7293578 317 31 36.27064 -5.2706422 318 39 36.27064 2.7293578 319 40 36.27064 3.7293578 320 40 36.27064 3.7293578 321 31 36.27064 -5.2706422 322 28 36.27064 -8.2706422 323 38 36.27064 1.7293578 324 40 36.27064 3.7293578 325 42 36.27064 5.7293578 326 40 36.27064 3.7293578 327 26 36.27064 -10.2706422 328 27 36.27064 -9.2706422 329 33 36.27064 -3.2706422 330 38 36.27064 1.7293578 331 40 36.27064 3.7293578 332 36 36.27064 -0.2706422 333 39 36.27064 2.7293578 334 47 36.27064 10.7293578 335 35 36.27064 -1.2706422 336 35 36.27064 -1.2706422 337 34 36.27064 -2.2706422 338 42 36.27064 5.7293578 339 31 36.27064 -5.2706422 340 38 36.27064 1.7293578 341 33 36.27064 -3.2706422 342 40 36.27064 3.7293578 343 37 36.27064 0.7293578 344 37 36.27064 0.7293578 345 36 36.27064 -0.2706422 346 38 36.27064 1.7293578 347 41 36.27064 4.7293578 348 33 36.27064 -3.2706422 349 40 36.27064 3.7293578 350 30 36.27064 -6.2706422 351 35 36.27064 -1.2706422 352 32 36.27064 -4.2706422 353 38 36.27064 1.7293578 354 43 36.27064 6.7293578 355 25 36.27064 -11.2706422 356 35 36.27064 -1.2706422 357 38 36.27064 1.7293578 358 37 36.27064 0.7293578 359 37 36.27064 0.7293578 360 33 36.27064 -3.2706422 361 30 36.27064 -6.2706422 362 32 36.27064 -4.2706422 363 37 36.27064 0.7293578 364 38 36.27064 1.7293578 365 30 36.27064 -6.2706422 366 38 36.27064 1.7293578 367 35 36.27064 -1.2706422 368 38 36.27064 1.7293578 369 32 36.27064 -4.2706422 370 36 36.27064 -0.2706422 371 28 36.27064 -8.2706422 372 36 36.27064 -0.2706422 373 36 36.27064 -0.2706422 374 37 36.27064 0.7293578 375 29 36.27064 -7.2706422 376 40 36.27064 3.7293578 377 35 36.27064 -1.2706422 378 36 36.27064 -0.2706422 379 41 36.27064 4.7293578 380 40 36.27064 3.7293578 381 40 36.27064 3.7293578 382 36 36.27064 -0.2706422 383 34 36.27064 -2.2706422 384 22 36.27064 -14.2706422 385 39 36.27064 2.7293578 386 35 36.27064 -1.2706422 387 40 36.27064 3.7293578 388 38 36.27064 1.7293578 389 35 36.27064 -1.2706422 390 36 36.27064 -0.2706422 391 35 36.27064 -1.2706422 392 36 36.27064 -0.2706422 393 26 36.27064 -10.2706422 394 35 36.27064 -1.2706422 395 36 36.27064 -0.2706422 396 34 36.27064 -2.2706422 397 33 36.27064 -3.2706422 398 35 36.27064 -1.2706422 399 32 36.27064 -4.2706422 400 39 36.27064 2.7293578 401 49 36.27064 12.7293578 402 36 36.27064 -0.2706422 403 41 36.27064 4.7293578 404 38 36.27064 1.7293578 405 37 36.27064 0.7293578 406 35 36.27064 -1.2706422 407 35 36.27064 -1.2706422 408 36 36.27064 -0.2706422 409 40 36.27064 3.7293578 410 42 36.27064 5.7293578 411 37 36.27064 0.7293578 412 45 36.27064 8.7293578 413 42 36.27064 5.7293578 414 36 36.27064 -0.2706422 415 32 36.27064 -4.2706422 416 39 36.27064 2.7293578 417 32 36.27064 -4.2706422 418 38 36.27064 1.7293578 419 41 36.27064 4.7293578 420 36 36.27064 -0.2706422 421 37 36.27064 0.7293578 422 35 36.27064 -1.2706422 423 35 36.27064 -1.2706422 424 39 36.27064 2.7293578 425 39 36.27064 2.7293578 426 39 36.27064 2.7293578 427 42 36.27064 5.7293578 428 25 36.27064 -11.2706422 429 35 36.27064 -1.2706422 430 38 36.27064 1.7293578 431 42 36.27064 5.7293578 432 34 36.27064 -2.2706422 433 26 36.27064 -10.2706422 434 34 36.27064 -2.2706422 435 26 36.27064 -10.2706422 436 33 36.27064 -3.2706422 > 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/4l7oh1335446327.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/5f37b1335446328.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/65kn51335446328.tab") + } Warning message: In cor(result$Forecasts, result$Actuals) : the standard deviation is zero > 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/78bo01335446328.tab") + } > > try(system("convert tmp/25al01335446327.ps tmp/25al01335446327.png",intern=TRUE)) character(0) > try(system("convert tmp/3wrhf1335446327.ps tmp/3wrhf1335446327.png",intern=TRUE)) character(0) > try(system("convert tmp/4l7oh1335446327.ps tmp/4l7oh1335446327.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 7.195 0.319 7.545