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 <- 'ATTLES all' > par8 <- 'ATTLES all' > par7 <- 'all' > par6 <- 'bachelor' > par5 <- 'all' > par4 <- 'no' > par3 <- '3' > par2 <- 'none' > par1 <- '0' > 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] 61 73 70 70 61 68 67 54 65 48 38 64 71 67 68 57 60 73 66 67 60 41 65 65 72 [26] 71 72 68 65 40 64 59 65 72 66 68 69 67 71 60 54 50 59 72 63 62 58 67 71 63 [51] 66 73 67 75 68 58 70 51 57 74 70 53 85 65 71 67 73 61 69 66 64 76 72 64 72 [76] 68 75 70 70 70 67 67 67 67 68 69 72 65 56 68 57 67 67 65 65 67 71 72 67 71 [101] 38 69 47 67 55 71 76 74 59 73 63 53 69 71 70 45 64 54 62 63 73 76 67 64 68 [126] 63 70 63 66 64 56 65 70 72 72 60 70 62 78 70 65 68 75 81 67 67 68 78 76 78 [151] 78 58 78 76 79 80 61 81 73 62 73 66 76 68 86 79 58 58 80 76 64 64 66 74 72 [176] 75 71 78 69 78 72 77 72 81 76 69 65 69 68 68 67 72 64 68 73 71 76 76 60 71 [201] 66 73 77 68 81 66 54 68 68 65 77 67 77 74 95 72 61 75 78 65 82 62 72 71 72 [226] 69 68 72 76 65 77 76 75 77 69 78 79 73 75 57 65 54 74 75 59 77 84 65 67 66 [251] 71 67 80 65 69 74 78 67 77 61 61 63 67 77 52 71 71 62 74 65 67 62 70 73 73 [276] 68 67 68 61 66 67 60 75 66 76 72 69 60 74 71 73 78 80 75 66 73 46 72 73 80 [301] 70 67 73 64 76 54 60 69 71 69 69 65 74 87 65 89 68 66 66 65 67 72 81 69 74 [326] 72 78 70 64 69 62 67 77 59 77 68 59 75 72 80 75 50 70 68 69 66 48 66 50 64 [351] 67 68 70 64 54 76 71 76 81 60 73 72 63 76 83 69 71 71 63 66 65 63 66 81 66 [376] 66 66 64 66 62 60 74 72 75 63 67 62 64 79 78 61 69 66 69 67 76 67 81 65 80 [401] 75 59 73 71 54 71 81 81 66 64 69 71 69 70 75 64 82 66 83 78 62 60 73 63 69 [426] 70 67 74 61 81 73 78 66 58 60 47 62 61 74 65 39 65 87 66 67 72 > 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 39 40 41 45 46 47 48 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 2 1 1 1 1 1 2 2 3 1 1 2 8 1 2 4 6 7 12 11 12 12 18 26 28 37 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 89 95 25 24 19 24 26 21 13 15 18 11 15 4 7 11 2 2 1 1 1 2 1 1 > colnames(x) [1] "endo" "A1" "A2" "A3" "A4" "A5" "A6" "A7" "A8" "A9" [11] "A10" "A11" "A12" "A13" "A14" "A15" "A16" "A17" "A18" "A19" [21] "A20" > colnames(x)[par1] [1] "endo" > x[,par1] [1] 61 73 70 70 61 68 67 54 65 48 38 64 71 67 68 57 60 73 66 67 60 41 65 65 72 [26] 71 72 68 65 40 64 59 65 72 66 68 69 67 71 60 54 50 59 72 63 62 58 67 71 63 [51] 66 73 67 75 68 58 70 51 57 74 70 53 85 65 71 67 73 61 69 66 64 76 72 64 72 [76] 68 75 70 70 70 67 67 67 67 68 69 72 65 56 68 57 67 67 65 65 67 71 72 67 71 [101] 38 69 47 67 55 71 76 74 59 73 63 53 69 71 70 45 64 54 62 63 73 76 67 64 68 [126] 63 70 63 66 64 56 65 70 72 72 60 70 62 78 70 65 68 75 81 67 67 68 78 76 78 [151] 78 58 78 76 79 80 61 81 73 62 73 66 76 68 86 79 58 58 80 76 64 64 66 74 72 [176] 75 71 78 69 78 72 77 72 81 76 69 65 69 68 68 67 72 64 68 73 71 76 76 60 71 [201] 66 73 77 68 81 66 54 68 68 65 77 67 77 74 95 72 61 75 78 65 82 62 72 71 72 [226] 69 68 72 76 65 77 76 75 77 69 78 79 73 75 57 65 54 74 75 59 77 84 65 67 66 [251] 71 67 80 65 69 74 78 67 77 61 61 63 67 77 52 71 71 62 74 65 67 62 70 73 73 [276] 68 67 68 61 66 67 60 75 66 76 72 69 60 74 71 73 78 80 75 66 73 46 72 73 80 [301] 70 67 73 64 76 54 60 69 71 69 69 65 74 87 65 89 68 66 66 65 67 72 81 69 74 [326] 72 78 70 64 69 62 67 77 59 77 68 59 75 72 80 75 50 70 68 69 66 48 66 50 64 [351] 67 68 70 64 54 76 71 76 81 60 73 72 63 76 83 69 71 71 63 66 65 63 66 81 66 [376] 66 66 64 66 62 60 74 72 75 63 67 62 64 79 78 61 69 66 69 67 76 67 81 65 80 [401] 75 59 73 71 54 71 81 81 66 64 69 71 69 70 75 64 82 66 83 78 62 60 73 63 69 [426] 70 67 74 61 81 73 78 66 58 60 47 62 61 74 65 39 65 87 66 67 72 > 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/1m0li1337256641.tab") + } + } > m Conditional inference tree with 21 terminal nodes Response: endo Inputs: A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20 Number of observations: 446 1) A8 <= 2; criterion = 1, statistic = 147.224 2) A6 <= 3; criterion = 1, statistic = 22.66 3) A17 <= 2; criterion = 0.966, statistic = 9.843 4)* weights = 12 3) A17 > 2 5)* weights = 12 2) A6 > 3 6)* weights = 23 1) A8 > 2 7) A6 <= 3; criterion = 1, statistic = 88.325 8) A20 <= 2; criterion = 1, statistic = 36.235 9) A10 <= 3; criterion = 1, statistic = 21.995 10)* weights = 19 9) A10 > 3 11)* weights = 28 8) A20 > 2 12) A12 <= 4; criterion = 1, statistic = 20.641 13) A3 <= 3; criterion = 0.999, statistic = 16.198 14)* weights = 16 13) A3 > 3 15) A5 <= 3; criterion = 0.974, statistic = 10.348 16)* weights = 9 15) A5 > 3 17)* weights = 19 12) A12 > 4 18)* weights = 10 7) A6 > 3 19) A14 <= 4; criterion = 1, statistic = 59.87 20) A9 <= 2; criterion = 1, statistic = 43.777 21) A10 <= 3; criterion = 1, statistic = 26.772 22) A18 <= 3; criterion = 1, statistic = 17.859 23)* weights = 20 22) A18 > 3 24)* weights = 20 21) A10 > 3 25) A15 <= 3; criterion = 0.998, statistic = 15.279 26)* weights = 30 25) A15 > 3 27)* weights = 51 20) A9 > 2 28) A1 <= 4; criterion = 1, statistic = 34.358 29) A18 <= 4; criterion = 1, statistic = 27.492 30) A16 <= 3; criterion = 0.999, statistic = 17.576 31) A20 <= 3; criterion = 0.989, statistic = 11.917 32)* weights = 57 31) A20 > 3 33)* weights = 26 30) A16 > 3 34)* weights = 22 29) A18 > 4 35)* weights = 8 28) A1 > 4 36) A6 <= 4; criterion = 0.954, statistic = 9.258 37)* weights = 15 36) A6 > 4 38)* weights = 12 19) A14 > 4 39) A15 <= 3; criterion = 0.957, statistic = 9.373 40)* weights = 15 39) A15 > 3 41)* weights = 22 > postscript(file="/var/wessaorg/rcomp/tmp/2rhw51337256641.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/3iyzo1337256641.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 61 71.01961 -10.01960784 2 73 73.45455 -0.45454545 3 70 64.39130 5.60869565 4 70 68.47368 1.52631579 5 61 62.35000 -1.35000000 6 68 68.10000 -0.10000000 7 67 68.10000 -1.10000000 8 54 57.05263 -3.05263158 9 65 64.14286 0.85714286 10 48 57.50000 -9.50000000 11 38 45.50000 -7.50000000 12 64 63.75000 0.25000000 13 71 63.75000 7.25000000 14 67 68.47368 -1.47368421 15 68 68.10000 -0.10000000 16 57 57.05263 -0.05263158 17 60 64.39130 -4.39130435 18 73 73.66667 -0.66666667 19 66 67.03333 -1.03333333 20 67 68.10000 -1.10000000 21 60 57.50000 2.50000000 22 41 45.50000 -4.50000000 23 65 67.03333 -2.03333333 24 65 62.35000 2.65000000 25 72 71.01961 0.98039216 26 71 71.01961 -0.01960784 27 72 71.01961 0.98039216 28 68 68.10000 -0.10000000 29 65 64.14286 0.85714286 30 40 45.50000 -5.50000000 31 64 64.14286 -0.14285714 32 59 63.75000 -4.75000000 33 65 62.35000 2.65000000 34 72 64.39130 7.60869565 35 66 63.75000 2.25000000 36 68 73.45455 -5.45454545 37 69 73.45455 -4.45454545 38 67 72.11538 -5.11538462 39 71 68.47368 2.52631579 40 60 64.39130 -4.39130435 41 54 45.50000 8.50000000 42 50 57.50000 -7.50000000 43 59 64.14286 -5.14285714 44 72 67.03333 4.96666667 45 63 67.03333 -4.03333333 46 62 67.03333 -5.03333333 47 58 62.35000 -4.35000000 48 67 65.44444 1.55555556 49 71 71.01961 -0.01960784 50 63 62.35000 0.65000000 51 66 64.14286 1.85714286 52 73 73.45455 -0.45454545 53 67 64.39130 2.60869565 54 75 73.45455 1.54545455 55 68 62.35000 5.65000000 56 58 67.03333 -9.03333333 57 70 71.01961 -1.01960784 58 51 57.05263 -6.05263158 59 57 57.05263 -0.05263158 60 74 79.18182 -5.18181818 61 70 68.10000 1.90000000 62 53 62.35000 -9.35000000 63 85 79.66667 5.33333333 64 65 73.66667 -8.66666667 65 71 73.45455 -2.45454545 66 67 68.47368 -1.47368421 67 73 73.45455 -0.45454545 68 61 62.35000 -1.35000000 69 69 71.01961 -2.01960784 70 66 68.10000 -2.10000000 71 64 71.01961 -7.01960784 72 76 71.01961 4.98039216 73 72 71.01961 0.98039216 74 64 64.39130 -0.39130435 75 72 71.01961 0.98039216 76 68 68.10000 -0.10000000 77 75 73.45455 1.54545455 78 70 71.01961 -1.01960784 79 70 69.94737 0.05263158 80 70 72.11538 -2.11538462 81 67 69.94737 -2.94736842 82 67 68.47368 -1.47368421 83 67 68.10000 -1.10000000 84 67 71.01961 -4.01960784 85 68 65.44444 2.55555556 86 69 73.45455 -4.45454545 87 72 73.45455 -1.45454545 88 65 69.94737 -4.94736842 89 56 57.05263 -1.05263158 90 68 65.44444 2.55555556 91 57 62.35000 -5.35000000 92 67 71.01961 -4.01960784 93 67 68.47368 -1.47368421 94 65 67.03333 -2.03333333 95 65 71.01961 -6.01960784 96 67 62.35000 4.65000000 97 71 67.03333 3.96666667 98 72 73.66667 -1.66666667 99 67 62.35000 4.65000000 100 71 71.01961 -0.01960784 101 38 45.50000 -7.50000000 102 69 68.47368 0.52631579 103 47 57.05263 -10.05263158 104 67 71.01961 -4.01960784 105 55 57.50000 -2.50000000 106 71 71.01961 -0.01960784 107 76 72.11538 3.88461538 108 74 72.11538 1.88461538 109 59 57.05263 1.94736842 110 73 71.01961 1.98039216 111 63 71.01961 -8.01960784 112 53 57.05263 -4.05263158 113 69 68.47368 0.52631579 114 71 69.94737 1.05263158 115 70 67.03333 2.96666667 116 45 45.50000 -0.50000000 117 64 63.75000 0.25000000 118 54 57.05263 -3.05263158 119 62 64.39130 -2.39130435 120 63 57.50000 5.50000000 121 73 73.45455 -0.45454545 122 76 73.45455 2.54545455 123 67 71.01961 -4.01960784 124 64 68.47368 -4.47368421 125 68 68.10000 -0.10000000 126 63 57.05263 5.94736842 127 70 71.01961 -1.01960784 128 63 71.01961 -8.01960784 129 66 62.35000 3.65000000 130 64 63.75000 0.25000000 131 56 62.35000 -6.35000000 132 65 68.10000 -3.10000000 133 70 73.66667 -3.66666667 134 72 73.66667 -1.66666667 135 72 79.18182 -7.18181818 136 60 62.35000 -2.35000000 137 70 64.14286 5.85714286 138 62 64.39130 -2.39130435 139 78 71.01961 6.98039216 140 70 68.47368 1.52631579 141 65 64.14286 0.85714286 142 68 71.01961 -3.01960784 143 75 79.18182 -4.18181818 144 81 79.18182 1.81818182 145 67 69.94737 -2.94736842 146 67 65.44444 1.55555556 147 68 68.47368 -0.47368421 148 78 79.66667 -1.66666667 149 76 79.66667 -3.66666667 150 78 71.01961 6.98039216 151 78 69.94737 8.05263158 152 58 65.44444 -7.44444444 153 78 73.80000 4.20000000 154 76 68.10000 7.90000000 155 79 72.11538 6.88461538 156 80 79.66667 0.33333333 157 61 67.03333 -6.03333333 158 81 79.66667 1.33333333 159 73 73.80000 -0.80000000 160 62 62.35000 -0.35000000 161 73 71.01961 1.98039216 162 66 71.01961 -5.01960784 163 76 73.66667 2.33333333 164 68 72.11538 -4.11538462 165 86 79.37500 6.62500000 166 79 79.18182 -0.18181818 167 58 64.39130 -6.39130435 168 58 64.39130 -6.39130435 169 80 73.45455 6.54545455 170 76 72.11538 3.88461538 171 64 67.03333 -3.03333333 172 64 57.50000 6.50000000 173 66 63.75000 2.25000000 174 74 71.01961 2.98039216 175 72 79.66667 -7.66666667 176 75 71.01961 3.98039216 177 71 71.01961 -0.01960784 178 78 73.66667 4.33333333 179 69 71.01961 -2.01960784 180 78 64.39130 13.60869565 181 72 67.03333 4.96666667 182 77 71.01961 5.98039216 183 72 68.47368 3.52631579 184 81 79.66667 1.33333333 185 76 73.66667 2.33333333 186 69 64.39130 4.60869565 187 65 65.44444 -0.44444444 188 69 72.11538 -3.11538462 189 68 68.47368 -0.47368421 190 68 69.94737 -1.94736842 191 67 62.35000 4.65000000 192 72 67.03333 4.96666667 193 64 67.03333 -3.03333333 194 68 68.47368 -0.47368421 195 73 72.11538 0.88461538 196 71 73.66667 -2.66666667 197 76 69.94737 6.05263158 198 76 79.18182 -3.18181818 199 60 62.35000 -2.35000000 200 71 71.01961 -0.01960784 201 66 68.10000 -2.10000000 202 73 69.94737 3.05263158 203 77 73.66667 3.33333333 204 68 64.39130 3.60869565 205 81 73.45455 7.54545455 206 66 68.10000 -2.10000000 207 54 45.50000 8.50000000 208 68 67.03333 0.96666667 209 68 69.94737 -1.94736842 210 65 64.14286 0.85714286 211 77 73.66667 3.33333333 212 67 64.14286 2.85714286 213 77 79.66667 -2.66666667 214 74 68.47368 5.52631579 215 95 79.18182 15.81818182 216 72 71.01961 0.98039216 217 61 57.50000 3.50000000 218 75 71.01961 3.98039216 219 78 69.94737 8.05263158 220 65 68.47368 -3.47368421 221 82 79.37500 2.62500000 222 62 63.75000 -1.75000000 223 72 71.01961 0.98039216 224 71 71.01961 -0.01960784 225 72 67.03333 4.96666667 226 69 67.03333 1.96666667 227 68 64.14286 3.85714286 228 72 73.80000 -1.80000000 229 76 71.01961 4.98039216 230 65 68.47368 -3.47368421 231 77 73.45455 3.54545455 232 76 73.66667 2.33333333 233 75 64.39130 10.60869565 234 77 79.18182 -2.18181818 235 69 68.47368 0.52631579 236 78 79.66667 -1.66666667 237 79 71.01961 7.98039216 238 73 73.45455 -0.45454545 239 75 71.01961 3.98039216 240 57 64.39130 -7.39130435 241 65 69.94737 -4.94736842 242 54 64.39130 -10.39130435 243 74 73.66667 0.33333333 244 75 72.11538 2.88461538 245 59 63.75000 -4.75000000 246 77 71.01961 5.98039216 247 84 74.50000 9.50000000 248 65 64.14286 0.85714286 249 67 64.14286 2.85714286 250 66 62.35000 3.65000000 251 71 67.03333 3.96666667 252 67 68.47368 -1.47368421 253 80 79.18182 0.81818182 254 65 68.47368 -3.47368421 255 69 72.11538 -3.11538462 256 74 72.11538 1.88461538 257 78 79.37500 -1.37500000 258 67 68.10000 -1.10000000 259 77 72.11538 4.88461538 260 61 64.14286 -3.14285714 261 61 64.14286 -3.14285714 262 63 57.05263 5.94736842 263 67 67.03333 -0.03333333 264 77 71.01961 5.98039216 265 52 57.50000 -5.50000000 266 71 69.94737 1.05263158 267 71 68.47368 2.52631579 268 62 63.75000 -1.75000000 269 74 73.80000 0.20000000 270 65 64.14286 0.85714286 271 67 73.80000 -6.80000000 272 62 64.39130 -2.39130435 273 70 68.47368 1.52631579 274 73 73.45455 -0.45454545 275 73 64.39130 8.60869565 276 68 68.47368 -0.47368421 277 67 65.44444 1.55555556 278 68 71.01961 -3.01960784 279 61 64.39130 -3.39130435 280 66 68.47368 -2.47368421 281 67 69.94737 -2.94736842 282 60 57.05263 2.94736842 283 75 73.80000 1.20000000 284 66 64.14286 1.85714286 285 76 79.18182 -3.18181818 286 72 74.50000 -2.50000000 287 69 69.94737 -0.94736842 288 60 57.05263 2.94736842 289 74 79.18182 -5.18181818 290 71 67.03333 3.96666667 291 73 72.11538 0.88461538 292 78 73.80000 4.20000000 293 80 73.45455 6.54545455 294 75 73.80000 1.20000000 295 66 68.47368 -2.47368421 296 73 74.50000 -1.50000000 297 46 45.50000 0.50000000 298 72 79.18182 -7.18181818 299 73 73.80000 -0.80000000 300 80 79.18182 0.81818182 301 70 64.14286 5.85714286 302 67 69.94737 -2.94736842 303 73 79.37500 -6.37500000 304 64 68.47368 -4.47368421 305 76 74.50000 1.50000000 306 54 45.50000 8.50000000 307 60 68.47368 -8.47368421 308 69 67.03333 1.96666667 309 71 68.47368 2.52631579 310 69 71.01961 -2.01960784 311 69 71.01961 -2.01960784 312 65 64.14286 0.85714286 313 74 68.10000 5.90000000 314 87 79.66667 7.33333333 315 65 64.39130 0.60869565 316 89 79.18182 9.81818182 317 68 68.47368 -0.47368421 318 66 67.03333 -1.03333333 319 66 72.11538 -6.11538462 320 65 64.14286 0.85714286 321 67 68.47368 -1.47368421 322 72 68.47368 3.52631579 323 81 79.18182 1.81818182 324 69 68.47368 0.52631579 325 74 79.66667 -5.66666667 326 72 68.47368 3.52631579 327 78 79.18182 -1.18181818 328 70 68.10000 1.90000000 329 64 64.14286 -0.14285714 330 69 68.47368 0.52631579 331 62 64.14286 -2.14285714 332 67 71.01961 -4.01960784 333 77 73.66667 3.33333333 334 59 67.03333 -8.03333333 335 77 73.80000 3.20000000 336 68 68.47368 -0.47368421 337 59 64.14286 -5.14285714 338 75 68.47368 6.52631579 339 72 68.47368 3.52631579 340 80 79.37500 0.62500000 341 75 68.47368 6.52631579 342 50 57.05263 -7.05263158 343 70 68.47368 1.52631579 344 68 67.03333 0.96666667 345 69 68.47368 0.52631579 346 66 67.03333 -1.03333333 347 48 57.50000 -9.50000000 348 66 67.03333 -1.03333333 349 50 45.50000 4.50000000 350 64 57.05263 6.94736842 351 67 72.11538 -5.11538462 352 68 73.45455 -5.45454545 353 70 73.80000 -3.80000000 354 64 68.47368 -4.47368421 355 54 57.05263 -3.05263158 356 76 79.18182 -3.18181818 357 71 72.11538 -1.11538462 358 76 74.50000 1.50000000 359 81 79.18182 1.81818182 360 60 64.14286 -4.14285714 361 73 71.01961 1.98039216 362 72 73.80000 -1.80000000 363 63 64.14286 -1.14285714 364 76 72.11538 3.88461538 365 83 79.18182 3.81818182 366 69 68.47368 0.52631579 367 71 68.47368 2.52631579 368 71 73.66667 -2.66666667 369 63 63.75000 -0.75000000 370 66 63.75000 2.25000000 371 65 64.14286 0.85714286 372 63 67.03333 -4.03333333 373 66 74.50000 -8.50000000 374 81 73.80000 7.20000000 375 66 68.47368 -2.47368421 376 66 68.10000 -2.10000000 377 66 68.47368 -2.47368421 378 64 57.50000 6.50000000 379 66 68.47368 -2.47368421 380 62 64.14286 -2.14285714 381 60 64.39130 -4.39130435 382 74 72.11538 1.88461538 383 72 68.47368 3.52631579 384 75 68.47368 6.52631579 385 63 68.47368 -5.47368421 386 67 72.11538 -5.11538462 387 62 65.44444 -3.44444444 388 64 68.47368 -4.47368421 389 79 79.18182 -0.18181818 390 78 68.47368 9.52631579 391 61 64.14286 -3.14285714 392 69 72.11538 -3.11538462 393 66 68.47368 -2.47368421 394 69 68.47368 0.52631579 395 67 69.94737 -2.94736842 396 76 69.94737 6.05263158 397 67 65.44444 1.55555556 398 81 74.50000 6.50000000 399 65 67.03333 -2.03333333 400 80 71.01961 8.98039216 401 75 67.03333 7.96666667 402 59 64.39130 -5.39130435 403 73 73.45455 -0.45454545 404 71 67.03333 3.96666667 405 54 57.05263 -3.05263158 406 71 68.47368 2.52631579 407 81 72.11538 8.88461538 408 81 79.37500 1.62500000 409 66 71.01961 -5.01960784 410 64 63.75000 0.25000000 411 69 72.11538 -3.11538462 412 71 72.11538 -1.11538462 413 69 73.80000 -4.80000000 414 70 68.47368 1.52631579 415 75 68.10000 6.90000000 416 64 57.50000 6.50000000 417 82 79.37500 2.62500000 418 66 73.45455 -7.45454545 419 83 79.18182 3.81818182 420 78 73.45455 4.54545455 421 62 57.05263 4.94736842 422 60 68.47368 -8.47368421 423 73 79.37500 -6.37500000 424 63 62.35000 0.65000000 425 69 68.47368 0.52631579 426 70 72.11538 -2.11538462 427 67 63.75000 3.25000000 428 74 72.11538 1.88461538 429 61 64.14286 -3.14285714 430 81 79.18182 1.81818182 431 73 73.80000 -0.80000000 432 78 74.50000 3.50000000 433 66 69.94737 -3.94736842 434 58 63.75000 -5.75000000 435 60 68.10000 -8.10000000 436 47 45.50000 1.50000000 437 62 62.35000 -0.35000000 438 61 57.50000 3.50000000 439 74 74.50000 -0.50000000 440 65 74.50000 -9.50000000 441 39 45.50000 -6.50000000 442 65 63.75000 1.25000000 443 87 79.66667 7.33333333 444 66 57.05263 8.94736842 445 67 64.39130 2.60869565 446 72 71.01961 0.98039216 > 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/45y3k1337256641.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/54nnk1337256641.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/6uu0g1337256641.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/7tew41337256641.tab") + } > > try(system("convert tmp/2rhw51337256641.ps tmp/2rhw51337256641.png",intern=TRUE)) character(0) > try(system("convert tmp/3iyzo1337256641.ps tmp/3iyzo1337256641.png",intern=TRUE)) character(0) > try(system("convert tmp/45y3k1337256641.ps tmp/45y3k1337256641.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 8.745 0.333 9.076