R version 2.12.1 (2010-12-16) Copyright (C) 2010 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. > x <- array(list(41 + ,38 + ,14 + ,12 + ,39 + ,32 + ,18 + ,11 + ,30 + ,35 + ,11 + ,14 + ,31 + ,33 + ,12 + ,12 + ,34 + ,37 + ,16 + ,21 + ,35 + ,29 + ,18 + ,12 + ,39 + ,31 + ,14 + ,22 + ,34 + ,36 + ,14 + ,11 + ,36 + ,35 + ,15 + ,10 + ,37 + ,38 + ,15 + ,13 + ,38 + ,31 + ,17 + ,10 + ,36 + ,34 + ,19 + ,8 + ,38 + ,35 + ,10 + ,15 + ,39 + ,38 + ,16 + ,14 + ,33 + ,37 + ,18 + ,10 + ,32 + ,33 + ,14 + ,14 + ,36 + ,32 + ,14 + ,14 + ,38 + ,38 + ,17 + ,11 + ,39 + ,38 + ,14 + ,10 + ,32 + ,32 + ,16 + ,13 + ,32 + ,33 + ,18 + ,7 + ,31 + ,31 + ,11 + ,14 + ,39 + ,38 + ,14 + ,12 + ,37 + ,39 + ,12 + ,14 + ,39 + ,32 + ,17 + ,11 + ,41 + ,32 + ,9 + ,9 + ,36 + ,35 + ,16 + ,11 + ,33 + ,37 + ,14 + ,15 + ,33 + ,33 + ,15 + ,14 + ,34 + ,33 + ,11 + ,13 + ,31 + ,28 + ,16 + ,9 + ,27 + ,32 + ,13 + ,15 + ,37 + ,31 + ,17 + ,10 + ,34 + ,37 + ,15 + ,11 + ,34 + ,30 + ,14 + ,13 + ,32 + ,33 + ,16 + ,8 + ,29 + ,31 + ,9 + ,20 + ,36 + ,33 + ,15 + ,12 + ,29 + ,31 + ,17 + ,10 + ,35 + ,33 + ,13 + ,10 + ,37 + ,32 + ,15 + ,9 + ,34 + ,33 + ,16 + ,14 + ,38 + ,32 + ,16 + ,8 + ,35 + ,33 + ,12 + ,14 + ,38 + ,28 + ,12 + ,11 + ,37 + ,35 + ,11 + ,13 + ,38 + ,39 + ,15 + ,9 + ,33 + ,34 + ,15 + ,11 + ,36 + ,38 + ,17 + ,15 + ,38 + ,32 + ,13 + ,11 + ,32 + ,38 + ,16 + ,10 + ,32 + ,30 + ,14 + ,14 + ,32 + ,33 + ,11 + ,18 + ,34 + ,38 + ,12 + ,14 + ,32 + ,32 + ,12 + ,11 + ,37 + ,32 + ,15 + ,12 + ,39 + ,34 + ,16 + ,13 + ,29 + ,34 + ,15 + ,9 + ,37 + ,36 + ,12 + ,10 + ,35 + ,34 + ,12 + ,15 + ,30 + ,28 + ,8 + ,20 + ,38 + ,34 + ,13 + ,12 + ,34 + ,35 + ,11 + ,12 + ,31 + ,35 + ,14 + ,14 + ,34 + ,31 + ,15 + ,13 + ,35 + ,37 + ,10 + ,11 + ,36 + ,35 + ,11 + ,17 + ,30 + ,27 + ,12 + ,12 + ,39 + ,40 + ,15 + ,13 + ,35 + ,37 + ,15 + ,14 + ,38 + ,36 + ,14 + ,13 + ,31 + ,38 + ,16 + ,15 + ,34 + ,39 + ,15 + ,13 + ,38 + ,41 + ,15 + ,10 + ,34 + ,27 + ,13 + ,11 + ,39 + ,30 + ,12 + ,19 + ,37 + ,37 + ,17 + ,13 + ,34 + ,31 + ,13 + ,17 + ,28 + ,31 + ,15 + ,13 + ,37 + ,27 + ,13 + ,9 + ,33 + ,36 + ,15 + ,11 + ,37 + ,38 + ,16 + ,10 + ,35 + ,37 + ,15 + ,9 + ,37 + ,33 + ,16 + ,12 + ,32 + ,34 + ,15 + ,12 + ,33 + ,31 + ,14 + ,13 + ,38 + ,39 + ,15 + ,13 + ,33 + ,34 + ,14 + ,12 + ,29 + ,32 + ,13 + ,15 + ,33 + ,33 + ,7 + ,22 + ,31 + ,36 + ,17 + ,13 + ,36 + ,32 + ,13 + ,15 + ,35 + ,41 + ,15 + ,13 + ,32 + ,28 + ,14 + ,15 + ,29 + ,30 + ,13 + ,10 + ,39 + ,36 + ,16 + ,11 + ,37 + ,35 + ,12 + ,16 + ,35 + ,31 + ,14 + ,11 + ,37 + ,34 + ,17 + ,11 + ,32 + ,36 + ,15 + ,10 + ,38 + ,36 + ,17 + ,10 + ,37 + ,35 + ,12 + ,16 + ,36 + ,37 + ,16 + ,12 + ,32 + ,28 + ,11 + ,11 + ,33 + ,39 + ,15 + ,16 + ,40 + ,32 + ,9 + ,19 + ,38 + ,35 + ,16 + ,11 + ,41 + ,39 + ,15 + ,16 + ,36 + ,35 + ,10 + ,15 + ,43 + ,42 + ,10 + ,24 + ,30 + ,34 + ,15 + ,14 + ,31 + ,33 + ,11 + ,15 + ,32 + ,41 + ,13 + ,11 + ,32 + ,33 + ,14 + ,15 + ,37 + ,34 + ,18 + ,12 + ,37 + ,32 + ,16 + ,10 + ,33 + ,40 + ,14 + ,14 + ,34 + ,40 + ,14 + ,13 + ,33 + ,35 + ,14 + ,9 + ,38 + ,36 + ,14 + ,15 + ,33 + ,37 + ,12 + ,15 + ,31 + ,27 + ,14 + ,14 + ,38 + ,39 + ,15 + ,11 + ,37 + ,38 + ,15 + ,8 + ,33 + ,31 + ,15 + ,11 + ,31 + ,33 + ,13 + ,11 + ,39 + ,32 + ,17 + ,8 + ,44 + ,39 + ,17 + ,10 + ,33 + ,36 + ,19 + ,11 + ,35 + ,33 + ,15 + ,13 + ,32 + ,33 + ,13 + ,11 + ,28 + ,32 + ,9 + ,20 + ,40 + ,37 + ,15 + ,10 + ,27 + ,30 + ,15 + ,15 + ,37 + ,38 + ,15 + ,12 + ,32 + ,29 + ,16 + ,14 + ,28 + ,22 + ,11 + ,23 + ,34 + ,35 + ,14 + ,14 + ,30 + ,35 + ,11 + ,16 + ,35 + ,34 + ,15 + ,11 + ,31 + ,35 + ,13 + ,12 + ,32 + ,34 + ,15 + ,10 + ,30 + ,34 + ,16 + ,14 + ,30 + ,35 + ,14 + ,12 + ,31 + ,23 + ,15 + ,12 + ,40 + ,31 + ,16 + ,11 + ,32 + ,27 + ,16 + ,12 + ,36 + ,36 + ,11 + ,13 + ,32 + ,31 + ,12 + ,11 + ,35 + ,32 + ,9 + ,19 + ,38 + ,39 + ,16 + ,12 + ,42 + ,37 + ,13 + ,17 + ,34 + ,38 + ,16 + ,9 + ,35 + ,39 + ,12 + ,12 + ,35 + ,34 + ,9 + ,19 + ,33 + ,31 + ,13 + ,18 + ,36 + ,32 + ,13 + ,15 + ,32 + ,37 + ,14 + ,14 + ,33 + ,36 + ,19 + ,11 + ,34 + ,32 + ,13 + ,9 + ,32 + ,35 + ,12 + ,18 + ,34 + ,36 + ,13 + ,16) + ,dim=c(4 + ,162) + ,dimnames=list(c('connected' + ,'seperate' + ,'hapiness' + ,'depression ') + ,1:162)) > y <- array(NA,dim=c(4,162),dimnames=list(c('connected','seperate','hapiness','depression '),1:162)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par4 = 'no' > par3 = '3' > par2 = 'none' > par1 = '2' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Dr. Ian E. Holliday > #To cite this work: Ian E. Holliday, 2009, YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: > #Technical description: > 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 <- data.frame(t(y)) > is.data.frame(x) [1] TRUE > x <- x[!is.na(x[,par1]),] > k <- length(x[1,]) > n <- length(x[,1]) > colnames(x)[par1] [1] "seperate" > x[,par1] [1] 38 32 35 33 37 29 31 36 35 38 31 34 35 38 37 33 32 38 38 32 33 31 38 39 32 [26] 32 35 37 33 33 28 32 31 37 30 33 31 33 31 33 32 33 32 33 28 35 39 34 38 32 [51] 38 30 33 38 32 32 34 34 36 34 28 34 35 35 31 37 35 27 40 37 36 38 39 41 27 [76] 30 37 31 31 27 36 38 37 33 34 31 39 34 32 33 36 32 41 28 30 36 35 31 34 36 [101] 36 35 37 28 39 32 35 39 35 42 34 33 41 33 34 32 40 40 35 36 37 27 39 38 31 [126] 33 32 39 36 33 33 32 37 30 38 29 22 35 35 34 35 34 34 35 23 31 27 36 31 32 [151] 39 37 38 39 34 31 32 37 36 32 35 36 > 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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 1 1 5 5 2 5 15 20 18 15 18 13 13 14 10 3 3 1 > colnames(x) [1] "connected" "seperate" "hapiness" "depression." > colnames(x)[par1] [1] "seperate" > x[,par1] [1] 38 32 35 33 37 29 31 36 35 38 31 34 35 38 37 33 32 38 38 32 33 31 38 39 32 [26] 32 35 37 33 33 28 32 31 37 30 33 31 33 31 33 32 33 32 33 28 35 39 34 38 32 [51] 38 30 33 38 32 32 34 34 36 34 28 34 35 35 31 37 35 27 40 37 36 38 39 41 27 [76] 30 37 31 31 27 36 38 37 33 34 31 39 34 32 33 36 32 41 28 30 36 35 31 34 36 [101] 36 35 37 28 39 32 35 39 35 42 34 33 41 33 34 32 40 40 35 36 37 27 39 38 31 [126] 33 32 39 36 33 33 32 37 30 38 29 22 35 35 34 35 34 34 35 23 31 27 36 31 32 [151] 39 37 38 39 34 31 32 37 36 32 35 36 > if (par2 == 'none') { + m <- ctree(as.formula(paste(colnames(x)[par1],' ~ .',sep='')),data = x) + } > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/www/rcomp/tmp/10vc11323872445.tab") + } + } > m Conditional inference tree with 2 terminal nodes Response: seperate Inputs: connected, hapiness, depression. Number of observations: 162 1) connected <= 32; criterion = 1, statistic = 21.822 2)* weights = 49 1) connected > 32 3)* weights = 113 > postscript(file="/var/www/rcomp/tmp/2erac1323872445.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/www/rcomp/tmp/3nlzr1323872445.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 38 34.93805 3.0619469 2 32 34.93805 -2.9380531 3 35 32.14286 2.8571429 4 33 32.14286 0.8571429 5 37 34.93805 2.0619469 6 29 34.93805 -5.9380531 7 31 34.93805 -3.9380531 8 36 34.93805 1.0619469 9 35 34.93805 0.0619469 10 38 34.93805 3.0619469 11 31 34.93805 -3.9380531 12 34 34.93805 -0.9380531 13 35 34.93805 0.0619469 14 38 34.93805 3.0619469 15 37 34.93805 2.0619469 16 33 32.14286 0.8571429 17 32 34.93805 -2.9380531 18 38 34.93805 3.0619469 19 38 34.93805 3.0619469 20 32 32.14286 -0.1428571 21 33 32.14286 0.8571429 22 31 32.14286 -1.1428571 23 38 34.93805 3.0619469 24 39 34.93805 4.0619469 25 32 34.93805 -2.9380531 26 32 34.93805 -2.9380531 27 35 34.93805 0.0619469 28 37 34.93805 2.0619469 29 33 34.93805 -1.9380531 30 33 34.93805 -1.9380531 31 28 32.14286 -4.1428571 32 32 32.14286 -0.1428571 33 31 34.93805 -3.9380531 34 37 34.93805 2.0619469 35 30 34.93805 -4.9380531 36 33 32.14286 0.8571429 37 31 32.14286 -1.1428571 38 33 34.93805 -1.9380531 39 31 32.14286 -1.1428571 40 33 34.93805 -1.9380531 41 32 34.93805 -2.9380531 42 33 34.93805 -1.9380531 43 32 34.93805 -2.9380531 44 33 34.93805 -1.9380531 45 28 34.93805 -6.9380531 46 35 34.93805 0.0619469 47 39 34.93805 4.0619469 48 34 34.93805 -0.9380531 49 38 34.93805 3.0619469 50 32 34.93805 -2.9380531 51 38 32.14286 5.8571429 52 30 32.14286 -2.1428571 53 33 32.14286 0.8571429 54 38 34.93805 3.0619469 55 32 32.14286 -0.1428571 56 32 34.93805 -2.9380531 57 34 34.93805 -0.9380531 58 34 32.14286 1.8571429 59 36 34.93805 1.0619469 60 34 34.93805 -0.9380531 61 28 32.14286 -4.1428571 62 34 34.93805 -0.9380531 63 35 34.93805 0.0619469 64 35 32.14286 2.8571429 65 31 34.93805 -3.9380531 66 37 34.93805 2.0619469 67 35 34.93805 0.0619469 68 27 32.14286 -5.1428571 69 40 34.93805 5.0619469 70 37 34.93805 2.0619469 71 36 34.93805 1.0619469 72 38 32.14286 5.8571429 73 39 34.93805 4.0619469 74 41 34.93805 6.0619469 75 27 34.93805 -7.9380531 76 30 34.93805 -4.9380531 77 37 34.93805 2.0619469 78 31 34.93805 -3.9380531 79 31 32.14286 -1.1428571 80 27 34.93805 -7.9380531 81 36 34.93805 1.0619469 82 38 34.93805 3.0619469 83 37 34.93805 2.0619469 84 33 34.93805 -1.9380531 85 34 32.14286 1.8571429 86 31 34.93805 -3.9380531 87 39 34.93805 4.0619469 88 34 34.93805 -0.9380531 89 32 32.14286 -0.1428571 90 33 34.93805 -1.9380531 91 36 32.14286 3.8571429 92 32 34.93805 -2.9380531 93 41 34.93805 6.0619469 94 28 32.14286 -4.1428571 95 30 32.14286 -2.1428571 96 36 34.93805 1.0619469 97 35 34.93805 0.0619469 98 31 34.93805 -3.9380531 99 34 34.93805 -0.9380531 100 36 32.14286 3.8571429 101 36 34.93805 1.0619469 102 35 34.93805 0.0619469 103 37 34.93805 2.0619469 104 28 32.14286 -4.1428571 105 39 34.93805 4.0619469 106 32 34.93805 -2.9380531 107 35 34.93805 0.0619469 108 39 34.93805 4.0619469 109 35 34.93805 0.0619469 110 42 34.93805 7.0619469 111 34 32.14286 1.8571429 112 33 32.14286 0.8571429 113 41 32.14286 8.8571429 114 33 32.14286 0.8571429 115 34 34.93805 -0.9380531 116 32 34.93805 -2.9380531 117 40 34.93805 5.0619469 118 40 34.93805 5.0619469 119 35 34.93805 0.0619469 120 36 34.93805 1.0619469 121 37 34.93805 2.0619469 122 27 32.14286 -5.1428571 123 39 34.93805 4.0619469 124 38 34.93805 3.0619469 125 31 34.93805 -3.9380531 126 33 32.14286 0.8571429 127 32 34.93805 -2.9380531 128 39 34.93805 4.0619469 129 36 34.93805 1.0619469 130 33 34.93805 -1.9380531 131 33 32.14286 0.8571429 132 32 32.14286 -0.1428571 133 37 34.93805 2.0619469 134 30 32.14286 -2.1428571 135 38 34.93805 3.0619469 136 29 32.14286 -3.1428571 137 22 32.14286 -10.1428571 138 35 34.93805 0.0619469 139 35 32.14286 2.8571429 140 34 34.93805 -0.9380531 141 35 32.14286 2.8571429 142 34 32.14286 1.8571429 143 34 32.14286 1.8571429 144 35 32.14286 2.8571429 145 23 32.14286 -9.1428571 146 31 34.93805 -3.9380531 147 27 32.14286 -5.1428571 148 36 34.93805 1.0619469 149 31 32.14286 -1.1428571 150 32 34.93805 -2.9380531 151 39 34.93805 4.0619469 152 37 34.93805 2.0619469 153 38 34.93805 3.0619469 154 39 34.93805 4.0619469 155 34 34.93805 -0.9380531 156 31 34.93805 -3.9380531 157 32 34.93805 -2.9380531 158 37 32.14286 4.8571429 159 36 34.93805 1.0619469 160 32 34.93805 -2.9380531 161 35 32.14286 2.8571429 162 36 34.93805 1.0619469 > if (par2 != 'none') { + print(cbind(as.factor(x[,par1]),predict(m))) + myt <- table(as.factor(x[,par1]),predict(m)) + print(myt) + } > postscript(file="/var/www/rcomp/tmp/4wldx1323872445.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/www/rcomp/tmp/592u61323872445.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/www/rcomp/tmp/6qugp1323872445.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/www/rcomp/tmp/7u3py1323872445.tab") + } > > try(system("convert tmp/2erac1323872445.ps tmp/2erac1323872445.png",intern=TRUE)) character(0) > try(system("convert tmp/3nlzr1323872445.ps tmp/3nlzr1323872445.png",intern=TRUE)) character(0) > try(system("convert tmp/4wldx1323872445.ps tmp/4wldx1323872445.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.004 0.296 8.328