R version 2.9.0 (2009-04-17) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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(13 + ,13 + ,14 + ,13 + ,3 + ,2 + ,12 + ,12 + ,8 + ,13 + ,5 + ,1 + ,15 + ,10 + ,12 + ,16 + ,6 + ,0 + ,12 + ,9 + ,7 + ,12 + ,6 + ,3 + ,10 + ,10 + ,10 + ,11 + ,5 + ,3 + ,12 + ,12 + ,7 + ,12 + ,3 + ,1 + ,15 + ,13 + ,16 + ,18 + ,8 + ,3 + ,9 + ,12 + ,11 + ,11 + ,4 + ,1 + ,12 + ,12 + ,14 + ,14 + ,4 + ,4 + ,11 + ,6 + ,6 + ,9 + ,4 + ,0 + ,11 + ,5 + ,16 + ,14 + ,6 + ,3 + ,11 + ,12 + ,11 + ,12 + ,6 + ,2 + ,15 + ,11 + ,16 + ,11 + ,5 + ,4 + ,7 + ,14 + ,12 + ,12 + ,4 + ,3 + ,11 + ,14 + ,7 + ,13 + ,6 + ,1 + ,11 + ,12 + ,13 + ,11 + ,4 + ,1 + ,10 + ,12 + ,11 + ,12 + ,6 + ,2 + ,14 + ,11 + ,15 + ,16 + ,6 + ,3 + ,10 + ,11 + ,7 + ,9 + ,4 + ,1 + ,6 + ,7 + ,9 + ,11 + ,4 + ,1 + ,11 + ,9 + ,7 + ,13 + ,2 + ,2 + ,15 + ,11 + ,14 + ,15 + ,7 + ,3 + ,11 + ,11 + ,15 + ,10 + ,5 + ,4 + ,12 + ,12 + ,7 + ,11 + ,4 + ,2 + ,14 + ,12 + ,15 + ,13 + ,6 + ,1 + ,15 + ,11 + ,17 + ,16 + ,6 + ,2 + ,9 + ,11 + ,15 + ,15 + ,7 + ,2 + ,13 + ,8 + ,14 + ,14 + ,5 + ,4 + ,13 + ,9 + ,14 + ,14 + ,6 + ,2 + ,16 + ,12 + ,8 + ,14 + ,4 + ,3 + ,13 + ,10 + ,8 + ,8 + ,4 + ,3 + ,12 + ,10 + ,14 + ,13 + ,7 + ,3 + ,14 + ,12 + ,14 + ,15 + ,7 + ,4 + ,11 + ,8 + ,8 + ,13 + ,4 + ,2 + ,9 + ,12 + ,11 + ,11 + ,4 + ,2 + ,16 + ,11 + ,16 + ,15 + ,6 + ,4 + ,12 + ,12 + ,10 + ,15 + ,6 + ,3 + ,10 + ,7 + ,8 + ,9 + ,5 + ,4 + ,13 + ,11 + ,14 + ,13 + ,6 + ,2 + ,16 + ,11 + ,16 + ,16 + ,7 + ,5 + ,14 + ,12 + ,13 + ,13 + ,6 + ,3 + ,15 + ,9 + ,5 + ,11 + ,3 + ,1 + ,5 + ,15 + ,8 + ,12 + ,3 + ,1 + ,8 + ,11 + ,10 + ,12 + ,4 + ,1 + ,11 + ,11 + ,8 + ,12 + ,6 + ,2 + ,16 + ,11 + ,13 + ,14 + ,7 + ,3 + ,17 + ,11 + ,15 + ,14 + ,5 + ,9 + ,9 + ,15 + ,6 + ,8 + ,4 + ,0 + ,9 + ,11 + ,12 + ,13 + ,5 + ,0 + ,13 + ,12 + ,16 + ,16 + ,6 + ,2 + ,10 + ,12 + ,5 + ,13 + ,6 + ,2 + ,6 + ,9 + ,15 + ,11 + ,6 + ,3 + ,12 + ,12 + ,12 + ,14 + ,5 + ,1 + ,8 + ,12 + ,8 + ,13 + ,4 + ,2 + ,14 + ,13 + ,13 + ,13 + ,5 + ,0 + ,12 + ,11 + ,14 + ,13 + ,5 + ,5 + ,11 + ,9 + ,12 + ,12 + ,4 + ,2 + ,16 + ,9 + ,16 + ,16 + ,6 + ,4 + ,8 + ,11 + ,10 + ,15 + ,2 + ,3 + ,15 + ,11 + ,15 + ,15 + ,8 + ,0 + ,7 + ,12 + ,8 + ,12 + ,3 + ,0 + ,16 + ,12 + ,16 + ,14 + ,6 + ,4 + ,14 + ,9 + ,19 + ,12 + ,6 + ,1 + ,16 + ,11 + ,14 + ,15 + ,6 + ,1 + ,9 + ,9 + ,6 + ,12 + ,5 + ,4 + ,14 + ,12 + ,13 + ,13 + ,5 + ,2 + ,11 + ,12 + ,15 + ,12 + ,6 + ,4 + ,13 + ,12 + ,7 + ,12 + ,5 + ,1 + ,15 + ,12 + ,13 + ,13 + ,6 + ,4 + ,5 + ,14 + ,4 + ,5 + ,2 + ,2 + ,15 + ,11 + ,14 + ,13 + ,5 + ,5 + ,13 + ,12 + ,13 + ,13 + ,5 + ,4 + ,11 + ,11 + ,11 + ,14 + ,5 + ,4 + ,11 + ,6 + ,14 + ,17 + ,6 + ,4 + ,12 + ,10 + ,12 + ,13 + ,6 + ,4 + ,12 + ,12 + ,15 + ,13 + ,6 + ,3 + ,12 + ,13 + ,14 + ,12 + ,5 + ,3 + ,12 + ,8 + ,13 + ,13 + ,5 + ,3 + ,14 + ,12 + ,8 + ,14 + ,4 + ,2 + ,6 + ,12 + ,6 + ,11 + ,2 + ,1 + ,7 + ,12 + ,7 + ,12 + ,4 + ,1 + ,14 + ,6 + ,13 + ,12 + ,6 + ,5 + ,14 + ,11 + ,13 + ,16 + ,6 + ,4 + ,10 + ,10 + ,11 + ,12 + ,5 + ,2 + ,13 + ,12 + ,5 + ,12 + ,3 + ,3 + ,12 + ,13 + ,12 + ,12 + ,6 + ,2 + ,9 + ,11 + ,8 + ,10 + ,4 + ,2 + ,12 + ,7 + ,11 + ,15 + ,5 + ,2 + ,16 + ,11 + ,14 + ,15 + ,8 + ,2 + ,10 + ,11 + ,9 + ,12 + ,4 + ,3 + ,14 + ,11 + ,10 + ,16 + ,6 + ,2 + ,10 + ,11 + ,13 + ,15 + ,6 + ,3 + ,16 + ,12 + ,16 + ,16 + ,7 + ,4 + ,15 + ,10 + ,16 + ,13 + ,6 + ,3 + ,12 + ,11 + ,11 + ,12 + ,5 + ,3 + ,10 + ,12 + ,8 + ,11 + ,4 + ,0 + ,8 + ,7 + ,4 + ,13 + ,6 + ,1 + ,8 + ,13 + ,7 + ,10 + ,3 + ,2 + ,11 + ,8 + ,14 + ,15 + ,5 + ,2 + ,13 + ,12 + ,11 + ,13 + ,6 + ,3 + ,16 + ,11 + ,17 + ,16 + ,7 + ,4 + ,16 + ,12 + ,15 + ,15 + ,7 + ,4 + ,14 + ,14 + ,17 + ,18 + ,6 + ,1 + ,11 + ,10 + ,5 + ,13 + ,3 + ,2 + ,4 + ,10 + ,4 + ,10 + ,2 + ,2 + ,14 + ,13 + ,10 + ,16 + ,8 + ,3 + ,9 + ,10 + ,11 + ,13 + ,3 + ,3 + ,14 + ,11 + ,15 + ,15 + ,8 + ,3 + ,8 + ,10 + ,10 + ,14 + ,3 + ,1 + ,8 + ,7 + ,9 + ,15 + ,4 + ,1 + ,11 + ,10 + ,12 + ,14 + ,5 + ,1 + ,12 + ,8 + ,15 + ,13 + ,7 + ,1 + ,11 + ,12 + ,7 + ,13 + ,6 + ,0 + ,14 + ,12 + ,13 + ,15 + ,6 + ,1 + ,15 + ,12 + ,12 + ,16 + ,7 + ,3 + ,16 + ,11 + ,14 + ,14 + ,6 + ,3 + ,16 + ,12 + ,14 + ,14 + ,6 + ,0 + ,11 + ,12 + ,8 + ,16 + ,6 + ,2 + ,14 + ,12 + ,15 + ,14 + ,6 + ,5 + ,14 + ,11 + ,12 + ,12 + ,4 + ,2 + ,12 + ,12 + ,12 + ,13 + ,4 + ,3 + ,14 + ,11 + ,16 + ,12 + ,5 + ,3 + ,8 + ,11 + ,9 + ,12 + ,4 + ,5 + ,13 + ,13 + ,15 + ,14 + ,6 + ,4 + ,16 + ,12 + ,15 + ,14 + ,6 + ,4 + ,12 + ,12 + ,6 + ,14 + ,5 + ,0 + ,16 + ,12 + ,14 + ,16 + ,8 + ,3 + ,12 + ,12 + ,15 + ,13 + ,6 + ,0 + ,11 + ,8 + ,10 + ,14 + ,5 + ,2 + ,4 + ,8 + ,6 + ,4 + ,4 + ,0 + ,16 + ,12 + ,14 + ,16 + ,8 + ,6 + ,15 + ,11 + ,12 + ,13 + ,6 + ,3 + ,10 + ,12 + ,8 + ,16 + ,4 + ,1 + ,13 + ,13 + ,11 + ,15 + ,6 + ,6 + ,15 + ,12 + ,13 + ,14 + ,6 + ,2 + ,12 + ,12 + ,9 + ,13 + ,4 + ,1 + ,14 + ,11 + ,15 + ,14 + ,6 + ,3 + ,7 + ,12 + ,13 + ,12 + ,3 + ,1 + ,19 + ,12 + ,15 + ,15 + ,6 + ,2 + ,12 + ,10 + ,14 + ,14 + ,5 + ,4 + ,12 + ,11 + ,16 + ,13 + ,4 + ,1 + ,13 + ,12 + ,14 + ,14 + ,6 + ,2 + ,15 + ,12 + ,14 + ,16 + ,4 + ,0 + ,8 + ,10 + ,10 + ,6 + ,4 + ,5 + ,12 + ,12 + ,10 + ,13 + ,4 + ,2 + ,10 + ,13 + ,4 + ,13 + ,6 + ,1 + ,8 + ,12 + ,8 + ,14 + ,5 + ,1 + ,10 + ,15 + ,15 + ,15 + ,6 + ,4 + ,15 + ,11 + ,16 + ,14 + ,6 + ,3 + ,16 + ,12 + ,12 + ,15 + ,8 + ,0 + ,13 + ,11 + ,12 + ,13 + ,7 + ,3 + ,16 + ,12 + ,15 + ,16 + ,7 + ,3 + ,9 + ,11 + ,9 + ,12 + ,4 + ,0 + ,14 + ,10 + ,12 + ,15 + ,6 + ,2 + ,14 + ,11 + ,14 + ,12 + ,6 + ,5 + ,12 + ,11 + ,11 + ,14 + ,2 + ,2) + ,dim=c(6 + ,156) + ,dimnames=list(c('Popularity' + ,'FindingFriends' + ,'KnowingPeople' + ,'Liked' + ,'Celebrity' + ,'Su') + ,1:156)) > y <- array(NA,dim=c(6,156),dimnames=list(c('Popularity','FindingFriends','KnowingPeople','Liked','Celebrity','Su'),1:156)) > 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 = '1' > #'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 Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric 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] "Popularity" > x[,par1] [1] 13 12 15 12 10 12 15 9 12 11 11 11 15 7 11 11 10 14 10 6 11 15 11 12 14 [26] 15 9 13 13 16 13 12 14 11 9 16 12 10 13 16 14 15 5 8 11 16 17 9 9 13 [51] 10 6 12 8 14 12 11 16 8 15 7 16 14 16 9 14 11 13 15 5 15 13 11 11 12 [76] 12 12 12 14 6 7 14 14 10 13 12 9 12 16 10 14 10 16 15 12 10 8 8 11 13 [101] 16 16 14 11 4 14 9 14 8 8 11 12 11 14 15 16 16 11 14 14 12 14 8 13 16 [126] 12 16 12 11 4 16 15 10 13 15 12 14 7 19 12 12 13 15 8 12 10 8 10 15 16 [151] 13 16 9 14 14 12 > 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]) 4 5 6 7 8 9 10 11 12 13 14 15 16 17 19 2 2 3 4 10 9 12 19 25 14 21 15 18 1 1 > colnames(x) [1] "Popularity" "FindingFriends" "KnowingPeople" "Liked" [5] "Celebrity" "Su" > colnames(x)[par1] [1] "Popularity" > x[,par1] [1] 13 12 15 12 10 12 15 9 12 11 11 11 15 7 11 11 10 14 10 6 11 15 11 12 14 [26] 15 9 13 13 16 13 12 14 11 9 16 12 10 13 16 14 15 5 8 11 16 17 9 9 13 [51] 10 6 12 8 14 12 11 16 8 15 7 16 14 16 9 14 11 13 15 5 15 13 11 11 12 [76] 12 12 12 14 6 7 14 14 10 13 12 9 12 16 10 14 10 16 15 12 10 8 8 11 13 [101] 16 16 14 11 4 14 9 14 8 8 11 12 11 14 15 16 16 11 14 14 12 14 8 13 16 [126] 12 16 12 11 4 16 15 10 13 15 12 14 7 19 12 12 13 15 8 12 10 8 10 15 16 [151] 13 16 9 14 14 12 > if (par2 == 'none') { + m <- ctree(as.formula(paste(colnames(x)[par1],' ~ .',sep='')),data = x) + } > > #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/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/html/rcomp/tmp/1llq31293195617.tab") + } + } > m Conditional inference tree with 5 terminal nodes Response: Popularity Inputs: FindingFriends, KnowingPeople, Liked, Celebrity, Su Number of observations: 156 1) Celebrity <= 4; criterion = 1, statistic = 55.809 2) Liked <= 12; criterion = 0.982, statistic = 8.463 3)* weights = 31 2) Liked > 12 4)* weights = 19 1) Celebrity > 4 5) KnowingPeople <= 11; criterion = 1, statistic = 28.43 6)* weights = 27 5) KnowingPeople > 11 7) Liked <= 13; criterion = 0.994, statistic = 10.379 8)* weights = 29 7) Liked > 13 9)* weights = 50 > postscript(file="/var/www/html/rcomp/tmp/2wupo1293195617.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/html/rcomp/tmp/3wupo1293195617.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 13 11.263158 1.73684211 2 12 11.148148 0.85185185 3 15 14.320000 0.68000000 4 12 11.148148 0.85185185 5 10 11.148148 -1.14814815 6 12 8.935484 3.06451613 7 15 14.320000 0.68000000 8 9 8.935484 0.06451613 9 12 11.263158 0.73684211 10 11 8.935484 2.06451613 11 11 14.320000 -3.32000000 12 11 11.148148 -0.14814815 13 15 12.793103 2.20689655 14 7 8.935484 -1.93548387 15 11 11.148148 -0.14814815 16 11 8.935484 2.06451613 17 10 11.148148 -1.14814815 18 14 14.320000 -0.32000000 19 10 8.935484 1.06451613 20 6 8.935484 -2.93548387 21 11 11.263158 -0.26315789 22 15 14.320000 0.68000000 23 11 12.793103 -1.79310345 24 12 8.935484 3.06451613 25 14 12.793103 1.20689655 26 15 14.320000 0.68000000 27 9 14.320000 -5.32000000 28 13 14.320000 -1.32000000 29 13 14.320000 -1.32000000 30 16 11.263158 4.73684211 31 13 8.935484 4.06451613 32 12 12.793103 -0.79310345 33 14 14.320000 -0.32000000 34 11 11.263158 -0.26315789 35 9 8.935484 0.06451613 36 16 14.320000 1.68000000 37 12 11.148148 0.85185185 38 10 11.148148 -1.14814815 39 13 12.793103 0.20689655 40 16 14.320000 1.68000000 41 14 12.793103 1.20689655 42 15 8.935484 6.06451613 43 5 8.935484 -3.93548387 44 8 8.935484 -0.93548387 45 11 11.148148 -0.14814815 46 16 14.320000 1.68000000 47 17 14.320000 2.68000000 48 9 8.935484 0.06451613 49 9 12.793103 -3.79310345 50 13 14.320000 -1.32000000 51 10 11.148148 -1.14814815 52 6 12.793103 -6.79310345 53 12 14.320000 -2.32000000 54 8 11.263158 -3.26315789 55 14 12.793103 1.20689655 56 12 12.793103 -0.79310345 57 11 8.935484 2.06451613 58 16 14.320000 1.68000000 59 8 11.263158 -3.26315789 60 15 14.320000 0.68000000 61 7 8.935484 -1.93548387 62 16 14.320000 1.68000000 63 14 12.793103 1.20689655 64 16 14.320000 1.68000000 65 9 11.148148 -2.14814815 66 14 12.793103 1.20689655 67 11 12.793103 -1.79310345 68 13 11.148148 1.85185185 69 15 12.793103 2.20689655 70 5 8.935484 -3.93548387 71 15 12.793103 2.20689655 72 13 12.793103 0.20689655 73 11 11.148148 -0.14814815 74 11 14.320000 -3.32000000 75 12 12.793103 -0.79310345 76 12 12.793103 -0.79310345 77 12 12.793103 -0.79310345 78 12 12.793103 -0.79310345 79 14 11.263158 2.73684211 80 6 8.935484 -2.93548387 81 7 8.935484 -1.93548387 82 14 12.793103 1.20689655 83 14 14.320000 -0.32000000 84 10 11.148148 -1.14814815 85 13 8.935484 4.06451613 86 12 12.793103 -0.79310345 87 9 8.935484 0.06451613 88 12 11.148148 0.85185185 89 16 14.320000 1.68000000 90 10 8.935484 1.06451613 91 14 11.148148 2.85185185 92 10 14.320000 -4.32000000 93 16 14.320000 1.68000000 94 15 12.793103 2.20689655 95 12 11.148148 0.85185185 96 10 8.935484 1.06451613 97 8 11.148148 -3.14814815 98 8 8.935484 -0.93548387 99 11 14.320000 -3.32000000 100 13 11.148148 1.85185185 101 16 14.320000 1.68000000 102 16 14.320000 1.68000000 103 14 14.320000 -0.32000000 104 11 11.263158 -0.26315789 105 4 8.935484 -4.93548387 106 14 11.148148 2.85185185 107 9 11.263158 -2.26315789 108 14 14.320000 -0.32000000 109 8 11.263158 -3.26315789 110 8 11.263158 -3.26315789 111 11 14.320000 -3.32000000 112 12 12.793103 -0.79310345 113 11 11.148148 -0.14814815 114 14 14.320000 -0.32000000 115 15 14.320000 0.68000000 116 16 14.320000 1.68000000 117 16 14.320000 1.68000000 118 11 11.148148 -0.14814815 119 14 14.320000 -0.32000000 120 14 8.935484 5.06451613 121 12 11.263158 0.73684211 122 14 12.793103 1.20689655 123 8 8.935484 -0.93548387 124 13 14.320000 -1.32000000 125 16 14.320000 1.68000000 126 12 11.148148 0.85185185 127 16 14.320000 1.68000000 128 12 12.793103 -0.79310345 129 11 11.148148 -0.14814815 130 4 8.935484 -4.93548387 131 16 14.320000 1.68000000 132 15 12.793103 2.20689655 133 10 11.263158 -1.26315789 134 13 11.148148 1.85185185 135 15 14.320000 0.68000000 136 12 11.263158 0.73684211 137 14 14.320000 -0.32000000 138 7 8.935484 -1.93548387 139 19 14.320000 4.68000000 140 12 14.320000 -2.32000000 141 12 11.263158 0.73684211 142 13 14.320000 -1.32000000 143 15 11.263158 3.73684211 144 8 8.935484 -0.93548387 145 12 11.263158 0.73684211 146 10 11.148148 -1.14814815 147 8 11.148148 -3.14814815 148 10 14.320000 -4.32000000 149 15 14.320000 0.68000000 150 16 14.320000 1.68000000 151 13 12.793103 0.20689655 152 16 14.320000 1.68000000 153 9 8.935484 0.06451613 154 14 14.320000 -0.32000000 155 14 12.793103 1.20689655 156 12 11.263158 0.73684211 > 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/html/rcomp/tmp/473791293195617.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/html/rcomp/tmp/5a4nx1293195617.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/html/rcomp/tmp/6vm4l1293195617.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/html/rcomp/tmp/76w3o1293195617.tab") + } > > try(system("convert tmp/2wupo1293195617.ps tmp/2wupo1293195617.png",intern=TRUE)) character(0) > try(system("convert tmp/3wupo1293195617.ps tmp/3wupo1293195617.png",intern=TRUE)) character(0) > try(system("convert tmp/473791293195617.ps tmp/473791293195617.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.988 0.626 9.316