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 = 'Learning Activities' > par8 = 'CSUQ' > par7 = 'all' > par6 = 'all' > par5 = 'all' > par4 = 'no' > par3 = '3' > par2 = 'none' > par1 = '0' > par9 <- 'Learning Activities' > 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] 12560.83 6746.34 11056.59 9605.04 9115.56 8805.95 12362.59 9692.11 [9] 7445.25 10211.75 18789.55 11412.21 12557.85 13530.69 9906.74 9958.71 [17] 14131.19 10637.98 9859.07 14214.23 11619.05 33644.96 10267.25 11146.33 [25] 11351.47 18802.43 5241.00 13003.97 18688.75 17945.88 16213.12 9462.53 [33] 12839.24 6908.18 9877.23 10827.25 7485.87 18584.87 9530.23 18205.97 [41] 6135.08 4551.83 7490.62 13299.30 12630.98 10972.35 17193.02 13588.91 [49] 13512.24 17165.86 10009.17 6195.69 24073.53 7659.05 13109.34 13021.66 [57] 6454.77 6618.49 11773.48 32946.36 18620.94 10339.72 11123.14 10573.35 [65] 12378.91 1455.68 11423.97 8271.05 12710.27 11346.25 14125.54 9564.64 [73] 16131.85 6925.63 6136.46 7767.91 13043.98 12884.31 18401.78 17015.07 [81] 9622.88 8248.46 11913.11 11662.12 25701.67 7601.09 11351.18 12510.82 [89] 22073.74 10929.10 11205.42 16889.56 11089.44 12054.64 19061.32 13629.67 [97] 7570.85 11334.08 12604.63 11378.53 7912.75 11526.61 9656.56 18940.15 [105] 6899.68 9994.28 8914.54 6238.01 12121.61 16230.96 10035.41 8083.75 [113] 9688.36 13803.76 18126.89 10129.26 13696.76 7444.32 14591.69 8870.34 [121] 9752.65 6179.84 7683.23 10226.02 7141.96 17394.27 14159.91 8975.82 [129] 9635.52 10485.31 9096.53 13043.26 17338.59 8228.39 7967.82 11613.87 [137] 11392.94 14565.62 8315.49 15474.53 15740.78 8821.30 9649.98 12950.09 [145] 11025.41 9762.97 10007.32 14456.69 312.32 8000.23 12871.94 12670.05 [153] 10142.82 10443.82 10070.77 12364.37 7685.11 16068.91 4260.96 4263.65 [161] 8652.82 9808.16 6106.86 9756.57 17509.51 7451.38 7559.88 9480.00 [169] 9447.65 17281.48 10012.88 14942.56 5679.41 10118.75 9826.74 11758.49 [177] 9503.11 3928.27 9389.23 20683.24 6783.19 2078.30 8665.67 14167.73 [185] 11099.22 12040.95 7242.24 19323.43 4380.05 5643.24 3626.59 14639.78 [193] 906.04 14625.77 6894.78 12805.95 7642.43 8562.89 8514.39 19226.29 [201] 5641.34 8592.50 8005.46 15285.88 8228.67 7955.02 7690.87 8254.53 [209] 15101.56 13953.02 13104.85 5915.81 5504.23 10692.69 9730.57 12431.05 [217] 10350.38 8117.73 7404.66 > 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]) 312.32 906.04 1455.68 2078.3 3626.59 3928.27 4260.96 4263.65 1 1 1 1 1 1 1 1 4380.05 4551.83 5241 5504.23 5641.34 5643.24 5679.41 5915.81 1 1 1 1 1 1 1 1 6106.86 6135.08 6136.46 6179.84 6195.69 6238.01 6454.77 6618.49 1 1 1 1 1 1 1 1 6746.34 6783.19 6894.78 6899.68 6908.18 6925.63 7141.96 7242.24 1 1 1 1 1 1 1 1 7404.66 7444.32 7445.25 7451.38 7485.87 7490.62 7559.88 7570.85 1 1 1 1 1 1 1 1 7601.09 7642.43 7659.05 7683.23 7685.11 7690.87 7767.91 7912.75 1 1 1 1 1 1 1 1 7955.02 7967.82 8000.23 8005.46 8083.75 8117.73 8228.39 8228.67 1 1 1 1 1 1 1 1 8248.46 8254.53 8271.05 8315.49 8514.39 8562.89 8592.5 8652.82 1 1 1 1 1 1 1 1 8665.67 8805.95 8821.3 8870.34 8914.54 8975.82 9096.53 9115.56 1 1 1 1 1 1 1 1 9389.23 9447.65 9462.53 9480 9503.11 9530.23 9564.64 9605.04 1 1 1 1 1 1 1 1 9622.88 9635.52 9649.98 9656.56 9688.36 9692.11 9730.57 9752.65 1 1 1 1 1 1 1 1 9756.57 9762.97 9808.16 9826.74 9859.07 9877.23 9906.74 9958.71 1 1 1 1 1 1 1 1 9994.28 10007.32 10009.17 10012.88 10035.41 10070.77 10118.75 10129.26 1 1 1 1 1 1 1 1 10142.82 10211.75 10226.02 10267.25 10339.72 10350.38 10443.82 10485.31 1 1 1 1 1 1 1 1 10573.35 10637.98 10692.69 10827.25 10929.1 10972.35 11025.41 11056.59 1 1 1 1 1 1 1 1 11089.44 11099.22 11123.14 11146.33 11205.42 11334.08 11346.25 11351.18 1 1 1 1 1 1 1 1 11351.47 11378.53 11392.94 11412.21 11423.97 11526.61 11613.87 11619.05 1 1 1 1 1 1 1 1 11662.12 11758.49 11773.48 11913.11 12040.95 12054.64 12121.61 12362.59 1 1 1 1 1 1 1 1 12364.37 12378.91 12431.05 12510.82 12557.85 12560.83 12604.63 12630.98 1 1 1 1 1 1 1 1 12670.05 12710.27 12805.95 12839.24 12871.94 12884.31 12950.09 13003.97 1 1 1 1 1 1 1 1 13021.66 13043.26 13043.98 13104.85 13109.34 13299.3 13512.24 13530.69 1 1 1 1 1 1 1 1 13588.91 13629.67 13696.76 13803.76 13953.02 14125.54 14131.19 14159.91 1 1 1 1 1 1 1 1 14167.73 14214.23 14456.69 14565.62 14591.69 14625.77 14639.78 14942.56 1 1 1 1 1 1 1 1 15101.56 15285.88 15474.53 15740.78 16068.91 16131.85 16213.12 16230.96 1 1 1 1 1 1 1 1 16889.56 17015.07 17165.86 17193.02 17281.48 17338.59 17394.27 17509.51 1 1 1 1 1 1 1 1 17945.88 18126.89 18205.97 18401.78 18584.87 18620.94 18688.75 18789.55 1 1 1 1 1 1 1 1 18802.43 18940.15 19061.32 19226.29 19323.43 20683.24 22073.74 24073.53 1 1 1 1 1 1 1 1 25701.67 32946.36 33644.96 1 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] 12560.83 6746.34 11056.59 9605.04 9115.56 8805.95 12362.59 9692.11 [9] 7445.25 10211.75 18789.55 11412.21 12557.85 13530.69 9906.74 9958.71 [17] 14131.19 10637.98 9859.07 14214.23 11619.05 33644.96 10267.25 11146.33 [25] 11351.47 18802.43 5241.00 13003.97 18688.75 17945.88 16213.12 9462.53 [33] 12839.24 6908.18 9877.23 10827.25 7485.87 18584.87 9530.23 18205.97 [41] 6135.08 4551.83 7490.62 13299.30 12630.98 10972.35 17193.02 13588.91 [49] 13512.24 17165.86 10009.17 6195.69 24073.53 7659.05 13109.34 13021.66 [57] 6454.77 6618.49 11773.48 32946.36 18620.94 10339.72 11123.14 10573.35 [65] 12378.91 1455.68 11423.97 8271.05 12710.27 11346.25 14125.54 9564.64 [73] 16131.85 6925.63 6136.46 7767.91 13043.98 12884.31 18401.78 17015.07 [81] 9622.88 8248.46 11913.11 11662.12 25701.67 7601.09 11351.18 12510.82 [89] 22073.74 10929.10 11205.42 16889.56 11089.44 12054.64 19061.32 13629.67 [97] 7570.85 11334.08 12604.63 11378.53 7912.75 11526.61 9656.56 18940.15 [105] 6899.68 9994.28 8914.54 6238.01 12121.61 16230.96 10035.41 8083.75 [113] 9688.36 13803.76 18126.89 10129.26 13696.76 7444.32 14591.69 8870.34 [121] 9752.65 6179.84 7683.23 10226.02 7141.96 17394.27 14159.91 8975.82 [129] 9635.52 10485.31 9096.53 13043.26 17338.59 8228.39 7967.82 11613.87 [137] 11392.94 14565.62 8315.49 15474.53 15740.78 8821.30 9649.98 12950.09 [145] 11025.41 9762.97 10007.32 14456.69 312.32 8000.23 12871.94 12670.05 [153] 10142.82 10443.82 10070.77 12364.37 7685.11 16068.91 4260.96 4263.65 [161] 8652.82 9808.16 6106.86 9756.57 17509.51 7451.38 7559.88 9480.00 [169] 9447.65 17281.48 10012.88 14942.56 5679.41 10118.75 9826.74 11758.49 [177] 9503.11 3928.27 9389.23 20683.24 6783.19 2078.30 8665.67 14167.73 [185] 11099.22 12040.95 7242.24 19323.43 4380.05 5643.24 3626.59 14639.78 [193] 906.04 14625.77 6894.78 12805.95 7642.43 8562.89 8514.39 19226.29 [201] 5641.34 8592.50 8005.46 15285.88 8228.67 7955.02 7690.87 8254.53 [209] 15101.56 13953.02 13104.85 5915.81 5504.23 10692.69 9730.57 12431.05 [217] 10350.38 8117.73 7404.66 > 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/1mpva1337263588.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: 219 1)* weights = 219 > postscript(file="/var/wessaorg/rcomp/tmp/2ecu21337263588.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/3yqnt1337263588.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 12560.83 11206.36 1.354466e+03 2 6746.34 11206.36 -4.460024e+03 3 11056.59 11206.36 -1.497743e+02 4 9605.04 11206.36 -1.601324e+03 5 9115.56 11206.36 -2.090804e+03 6 8805.95 11206.36 -2.400414e+03 7 12362.59 11206.36 1.156226e+03 8 9692.11 11206.36 -1.514254e+03 9 7445.25 11206.36 -3.761114e+03 10 10211.75 11206.36 -9.946143e+02 11 18789.55 11206.36 7.583186e+03 12 11412.21 11206.36 2.058457e+02 13 12557.85 11206.36 1.351486e+03 14 13530.69 11206.36 2.324326e+03 15 9906.74 11206.36 -1.299624e+03 16 9958.71 11206.36 -1.247654e+03 17 14131.19 11206.36 2.924826e+03 18 10637.98 11206.36 -5.683843e+02 19 9859.07 11206.36 -1.347294e+03 20 14214.23 11206.36 3.007866e+03 21 11619.05 11206.36 4.126857e+02 22 33644.96 11206.36 2.243860e+04 23 10267.25 11206.36 -9.391143e+02 24 11146.33 11206.36 -6.003434e+01 25 11351.47 11206.36 1.451057e+02 26 18802.43 11206.36 7.596066e+03 27 5241.00 11206.36 -5.965364e+03 28 13003.97 11206.36 1.797606e+03 29 18688.75 11206.36 7.482386e+03 30 17945.88 11206.36 6.739516e+03 31 16213.12 11206.36 5.006756e+03 32 9462.53 11206.36 -1.743834e+03 33 12839.24 11206.36 1.632876e+03 34 6908.18 11206.36 -4.298184e+03 35 9877.23 11206.36 -1.329134e+03 36 10827.25 11206.36 -3.791143e+02 37 7485.87 11206.36 -3.720494e+03 38 18584.87 11206.36 7.378506e+03 39 9530.23 11206.36 -1.676134e+03 40 18205.97 11206.36 6.999606e+03 41 6135.08 11206.36 -5.071284e+03 42 4551.83 11206.36 -6.654534e+03 43 7490.62 11206.36 -3.715744e+03 44 13299.30 11206.36 2.092936e+03 45 12630.98 11206.36 1.424616e+03 46 10972.35 11206.36 -2.340143e+02 47 17193.02 11206.36 5.986656e+03 48 13588.91 11206.36 2.382546e+03 49 13512.24 11206.36 2.305876e+03 50 17165.86 11206.36 5.959496e+03 51 10009.17 11206.36 -1.197194e+03 52 6195.69 11206.36 -5.010674e+03 53 24073.53 11206.36 1.286717e+04 54 7659.05 11206.36 -3.547314e+03 55 13109.34 11206.36 1.902976e+03 56 13021.66 11206.36 1.815296e+03 57 6454.77 11206.36 -4.751594e+03 58 6618.49 11206.36 -4.587874e+03 59 11773.48 11206.36 5.671157e+02 60 32946.36 11206.36 2.174000e+04 61 18620.94 11206.36 7.414576e+03 62 10339.72 11206.36 -8.666443e+02 63 11123.14 11206.36 -8.322434e+01 64 10573.35 11206.36 -6.330143e+02 65 12378.91 11206.36 1.172546e+03 66 1455.68 11206.36 -9.750684e+03 67 11423.97 11206.36 2.176057e+02 68 8271.05 11206.36 -2.935314e+03 69 12710.27 11206.36 1.503906e+03 70 11346.25 11206.36 1.398857e+02 71 14125.54 11206.36 2.919176e+03 72 9564.64 11206.36 -1.641724e+03 73 16131.85 11206.36 4.925486e+03 74 6925.63 11206.36 -4.280734e+03 75 6136.46 11206.36 -5.069904e+03 76 7767.91 11206.36 -3.438454e+03 77 13043.98 11206.36 1.837616e+03 78 12884.31 11206.36 1.677946e+03 79 18401.78 11206.36 7.195416e+03 80 17015.07 11206.36 5.808706e+03 81 9622.88 11206.36 -1.583484e+03 82 8248.46 11206.36 -2.957904e+03 83 11913.11 11206.36 7.067457e+02 84 11662.12 11206.36 4.557557e+02 85 25701.67 11206.36 1.449531e+04 86 7601.09 11206.36 -3.605274e+03 87 11351.18 11206.36 1.448157e+02 88 12510.82 11206.36 1.304456e+03 89 22073.74 11206.36 1.086738e+04 90 10929.10 11206.36 -2.772643e+02 91 11205.42 11206.36 -9.443379e-01 92 16889.56 11206.36 5.683196e+03 93 11089.44 11206.36 -1.169243e+02 94 12054.64 11206.36 8.482757e+02 95 19061.32 11206.36 7.854956e+03 96 13629.67 11206.36 2.423306e+03 97 7570.85 11206.36 -3.635514e+03 98 11334.08 11206.36 1.277157e+02 99 12604.63 11206.36 1.398266e+03 100 11378.53 11206.36 1.721657e+02 101 7912.75 11206.36 -3.293614e+03 102 11526.61 11206.36 3.202457e+02 103 9656.56 11206.36 -1.549804e+03 104 18940.15 11206.36 7.733786e+03 105 6899.68 11206.36 -4.306684e+03 106 9994.28 11206.36 -1.212084e+03 107 8914.54 11206.36 -2.291824e+03 108 6238.01 11206.36 -4.968354e+03 109 12121.61 11206.36 9.152457e+02 110 16230.96 11206.36 5.024596e+03 111 10035.41 11206.36 -1.170954e+03 112 8083.75 11206.36 -3.122614e+03 113 9688.36 11206.36 -1.518004e+03 114 13803.76 11206.36 2.597396e+03 115 18126.89 11206.36 6.920526e+03 116 10129.26 11206.36 -1.077104e+03 117 13696.76 11206.36 2.490396e+03 118 7444.32 11206.36 -3.762044e+03 119 14591.69 11206.36 3.385326e+03 120 8870.34 11206.36 -2.336024e+03 121 9752.65 11206.36 -1.453714e+03 122 6179.84 11206.36 -5.026524e+03 123 7683.23 11206.36 -3.523134e+03 124 10226.02 11206.36 -9.803443e+02 125 7141.96 11206.36 -4.064404e+03 126 17394.27 11206.36 6.187906e+03 127 14159.91 11206.36 2.953546e+03 128 8975.82 11206.36 -2.230544e+03 129 9635.52 11206.36 -1.570844e+03 130 10485.31 11206.36 -7.210543e+02 131 9096.53 11206.36 -2.109834e+03 132 13043.26 11206.36 1.836896e+03 133 17338.59 11206.36 6.132226e+03 134 8228.39 11206.36 -2.977974e+03 135 7967.82 11206.36 -3.238544e+03 136 11613.87 11206.36 4.075057e+02 137 11392.94 11206.36 1.865757e+02 138 14565.62 11206.36 3.359256e+03 139 8315.49 11206.36 -2.890874e+03 140 15474.53 11206.36 4.268166e+03 141 15740.78 11206.36 4.534416e+03 142 8821.30 11206.36 -2.385064e+03 143 9649.98 11206.36 -1.556384e+03 144 12950.09 11206.36 1.743726e+03 145 11025.41 11206.36 -1.809543e+02 146 9762.97 11206.36 -1.443394e+03 147 10007.32 11206.36 -1.199044e+03 148 14456.69 11206.36 3.250326e+03 149 312.32 11206.36 -1.089404e+04 150 8000.23 11206.36 -3.206134e+03 151 12871.94 11206.36 1.665576e+03 152 12670.05 11206.36 1.463686e+03 153 10142.82 11206.36 -1.063544e+03 154 10443.82 11206.36 -7.625443e+02 155 10070.77 11206.36 -1.135594e+03 156 12364.37 11206.36 1.158006e+03 157 7685.11 11206.36 -3.521254e+03 158 16068.91 11206.36 4.862546e+03 159 4260.96 11206.36 -6.945404e+03 160 4263.65 11206.36 -6.942714e+03 161 8652.82 11206.36 -2.553544e+03 162 9808.16 11206.36 -1.398204e+03 163 6106.86 11206.36 -5.099504e+03 164 9756.57 11206.36 -1.449794e+03 165 17509.51 11206.36 6.303146e+03 166 7451.38 11206.36 -3.754984e+03 167 7559.88 11206.36 -3.646484e+03 168 9480.00 11206.36 -1.726364e+03 169 9447.65 11206.36 -1.758714e+03 170 17281.48 11206.36 6.075116e+03 171 10012.88 11206.36 -1.193484e+03 172 14942.56 11206.36 3.736196e+03 173 5679.41 11206.36 -5.526954e+03 174 10118.75 11206.36 -1.087614e+03 175 9826.74 11206.36 -1.379624e+03 176 11758.49 11206.36 5.521257e+02 177 9503.11 11206.36 -1.703254e+03 178 3928.27 11206.36 -7.278094e+03 179 9389.23 11206.36 -1.817134e+03 180 20683.24 11206.36 9.476876e+03 181 6783.19 11206.36 -4.423174e+03 182 2078.30 11206.36 -9.128064e+03 183 8665.67 11206.36 -2.540694e+03 184 14167.73 11206.36 2.961366e+03 185 11099.22 11206.36 -1.071443e+02 186 12040.95 11206.36 8.345857e+02 187 7242.24 11206.36 -3.964124e+03 188 19323.43 11206.36 8.117066e+03 189 4380.05 11206.36 -6.826314e+03 190 5643.24 11206.36 -5.563124e+03 191 3626.59 11206.36 -7.579774e+03 192 14639.78 11206.36 3.433416e+03 193 906.04 11206.36 -1.030032e+04 194 14625.77 11206.36 3.419406e+03 195 6894.78 11206.36 -4.311584e+03 196 12805.95 11206.36 1.599586e+03 197 7642.43 11206.36 -3.563934e+03 198 8562.89 11206.36 -2.643474e+03 199 8514.39 11206.36 -2.691974e+03 200 19226.29 11206.36 8.019926e+03 201 5641.34 11206.36 -5.565024e+03 202 8592.50 11206.36 -2.613864e+03 203 8005.46 11206.36 -3.200904e+03 204 15285.88 11206.36 4.079516e+03 205 8228.67 11206.36 -2.977694e+03 206 7955.02 11206.36 -3.251344e+03 207 7690.87 11206.36 -3.515494e+03 208 8254.53 11206.36 -2.951834e+03 209 15101.56 11206.36 3.895196e+03 210 13953.02 11206.36 2.746656e+03 211 13104.85 11206.36 1.898486e+03 212 5915.81 11206.36 -5.290554e+03 213 5504.23 11206.36 -5.702134e+03 214 10692.69 11206.36 -5.136743e+02 215 9730.57 11206.36 -1.475794e+03 216 12431.05 11206.36 1.224686e+03 217 10350.38 11206.36 -8.559843e+02 218 8117.73 11206.36 -3.088634e+03 219 7404.66 11206.36 -3.801704e+03 > 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/4knvh1337263588.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/5dq4t1337263588.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/6ruu21337263588.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/7y00p1337263588.tab") + } > > try(system("convert tmp/2ecu21337263588.ps tmp/2ecu21337263588.png",intern=TRUE)) character(0) > try(system("convert tmp/3yqnt1337263588.ps tmp/3yqnt1337263588.png",intern=TRUE)) character(0) > try(system("convert tmp/4knvh1337263588.ps tmp/4knvh1337263588.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.878 0.303 4.181