R version 2.12.0 (2010-10-15) 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(1330 + ,35 + ,27 + ,37.13 + ,1030 + ,50 + ,28 + ,36.21 + ,895 + ,40 + ,28 + ,32.52 + ,1067 + ,43 + ,27 + ,32.23 + ,1321 + ,46 + ,26 + ,31.91 + ,901 + ,30 + ,23 + ,30.69 + ,1125 + ,57 + ,33 + ,30.67 + ,732 + ,34 + ,30 + ,30.29 + ,1078 + ,27 + ,23 + ,29.56 + ,1033 + ,51 + ,33 + ,29.35 + ,1135 + ,61 + ,46 + ,28.89 + ,865 + ,41 + ,28 + ,28.77 + ,870 + ,58 + ,25 + ,27.69 + ,1554 + ,42 + ,31 + ,27.34 + ,1077 + ,39 + ,22 + ,27.04 + ,1095 + ,32 + ,32 + ,25.67 + ,665 + ,49 + ,38 + ,25.2 + ,603 + ,16 + ,26 + ,25.03 + ,726 + ,43 + ,24 + ,25.01 + ,862 + ,41 + ,31 + ,24.87 + ,840 + ,56 + ,44 + ,24.81 + ,670 + ,16 + ,34 + ,23.99 + ,777 + ,45 + ,29 + ,23.87 + ,863 + ,26 + ,26 + ,23.15 + ,641 + ,44 + ,28 + ,22.9 + ,611 + ,31 + ,35 + ,22.71 + ,1010 + ,43 + ,51 + ,22.5 + ,801 + ,42 + ,20 + ,22.33 + ,589 + ,30 + ,13 + ,22.14 + ,611 + ,53 + ,29 + ,21.79 + ,706 + ,31 + ,35 + ,21.78 + ,601 + ,30 + ,40 + ,21.19 + ,631 + ,33 + ,28 + ,20.46 + ,723 + ,34 + ,38 + ,20.42 + ,623 + ,55 + ,25 + ,20.41 + ,569 + ,80 + ,22 + ,20.31 + ,640 + ,41 + ,28 + ,20.08 + ,1058 + ,38 + ,26 + ,20.08 + ,552 + ,59 + ,32 + ,19.76 + ,818 + ,37 + ,31 + ,19.73 + ,613 + ,18 + ,35 + ,19.71 + ,696 + ,37 + ,30 + ,19.59 + ,479 + ,41 + ,49 + ,19.32 + ,822 + ,25 + ,28 + ,19.28 + ,633 + ,54 + ,20 + ,19.2 + ,653 + ,47 + ,28 + ,18.95 + ,773 + ,14 + ,33 + ,18.63 + ,368 + ,43 + ,25 + ,18.48 + ,936 + ,25 + ,28 + ,18.11 + ,817 + ,55 + ,30 + ,18.01 + ,573 + ,33 + ,27 + ,17.9 + ,410 + ,33 + ,26 + ,17.9 + ,497 + ,31 + ,27 + ,17.89 + ,465 + ,25 + ,14 + ,17.76 + ,652 + ,34 + ,27 + ,17.67 + ,375 + ,19 + ,29 + ,17.58 + ,968 + ,18 + ,28 + ,17.41 + ,681 + ,39 + ,27 + ,17.24 + ,611 + ,75 + ,28 + ,16.99 + ,567 + ,51 + ,23 + ,16.95 + ,523 + ,33 + ,20 + ,16.88 + ,490 + ,45 + ,28 + ,16.85 + ,400 + ,35 + ,28 + ,16.84 + ,557 + ,38 + ,24 + ,16.78 + ,571 + ,50 + ,29 + ,16.76 + ,583 + ,32 + ,9 + ,16.7 + ,598 + ,43 + ,23 + ,16.69 + ,709 + ,42 + ,16 + ,16.69 + ,496 + ,37 + ,39 + ,16.68 + ,413 + ,13 + ,19 + ,16.53 + ,637 + ,20 + ,16 + ,16.51 + ,822 + ,10 + ,34 + ,16.2 + ,405 + ,42 + ,23 + ,16.02 + ,744 + ,25 + ,18 + ,15.84 + ,873 + ,20 + ,35 + ,15.71 + ,592 + ,26 + ,40 + ,15.4 + ,432 + ,41 + ,17 + ,15.33 + ,754 + ,37 + ,28 + ,14.95 + ,725 + ,35 + ,19 + ,14.93 + ,644 + ,14 + ,22 + ,14.78 + ,431 + ,19 + ,27 + ,14.76 + ,635 + ,16 + ,32 + ,14.46 + ,485 + ,11 + ,29 + ,14.38 + ,489 + ,19 + ,18 + ,14.06 + ,471 + ,40 + ,31 + ,14.06 + ,363 + ,17 + ,24 + ,14.03 + ,601 + ,19 + ,27 + ,13.79 + ,577 + ,18 + ,33 + ,13.77 + ,676 + ,15 + ,13 + ,13.6 + ,1058 + ,18 + ,2 + ,13.46 + ,462 + ,42 + ,11 + ,13.38 + ,387 + ,27 + ,53 + ,13.35 + ,549 + ,31 + ,24 + ,13.33 + ,529 + ,31 + ,5 + ,13.22 + ,433 + ,33 + ,9 + ,13.16 + ,553 + ,36 + ,23 + ,13.13 + ,300 + ,12 + ,34 + ,12.98 + ,474 + ,12 + ,13 + ,12.96 + ,371 + ,4 + ,29 + ,12.94 + ,462 + ,17 + ,30 + ,12.87 + ,520 + ,20 + ,24 + ,12.64 + ,450 + ,59 + ,28 + ,12.39 + ,466 + ,18 + ,22 + ,12.38 + ,427 + ,11 + ,8 + ,12.29 + ,377 + ,41 + ,35 + ,12.2 + ,459 + ,37 + ,25 + ,12.18 + ,303 + ,13 + ,35 + ,12.15 + ,549 + ,14 + ,33 + ,11.92 + ,424 + ,33 + ,32 + ,11.8 + ,581 + ,17 + ,28 + ,11.72 + ,384 + ,14 + ,26 + ,11.53 + ,442 + ,11 + ,25 + ,11.37 + ,386 + ,23 + ,22 + ,10.89 + ,362 + ,10 + ,35 + ,10.83 + ,343 + ,22 + ,19 + ,10.82 + ,458 + ,3 + ,29 + ,10.78 + ,474 + ,8 + ,19 + ,10.39 + ,526 + ,16 + ,21 + ,10.13 + ,243 + ,16 + ,35 + ,10.08 + ,320 + ,13 + ,26 + ,10.05 + ,478 + ,10 + ,25 + ,9.92 + ,606 + ,18 + ,30 + ,9.9 + ,293 + ,16 + ,31 + ,9.67 + ,378 + ,10 + ,32 + ,9.64 + ,372 + ,18 + ,10 + ,9.61 + ,314 + ,11 + ,12 + ,9.49 + ,359 + ,34 + ,9 + ,9.49 + ,434 + ,12 + ,32 + ,9.3 + ,447 + ,15 + ,17 + ,9.25 + ,563 + ,7 + ,21 + ,8.8 + ,352 + ,7 + ,17 + ,8.71 + ,393 + ,14 + ,25 + ,8.47 + ,307 + ,55 + ,16 + ,8.43 + ,474 + ,28 + ,24 + ,8.05 + ,231 + ,22 + ,15 + ,7.93 + ,394 + ,24 + ,8 + ,7.71 + ,397 + ,13 + ,34 + ,7.31 + ,343 + ,11 + ,24 + ,7.24 + ,287 + ,10 + ,27 + ,7.11 + ,281 + ,13 + ,17 + ,6.9 + ,376 + ,8 + ,7 + ,6.48 + ,227 + ,2 + ,23 + ,6.34 + ,209 + ,14 + ,3 + ,6.2 + ,413 + ,1 + ,13 + ,5.94 + ,336 + ,12 + ,0 + ,5.46 + ,224 + ,0 + ,21 + ,5.44 + ,171 + ,1 + ,11 + ,5.09 + ,417 + ,11 + ,12 + ,4.99 + ,307 + ,4 + ,0 + ,4.72 + ,147 + ,0 + ,0 + ,4.71 + ,206 + ,4 + ,0 + ,4.08 + ,214 + ,2 + ,2 + ,3.93 + ,166 + ,0 + ,7 + ,2.97 + ,76 + ,0 + ,8 + ,2.4 + ,151 + ,7 + ,0 + ,2 + ,29 + ,0 + ,0 + ,0.27 + ,8 + ,0 + ,0 + ,0.13 + ,4 + ,0 + ,0 + ,0.06 + ,5 + ,0 + ,0 + ,0.03 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0) + ,dim=c(4 + ,164) + ,dimnames=list(c('PAGES' + ,'BLOGS' + ,'LPRM' + ,'HRS') + ,1:164)) > y <- array(NA,dim=c(4,164),dimnames=list(c('PAGES','BLOGS','LPRM','HRS'),1:164)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par4 = 'yes' > par3 = '2' > par2 = 'none' > par1 = '3' > #'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] "LPRM" > x[,par1] [1] 27 28 28 27 26 23 33 30 23 33 46 28 25 31 22 32 38 26 24 31 44 34 29 26 28 [26] 35 51 20 13 29 35 40 28 38 25 22 28 26 32 31 35 30 49 28 20 28 33 25 28 30 [51] 27 26 27 14 27 29 28 27 28 23 20 28 28 24 29 9 23 16 39 19 16 34 23 18 35 [76] 40 17 28 19 22 27 32 29 18 31 24 27 33 13 2 11 53 24 5 9 23 34 13 29 30 [101] 24 28 22 8 35 25 35 33 32 28 26 25 22 35 19 29 19 21 35 26 25 30 31 32 10 [126] 12 9 32 17 21 17 25 16 24 15 8 34 24 27 17 7 23 3 13 0 21 11 12 0 0 [151] 0 2 7 8 0 0 0 0 0 0 0 0 0 0 > 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]) 0 2 3 5 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 14 2 1 1 2 3 3 1 2 2 4 1 1 3 4 2 4 3 3 5 7 7 7 7 9 16 29 30 31 32 33 34 35 38 39 40 44 46 49 51 53 7 5 5 6 5 4 8 2 1 2 1 1 1 1 1 > colnames(x) [1] "PAGES" "BLOGS" "LPRM" "HRS" > colnames(x)[par1] [1] "LPRM" > x[,par1] [1] 27 28 28 27 26 23 33 30 23 33 46 28 25 31 22 32 38 26 24 31 44 34 29 26 28 [26] 35 51 20 13 29 35 40 28 38 25 22 28 26 32 31 35 30 49 28 20 28 33 25 28 30 [51] 27 26 27 14 27 29 28 27 28 23 20 28 28 24 29 9 23 16 39 19 16 34 23 18 35 [76] 40 17 28 19 22 27 32 29 18 31 24 27 33 13 2 11 53 24 5 9 23 34 13 29 30 [101] 24 28 22 8 35 25 35 33 32 28 26 25 22 35 19 29 19 21 35 26 25 30 31 32 10 [126] 12 9 32 17 21 17 25 16 24 15 8 34 24 27 17 7 23 3 13 0 21 11 12 0 0 [151] 0 2 7 8 0 0 0 0 0 0 0 0 0 0 > 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/137jk1319053935.tab") + } + } > m Conditional inference tree with 4 terminal nodes Response: LPRM Inputs: PAGES, BLOGS, HRS Number of observations: 164 1) HRS <= 6.48; criterion = 1, statistic = 57.37 2) HRS <= 4.72; criterion = 0.989, statistic = 8.519 3)* weights = 16 2) HRS > 4.72 4)* weights = 8 1) HRS > 6.48 5) HRS <= 17.9; criterion = 0.998, statistic = 11.244 6)* weights = 90 5) HRS > 17.9 7)* weights = 50 > postscript(file="/var/www/rcomp/tmp/2yy821319053935.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/3meyo1319053935.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x[,par1] ~ as.factor(where(m)),main='Response by Terminal Node',xlab='Terminal Node',ylab='Response') > dev.off() null device 1 > if (par2 == 'none') { + forec <- predict(m) + result <- as.data.frame(cbind(x[,par1],forec,x[,par1]-forec)) + colnames(result) <- c('Actuals','Forecasts','Residuals') + print(result) + } Actuals Forecasts Residuals 1 27 30.02000 -3.02000000 2 28 30.02000 -2.02000000 3 28 30.02000 -2.02000000 4 27 30.02000 -3.02000000 5 26 30.02000 -4.02000000 6 23 30.02000 -7.02000000 7 33 30.02000 2.98000000 8 30 30.02000 -0.02000000 9 23 30.02000 -7.02000000 10 33 30.02000 2.98000000 11 46 30.02000 15.98000000 12 28 30.02000 -2.02000000 13 25 30.02000 -5.02000000 14 31 30.02000 0.98000000 15 22 30.02000 -8.02000000 16 32 30.02000 1.98000000 17 38 30.02000 7.98000000 18 26 30.02000 -4.02000000 19 24 30.02000 -6.02000000 20 31 30.02000 0.98000000 21 44 30.02000 13.98000000 22 34 30.02000 3.98000000 23 29 30.02000 -1.02000000 24 26 30.02000 -4.02000000 25 28 30.02000 -2.02000000 26 35 30.02000 4.98000000 27 51 30.02000 20.98000000 28 20 30.02000 -10.02000000 29 13 30.02000 -17.02000000 30 29 30.02000 -1.02000000 31 35 30.02000 4.98000000 32 40 30.02000 9.98000000 33 28 30.02000 -2.02000000 34 38 30.02000 7.98000000 35 25 30.02000 -5.02000000 36 22 30.02000 -8.02000000 37 28 30.02000 -2.02000000 38 26 30.02000 -4.02000000 39 32 30.02000 1.98000000 40 31 30.02000 0.98000000 41 35 30.02000 4.98000000 42 30 30.02000 -0.02000000 43 49 30.02000 18.98000000 44 28 30.02000 -2.02000000 45 20 30.02000 -10.02000000 46 28 30.02000 -2.02000000 47 33 30.02000 2.98000000 48 25 30.02000 -5.02000000 49 28 30.02000 -2.02000000 50 30 30.02000 -0.02000000 51 27 24.03333 2.96666667 52 26 24.03333 1.96666667 53 27 24.03333 2.96666667 54 14 24.03333 -10.03333333 55 27 24.03333 2.96666667 56 29 24.03333 4.96666667 57 28 24.03333 3.96666667 58 27 24.03333 2.96666667 59 28 24.03333 3.96666667 60 23 24.03333 -1.03333333 61 20 24.03333 -4.03333333 62 28 24.03333 3.96666667 63 28 24.03333 3.96666667 64 24 24.03333 -0.03333333 65 29 24.03333 4.96666667 66 9 24.03333 -15.03333333 67 23 24.03333 -1.03333333 68 16 24.03333 -8.03333333 69 39 24.03333 14.96666667 70 19 24.03333 -5.03333333 71 16 24.03333 -8.03333333 72 34 24.03333 9.96666667 73 23 24.03333 -1.03333333 74 18 24.03333 -6.03333333 75 35 24.03333 10.96666667 76 40 24.03333 15.96666667 77 17 24.03333 -7.03333333 78 28 24.03333 3.96666667 79 19 24.03333 -5.03333333 80 22 24.03333 -2.03333333 81 27 24.03333 2.96666667 82 32 24.03333 7.96666667 83 29 24.03333 4.96666667 84 18 24.03333 -6.03333333 85 31 24.03333 6.96666667 86 24 24.03333 -0.03333333 87 27 24.03333 2.96666667 88 33 24.03333 8.96666667 89 13 24.03333 -11.03333333 90 2 24.03333 -22.03333333 91 11 24.03333 -13.03333333 92 53 24.03333 28.96666667 93 24 24.03333 -0.03333333 94 5 24.03333 -19.03333333 95 9 24.03333 -15.03333333 96 23 24.03333 -1.03333333 97 34 24.03333 9.96666667 98 13 24.03333 -11.03333333 99 29 24.03333 4.96666667 100 30 24.03333 5.96666667 101 24 24.03333 -0.03333333 102 28 24.03333 3.96666667 103 22 24.03333 -2.03333333 104 8 24.03333 -16.03333333 105 35 24.03333 10.96666667 106 25 24.03333 0.96666667 107 35 24.03333 10.96666667 108 33 24.03333 8.96666667 109 32 24.03333 7.96666667 110 28 24.03333 3.96666667 111 26 24.03333 1.96666667 112 25 24.03333 0.96666667 113 22 24.03333 -2.03333333 114 35 24.03333 10.96666667 115 19 24.03333 -5.03333333 116 29 24.03333 4.96666667 117 19 24.03333 -5.03333333 118 21 24.03333 -3.03333333 119 35 24.03333 10.96666667 120 26 24.03333 1.96666667 121 25 24.03333 0.96666667 122 30 24.03333 5.96666667 123 31 24.03333 6.96666667 124 32 24.03333 7.96666667 125 10 24.03333 -14.03333333 126 12 24.03333 -12.03333333 127 9 24.03333 -15.03333333 128 32 24.03333 7.96666667 129 17 24.03333 -7.03333333 130 21 24.03333 -3.03333333 131 17 24.03333 -7.03333333 132 25 24.03333 0.96666667 133 16 24.03333 -8.03333333 134 24 24.03333 -0.03333333 135 15 24.03333 -9.03333333 136 8 24.03333 -16.03333333 137 34 24.03333 9.96666667 138 24 24.03333 -0.03333333 139 27 24.03333 2.96666667 140 17 24.03333 -7.03333333 141 7 11.25000 -4.25000000 142 23 11.25000 11.75000000 143 3 11.25000 -8.25000000 144 13 11.25000 1.75000000 145 0 11.25000 -11.25000000 146 21 11.25000 9.75000000 147 11 11.25000 -0.25000000 148 12 11.25000 0.75000000 149 0 1.06250 -1.06250000 150 0 1.06250 -1.06250000 151 0 1.06250 -1.06250000 152 2 1.06250 0.93750000 153 7 1.06250 5.93750000 154 8 1.06250 6.93750000 155 0 1.06250 -1.06250000 156 0 1.06250 -1.06250000 157 0 1.06250 -1.06250000 158 0 1.06250 -1.06250000 159 0 1.06250 -1.06250000 160 0 1.06250 -1.06250000 161 0 1.06250 -1.06250000 162 0 1.06250 -1.06250000 163 0 1.06250 -1.06250000 164 0 1.06250 -1.06250000 > 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/49zgf1319053935.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/5wrgd1319053935.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/62myo1319053935.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/7z1t81319053935.tab") + } > > try(system("convert tmp/2yy821319053935.ps tmp/2yy821319053935.png",intern=TRUE)) character(0) > try(system("convert tmp/3meyo1319053935.ps tmp/3meyo1319053935.png",intern=TRUE)) character(0) > try(system("convert tmp/49zgf1319053935.ps tmp/49zgf1319053935.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.58 0.09 2.65