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(21454 + ,-11.5 + ,0.012095933 + ,8.02 + ,8.3 + ,23899 + ,-11 + ,0.017384968 + ,8.03 + ,8.2 + ,24939 + ,-14.9 + ,0.017547503 + ,8.45 + ,8 + ,23580 + ,-16.2 + ,0.014844804 + ,7.74 + ,7.9 + ,24562 + ,-14.4 + ,0.010364842 + ,7.26 + ,7.6 + ,24696 + ,-17.3 + ,0.016214531 + ,7.9 + ,7.6 + ,23785 + ,-15.7 + ,0.014814047 + ,7.34 + ,8.3 + ,23812 + ,-12.6 + ,0.017823834 + ,6.91 + ,8.4 + ,21917 + ,-9.4 + ,0.017980779 + ,7.22 + ,8.4 + ,19713 + ,-8.1 + ,0.015828678 + ,7.47 + ,8.4 + ,19282 + ,-5.4 + ,0.018533858 + ,7.16 + ,8.4 + ,18788 + ,-4.6 + ,0.017385905 + ,8.09 + ,8.6 + ,21453 + ,-4.9 + ,0.015866474 + ,7.91 + ,8.9 + ,24482 + ,-4 + ,0.012585695 + ,7.74 + ,8.8 + ,27474 + ,-3.1 + ,0.011326531 + ,8.01 + ,8.3 + ,27264 + ,-1.3 + ,0.019230769 + ,7.56 + ,7.5 + ,27349 + ,0 + ,0.026056627 + ,7.56 + ,7.2 + ,30632 + ,-0.4 + ,0.022604071 + ,8.06 + ,7.4 + ,29429 + ,3 + ,0.024091466 + ,8.06 + ,8.8 + ,30084 + ,0.4 + ,0.022602321 + ,7.87 + ,9.3 + ,26290 + ,1.2 + ,0.020302507 + ,7.97 + ,9.3 + ,24379 + ,0.6 + ,0.028617986 + ,7.89 + ,8.7 + ,23335 + ,-1.3 + ,0.025515909 + ,7.83 + ,8.2 + ,21346 + ,-3.2 + ,0.022785068 + ,8.17 + ,8.3 + ,21106 + ,-1.8 + ,0.022515213 + ,8.84 + ,8.5 + ,24514 + ,-3.6 + ,0.025666936 + ,8.44 + ,8.6 + ,28353 + ,-4.2 + ,0.03067299 + ,8.38 + ,8.5 + ,30805 + ,-6.9 + ,0.027599358 + ,7.71 + ,8.2 + ,31348 + ,-8 + ,0.025194961 + ,6.58 + ,8.1 + ,34556 + ,-7.5 + ,0.028705741 + ,6.65 + ,7.9 + ,33855 + ,-8.2 + ,0.031399522 + ,6.59 + ,8.6 + ,34787 + ,-7.6 + ,0.031063321 + ,6.38 + ,8.7 + ,32529 + ,-3.7 + ,0.031638643 + ,6.78 + ,8.7 + ,29998 + ,-1.7 + ,0.024653465 + ,6.46 + ,8.5 + ,29257 + ,-0.7 + ,0.025674068 + ,6.61 + ,8.4 + ,28155 + ,0.2 + ,0.028841372 + ,6.46 + ,8.5 + ,30466 + ,0.6 + ,0.026383654 + ,6.58 + ,8.7 + ,35704 + ,2.2 + ,0.023940887 + ,6.48 + ,8.7 + ,39327 + ,3.3 + ,0.017033774 + ,6.67 + ,8.6 + ,39351 + ,5.3 + ,0.019630823 + ,6.7 + ,8.5 + ,42234 + ,5.5 + ,0.021942657 + ,6.58 + ,8.3 + ,43630 + ,6.3 + ,0.018667963 + ,6.47 + ,8 + ,43722 + ,7.7 + ,0.016043298 + ,7.25 + ,8.2 + ,43121 + ,6.5 + ,0.016415604 + ,7.24 + ,8.1 + ,37985 + ,5.5 + ,0.012248047 + ,6.97 + ,8.1 + ,37135 + ,6.9 + ,0.012175089 + ,6.83 + ,8 + ,34646 + ,5.7 + ,0.014883541 + ,7.42 + ,7.9 + ,33026 + ,6.9 + ,0.016433059 + ,7.34 + ,7.9 + ,35087 + ,6.1 + ,0.016621569 + ,7.11 + ,8 + ,38846 + ,4.8 + ,0.017704224 + ,7.16 + ,8 + ,42013 + ,3.7 + ,0.018192319 + ,7.51 + ,7.9 + ,43908 + ,5.8 + ,0.017816092 + ,7.07 + ,8 + ,42868 + ,6.8 + ,0.01278748 + ,6.85 + ,7.7 + ,44423 + ,8.5 + ,0.012885368 + ,7.05 + ,7.2 + ,44167 + ,7.2 + ,0.013697327 + ,7.62 + ,7.5 + ,43636 + ,5 + ,0.011210336 + ,7.66 + ,7.3 + ,44382 + ,4.7 + ,0.015053354 + ,7.2 + ,7 + ,42142 + ,2.3 + ,0.022434368 + ,7.38 + ,7 + ,43452 + ,2.4 + ,0.029425769 + ,7.57 + ,7 + ,36912 + ,0.1 + ,0.030908226 + ,7.31 + ,7.2 + ,42413 + ,1.9 + ,0.03460076 + ,8.33 + ,7.3 + ,45344 + ,1.7 + ,0.036399735 + ,7.38 + ,7.1 + ,44873 + ,2 + ,0.043864625 + ,7.41 + ,6.8 + ,47510 + ,-1.9 + ,0.041501976 + ,7.81 + ,6.4 + ,49554 + ,0.5 + ,0.052105908 + ,7.24 + ,6.1 + ,47369 + ,-1.3 + ,0.058047493 + ,7.88 + ,6.5 + ,45998 + ,-3.3 + ,0.059116074 + ,8.52 + ,7.7 + ,48140 + ,-2.8 + ,0.053927095 + ,7.66 + ,7.9 + ,48441 + ,-8 + ,0.05462737 + ,8.5 + ,7.5 + ,44928 + ,-13.9 + ,0.047245565 + ,8.82 + ,6.9 + ,40454 + ,-21.9 + ,0.031359852 + ,8.61 + ,6.6 + ,38661 + ,-28.8 + ,0.026291513 + ,8.2 + ,6.9 + ,37246 + ,-27.6 + ,0.023153252 + ,7.31 + ,7.7 + ,36843 + ,-31.4 + ,0.019339537 + ,7.43 + ,8 + ,36424 + ,-31.8 + ,0.006158305 + ,7.33 + ,8 + ,37594 + ,-29.4 + ,0.005963676 + ,7.53 + ,7.7 + ,38144 + ,-27.6 + ,-0.003671861 + ,7.61 + ,7.3 + ,38737 + ,-23.6 + ,-0.011043819 + ,7.17 + ,7.4 + ,34560 + ,-22.8 + ,-0.016833525 + ,6.81 + ,8.1 + ,36080 + ,-18.2 + ,-0.007755393 + ,6.9 + ,8.3 + ,33508 + ,-17.8 + ,-0.011925952 + ,7.33 + ,8.1 + ,35462 + ,-14.2 + ,-0.00971826 + ,7.36 + ,7.9 + ,33374 + ,-8.8 + ,-0.001166024 + ,6.33 + ,7.9 + ,32110 + ,-7.9 + ,0.002606742 + ,6.95 + ,8.3 + ,35533 + ,-7 + ,0.006196121 + ,7.25 + ,8.6 + ,35532 + ,-7 + ,0.00698049 + ,6.46 + ,8.7 + ,37903 + ,-3.6 + ,0.016561656 + ,6.51 + ,8.5 + ,36763 + ,-2.4 + ,0.01796461 + ,6.31 + ,8.3 + ,40399 + ,-4.9 + ,0.022741573 + ,5.93 + ,8 + ,44164 + ,-7.7 + ,0.024585735 + ,5.86 + ,8.1 + ,44496 + ,-6.5 + ,0.025682617 + ,5.85 + ,8.9 + ,43110 + ,-5.1 + ,0.02317851 + ,5.82 + ,8.9 + ,43880 + ,-3.4 + ,0.029093857 + ,6.17 + ,8.7 + ,43930 + ,-2.8 + ,0.030071126 + ,5.7 + ,8.3) + ,dim=c(5 + ,94) + ,dimnames=list(c('Vacatures' + ,'Ondernemersvertrouwen' + ,'Inflatie' + ,'Rente' + ,'Werkloosheidsgraad') + ,1:94)) > y <- array(NA,dim=c(5,94),dimnames=list(c('Vacatures','Ondernemersvertrouwen','Inflatie','Rente','Werkloosheidsgraad'),1:94)) > 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 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] "Vacatures" > x[,par1] [1] 21454 23899 24939 23580 24562 24696 23785 23812 21917 19713 19282 18788 [13] 21453 24482 27474 27264 27349 30632 29429 30084 26290 24379 23335 21346 [25] 21106 24514 28353 30805 31348 34556 33855 34787 32529 29998 29257 28155 [37] 30466 35704 39327 39351 42234 43630 43722 43121 37985 37135 34646 33026 [49] 35087 38846 42013 43908 42868 44423 44167 43636 44382 42142 43452 36912 [61] 42413 45344 44873 47510 49554 47369 45998 48140 48441 44928 40454 38661 [73] 37246 36843 36424 37594 38144 38737 34560 36080 33508 35462 33374 32110 [85] 35533 35532 37903 36763 40399 44164 44496 43110 43880 43930 > 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]) 18788 19282 19713 21106 21346 21453 21454 21917 23335 23580 23785 23812 23899 1 1 1 1 1 1 1 1 1 1 1 1 1 24379 24482 24514 24562 24696 24939 26290 27264 27349 27474 28155 28353 29257 1 1 1 1 1 1 1 1 1 1 1 1 1 29429 29998 30084 30466 30632 30805 31348 32110 32529 33026 33374 33508 33855 1 1 1 1 1 1 1 1 1 1 1 1 1 34556 34560 34646 34787 35087 35462 35532 35533 35704 36080 36424 36763 36843 1 1 1 1 1 1 1 1 1 1 1 1 1 36912 37135 37246 37594 37903 37985 38144 38661 38737 38846 39327 39351 40399 1 1 1 1 1 1 1 1 1 1 1 1 1 40454 42013 42142 42234 42413 42868 43110 43121 43452 43630 43636 43722 43880 1 1 1 1 1 1 1 1 1 1 1 1 1 43908 43930 44164 44167 44382 44423 44496 44873 44928 45344 45998 47369 47510 1 1 1 1 1 1 1 1 1 1 1 1 1 48140 48441 49554 1 1 1 > colnames(x) [1] "Vacatures" "Ondernemersvertrouwen" "Inflatie" [4] "Rente" "Werkloosheidsgraad" > colnames(x)[par1] [1] "Vacatures" > x[,par1] [1] 21454 23899 24939 23580 24562 24696 23785 23812 21917 19713 19282 18788 [13] 21453 24482 27474 27264 27349 30632 29429 30084 26290 24379 23335 21346 [25] 21106 24514 28353 30805 31348 34556 33855 34787 32529 29998 29257 28155 [37] 30466 35704 39327 39351 42234 43630 43722 43121 37985 37135 34646 33026 [49] 35087 38846 42013 43908 42868 44423 44167 43636 44382 42142 43452 36912 [61] 42413 45344 44873 47510 49554 47369 45998 48140 48441 44928 40454 38661 [73] 37246 36843 36424 37594 38144 38737 34560 36080 33508 35462 33374 32110 [85] 35533 35532 37903 36763 40399 44164 44496 43110 43880 43930 > 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/1bgff1293006350.tab") + } + } > m Conditional inference tree with 4 terminal nodes Response: Vacatures Inputs: Ondernemersvertrouwen, Inflatie, Rente, Werkloosheidsgraad Number of observations: 94 1) Werkloosheidsgraad <= 8.1; criterion = 1, statistic = 23.565 2) Inflatie <= 0.03135985; criterion = 0.998, statistic = 12.411 3)* weights = 41 2) Inflatie > 0.03135985 4)* weights = 10 1) Werkloosheidsgraad > 8.1 5) Rente <= 6.9; criterion = 1, statistic = 23.176 6)* weights = 19 5) Rente > 6.9 7)* weights = 24 > postscript(file="/var/www/rcomp/tmp/2bgff1293006350.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/34pei1293006350.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 21454 25711.04 -4257.0417 2 23899 25711.04 -1812.0417 3 24939 36728.66 -11789.6585 4 23580 36728.66 -13148.6585 5 24562 36728.66 -12166.6585 6 24696 36728.66 -12032.6585 7 23785 25711.04 -1926.0417 8 23812 25711.04 -1899.0417 9 21917 25711.04 -3794.0417 10 19713 25711.04 -5998.0417 11 19282 25711.04 -6429.0417 12 18788 25711.04 -6923.0417 13 21453 25711.04 -4258.0417 14 24482 25711.04 -1229.0417 15 27474 25711.04 1762.9583 16 27264 36728.66 -9464.6585 17 27349 36728.66 -9379.6585 18 30632 36728.66 -6096.6585 19 29429 25711.04 3717.9583 20 30084 25711.04 4372.9583 21 26290 25711.04 578.9583 22 24379 25711.04 -1332.0417 23 23335 25711.04 -2376.0417 24 21346 25711.04 -4365.0417 25 21106 25711.04 -4605.0417 26 24514 25711.04 -1197.0417 27 28353 25711.04 2641.9583 28 30805 25711.04 5093.9583 29 31348 36728.66 -5380.6585 30 34556 36728.66 -2172.6585 31 33855 36703.00 -2848.0000 32 34787 36703.00 -1916.0000 33 32529 36703.00 -4174.0000 34 29998 36703.00 -6705.0000 35 29257 36703.00 -7446.0000 36 28155 36703.00 -8548.0000 37 30466 36703.00 -6237.0000 38 35704 36703.00 -999.0000 39 39327 36703.00 2624.0000 40 39351 36703.00 2648.0000 41 42234 36703.00 5531.0000 42 43630 36728.66 6901.3415 43 43722 25711.04 18010.9583 44 43121 36728.66 6392.3415 45 37985 36728.66 1256.3415 46 37135 36728.66 406.3415 47 34646 36728.66 -2082.6585 48 33026 36728.66 -3702.6585 49 35087 36728.66 -1641.6585 50 38846 36728.66 2117.3415 51 42013 36728.66 5284.3415 52 43908 36728.66 7179.3415 53 42868 36728.66 6139.3415 54 44423 36728.66 7694.3415 55 44167 36728.66 7438.3415 56 43636 36728.66 6907.3415 57 44382 36728.66 7653.3415 58 42142 36728.66 5413.3415 59 43452 36728.66 6723.3415 60 36912 36728.66 183.3415 61 42413 46457.00 -4044.0000 62 45344 46457.00 -1113.0000 63 44873 46457.00 -1584.0000 64 47510 46457.00 1053.0000 65 49554 46457.00 3097.0000 66 47369 46457.00 912.0000 67 45998 46457.00 -459.0000 68 48140 46457.00 1683.0000 69 48441 46457.00 1984.0000 70 44928 46457.00 -1529.0000 71 40454 36728.66 3725.3415 72 38661 36728.66 1932.3415 73 37246 36728.66 517.3415 74 36843 36728.66 114.3415 75 36424 36728.66 -304.6585 76 37594 36728.66 865.3415 77 38144 36728.66 1415.3415 78 38737 36728.66 2008.3415 79 34560 36728.66 -2168.6585 80 36080 36703.00 -623.0000 81 33508 36728.66 -3220.6585 82 35462 36728.66 -1266.6585 83 33374 36728.66 -3354.6585 84 32110 25711.04 6398.9583 85 35533 25711.04 9821.9583 86 35532 36703.00 -1171.0000 87 37903 36703.00 1200.0000 88 36763 36703.00 60.0000 89 40399 36728.66 3670.3415 90 44164 36728.66 7435.3415 91 44496 36703.00 7793.0000 92 43110 36703.00 6407.0000 93 43880 36703.00 7177.0000 94 43930 36703.00 7227.0000 > 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/4fgv31293006350.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/5izu91293006350.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/6mhaf1293006350.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/7e8ah1293006350.tab") + } > > try(system("convert tmp/2bgff1293006350.ps tmp/2bgff1293006350.png",intern=TRUE)) character(0) > try(system("convert tmp/34pei1293006350.ps tmp/34pei1293006350.png",intern=TRUE)) character(0) > try(system("convert tmp/4fgv31293006350.ps tmp/4fgv31293006350.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.310 0.720 2.996