R version 2.6.1 (2007-11-26) Copyright (C) 2007 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(106 + ,87 + ,1 + ,65.3 + ,2.2 + ,70 + ,1 + ,65.73 + ,62.3 + ,75 + ,1 + ,69.44 + ,14.7 + ,79 + ,1 + ,73.74 + ,5 + ,64.5 + ,1 + ,74.31 + ,74.4 + ,75 + ,0 + ,70.53 + ,66.1 + ,70 + ,0 + ,69.42 + ,22 + ,67 + ,1 + ,69.77 + ,3.4 + ,52 + ,0 + ,65.47 + ,0.3 + ,67.2 + ,1 + ,66.2 + ,53.2 + ,47 + ,0 + ,70.46 + ,0 + ,46.4 + ,0 + ,74.44 + ,57.2 + ,76 + ,0 + ,69.28 + ,9.2 + ,71.6 + ,1 + ,67.67 + ,15.9 + ,63.8 + ,1 + ,67.22 + ,17.6 + ,48.2 + ,1 + ,64.85 + ,21 + ,64.5 + ,1 + ,71.35 + ,7.6 + ,75.9 + ,1 + ,72.28 + ,71.6 + ,80 + ,1 + ,71.87 + ,12.9 + ,56 + ,1 + ,67.34 + ,10.5 + ,75.5 + ,0 + ,73.5 + ,25.7 + ,77 + ,1 + ,64.91 + ,26.8 + ,88 + ,0 + ,68.13 + ,7.3 + ,48 + ,0 + ,72.5 + ,17.1 + ,73 + ,1 + ,72.36 + ,27.3 + ,72 + ,1 + ,70.59 + ,16.5 + ,64 + ,1 + ,74.76 + ,5.4 + ,76 + ,0 + ,65.63 + ,5.6 + ,67.4 + ,1 + ,67.04 + ,36.5 + ,73.7 + ,1 + ,66.72 + ,1.1 + ,59.2 + ,0 + ,65.8 + ,3.9 + ,53 + ,0 + ,72.44 + ,34.2 + ,41.9 + ,1 + ,71.83 + ,40.3 + ,65.5 + ,1 + ,72.67 + ,15.6 + ,63 + ,1 + ,69.56 + ,15.5 + ,54 + ,0 + ,67 + ,52.9 + ,77.7 + ,0 + ,68.86 + ,1.6 + ,47.6 + ,0 + ,71.25 + ,14.2 + ,53.1 + ,1 + ,69.88 + ,7.5 + ,55.5 + ,1 + ,67.18 + ,2 + ,64 + ,1 + ,67.47 + ,71.4 + ,75.6 + ,1 + ,73.2 + ,3.2 + ,57 + ,0 + ,69.6 + ,20 + ,63 + ,0 + ,71.24 + ,2.8 + ,59.5 + ,1 + ,73.83 + ,15.3 + ,84.5 + ,1 + ,66.07 + ,8 + ,59.9 + ,0 + ,70.68 + ,36.6 + ,60 + ,1 + ,74.01 + ,3.8 + ,64 + ,0 + ,68.53 + ,25.5 + ,54 + ,0 + ,66.72 + ,3.2 + ,53.8 + ,0 + ,72.69 + ,33.1 + ,84 + ,1 + ,67.46 + ,42 + ,63.2 + ,0 + ,73.81 + ,16.2 + ,54.3 + ,1 + ,72.96 + ,0 + ,60 + ,0 + ,71.65 + ,22.7 + ,68 + ,1 + ,72.79 + ,36.4 + ,74 + ,1 + ,73.83 + ,69 + ,74 + ,1 + ,66.74 + ,11.2 + ,68.5 + ,1 + ,65.62 + ,12.5 + ,76 + ,0 + ,66.18 + ,51.7 + ,83 + ,0 + ,67.78 + ,3.6 + ,62.5 + ,0 + ,68.84 + ,22.2 + ,57 + ,1 + ,65.27 + ,39.2 + ,85 + ,1 + ,72.84 + ,27.9 + ,50 + ,1 + ,75.36 + ,58.8 + ,53 + ,1 + ,76.88 + ,1 + ,57 + ,0 + ,76.51 + ,4.7 + ,46 + ,1 + ,80.63 + ,25.6 + ,65.4 + ,1 + ,75.27 + ,5.3 + ,71.4 + ,1 + ,81.19 + ,38.7 + ,41 + ,1 + ,81.3 + ,31.6 + ,66 + ,1 + ,77.77 + ,19.3 + ,69.5 + ,1 + ,75.51 + ,26.5 + ,59 + ,1 + ,78.64 + ,12.8 + ,80 + ,1 + ,80.68 + ,18.3 + ,72 + ,1 + ,77.4 + ,13.2 + ,73 + ,0 + ,80.71 + ,36 + ,66.4 + ,0 + ,83.16 + ,34.1 + ,37 + ,0 + ,87.99 + ,71.5 + ,70 + ,1 + ,72.21 + ,43.3 + ,75 + ,1 + ,70.24 + ,47.7 + ,54 + ,1 + ,66.06 + ,74.9 + ,76.2 + ,1 + ,68.67 + ,0.9 + ,74.9 + ,1 + ,68.77 + ,35.9 + ,98 + ,1 + ,68.07 + ,45.8 + ,86.5 + ,0 + ,67.33 + ,54.2 + ,72.8 + ,1 + ,69.47 + ,34 + ,65 + ,1 + ,70.81 + ,7.9 + ,50 + ,1 + ,73.17 + ,54.5 + ,81 + ,1 + ,71.28 + ,8.2 + ,52 + ,0 + ,69.47 + ,49.3 + ,68 + ,1 + ,65.31 + ,46.9 + ,58.5 + ,1 + ,70.23 + ,16.8 + ,65.5 + ,1 + ,73.23 + ,2.8 + ,62.5 + ,0 + ,68.67 + ,60.9 + ,64 + ,1 + ,72.66 + ,5.6 + ,55.7 + ,0 + ,74.79 + ,6.6 + ,84 + ,1 + ,73.04 + ,22.9 + ,63.7 + ,1 + ,69.95 + ,51.1 + ,65 + ,0 + ,67.51 + ,23.3 + ,87.5 + ,0 + ,67.5 + ,11.5 + ,79 + ,1 + ,71.32 + ,79.1 + ,58.5 + ,0 + ,71.23 + ,53.6 + ,75 + ,1 + ,67.49 + ,1.5 + ,52.5 + ,0 + ,68.62 + ,40.4 + ,57.5 + ,1 + ,72.53 + ,25.4 + ,70 + ,1 + ,66.67 + ,6.7 + ,72 + ,1 + ,66.19 + ,76 + ,88 + ,1 + ,78.4 + ,0.6 + ,58 + ,1 + ,75.67 + ,43.4 + ,73 + ,1 + ,76.07 + ,13 + ,56 + ,1 + ,82.88 + ,27.8 + ,49 + ,0 + ,77.14 + ,6.5 + ,54.7 + ,0 + ,77.31 + ,7.1 + ,67 + ,1 + ,76.58 + ,6 + ,47 + ,0 + ,82.86 + ,6.5 + ,47 + ,0 + ,76.64) + ,dim=c(4 + ,117) + ,dimnames=list(c('y' + ,'weight' + ,'sex' + ,'age') + ,1:117)) > y <- array(NA,dim=c(4,117),dimnames=list(c('y','weight','sex','age'),1:117)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'No Linear Trend' > par2 = 'Do not include Seasonal Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), 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: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x y weight sex age 1 106.0 87.0 1 65.30 2 2.2 70.0 1 65.73 3 62.3 75.0 1 69.44 4 14.7 79.0 1 73.74 5 5.0 64.5 1 74.31 6 74.4 75.0 0 70.53 7 66.1 70.0 0 69.42 8 22.0 67.0 1 69.77 9 3.4 52.0 0 65.47 10 0.3 67.2 1 66.20 11 53.2 47.0 0 70.46 12 0.0 46.4 0 74.44 13 57.2 76.0 0 69.28 14 9.2 71.6 1 67.67 15 15.9 63.8 1 67.22 16 17.6 48.2 1 64.85 17 21.0 64.5 1 71.35 18 7.6 75.9 1 72.28 19 71.6 80.0 1 71.87 20 12.9 56.0 1 67.34 21 10.5 75.5 0 73.50 22 25.7 77.0 1 64.91 23 26.8 88.0 0 68.13 24 7.3 48.0 0 72.50 25 17.1 73.0 1 72.36 26 27.3 72.0 1 70.59 27 16.5 64.0 1 74.76 28 5.4 76.0 0 65.63 29 5.6 67.4 1 67.04 30 36.5 73.7 1 66.72 31 1.1 59.2 0 65.80 32 3.9 53.0 0 72.44 33 34.2 41.9 1 71.83 34 40.3 65.5 1 72.67 35 15.6 63.0 1 69.56 36 15.5 54.0 0 67.00 37 52.9 77.7 0 68.86 38 1.6 47.6 0 71.25 39 14.2 53.1 1 69.88 40 7.5 55.5 1 67.18 41 2.0 64.0 1 67.47 42 71.4 75.6 1 73.20 43 3.2 57.0 0 69.60 44 20.0 63.0 0 71.24 45 2.8 59.5 1 73.83 46 15.3 84.5 1 66.07 47 8.0 59.9 0 70.68 48 36.6 60.0 1 74.01 49 3.8 64.0 0 68.53 50 25.5 54.0 0 66.72 51 3.2 53.8 0 72.69 52 33.1 84.0 1 67.46 53 42.0 63.2 0 73.81 54 16.2 54.3 1 72.96 55 0.0 60.0 0 71.65 56 22.7 68.0 1 72.79 57 36.4 74.0 1 73.83 58 69.0 74.0 1 66.74 59 11.2 68.5 1 65.62 60 12.5 76.0 0 66.18 61 51.7 83.0 0 67.78 62 3.6 62.5 0 68.84 63 22.2 57.0 1 65.27 64 39.2 85.0 1 72.84 65 27.9 50.0 1 75.36 66 58.8 53.0 1 76.88 67 1.0 57.0 0 76.51 68 4.7 46.0 1 80.63 69 25.6 65.4 1 75.27 70 5.3 71.4 1 81.19 71 38.7 41.0 1 81.30 72 31.6 66.0 1 77.77 73 19.3 69.5 1 75.51 74 26.5 59.0 1 78.64 75 12.8 80.0 1 80.68 76 18.3 72.0 1 77.40 77 13.2 73.0 0 80.71 78 36.0 66.4 0 83.16 79 34.1 37.0 0 87.99 80 71.5 70.0 1 72.21 81 43.3 75.0 1 70.24 82 47.7 54.0 1 66.06 83 74.9 76.2 1 68.67 84 0.9 74.9 1 68.77 85 35.9 98.0 1 68.07 86 45.8 86.5 0 67.33 87 54.2 72.8 1 69.47 88 34.0 65.0 1 70.81 89 7.9 50.0 1 73.17 90 54.5 81.0 1 71.28 91 8.2 52.0 0 69.47 92 49.3 68.0 1 65.31 93 46.9 58.5 1 70.23 94 16.8 65.5 1 73.23 95 2.8 62.5 0 68.67 96 60.9 64.0 1 72.66 97 5.6 55.7 0 74.79 98 6.6 84.0 1 73.04 99 22.9 63.7 1 69.95 100 51.1 65.0 0 67.51 101 23.3 87.5 0 67.50 102 11.5 79.0 1 71.32 103 79.1 58.5 0 71.23 104 53.6 75.0 1 67.49 105 1.5 52.5 0 68.62 106 40.4 57.5 1 72.53 107 25.4 70.0 1 66.67 108 6.7 72.0 1 66.19 109 76.0 88.0 1 78.40 110 0.6 58.0 1 75.67 111 43.4 73.0 1 76.07 112 13.0 56.0 1 82.88 113 27.8 49.0 0 77.14 114 6.5 54.7 0 77.31 115 7.1 67.0 1 76.58 116 6.0 47.0 0 82.86 117 6.5 47.0 0 76.64 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) weight sex age -27.7994 0.6366 3.6297 0.1389 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -32.852 -15.254 -6.266 13.691 65.714 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -27.7994 37.1803 -0.748 0.456200 weight 0.6366 0.1813 3.511 0.000643 *** sex 3.6297 4.3239 0.839 0.402993 age 0.1389 0.4483 0.310 0.757276 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 21.76 on 113 degrees of freedom Multiple R-Squared: 0.1241, Adjusted R-squared: 0.1008 F-statistic: 5.335 on 3 and 113 DF, p-value: 0.001787 > postscript(file="/var/www/html/rcomp/tmp/1cr6x1200395909.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index') > points(x[,1]-mysum$resid) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/2hhaw1200395909.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/33pg01200395909.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/4lao71200395909.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/51ony1200395909.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mysum$resid, main='Residual Normal Q-Q Plot') > grid() > dev.off() null device 1 > (myerror <- as.ts(mysum$resid)) Time Series: Start = 1 End = 117 Frequency = 1 1 2 3 4 5 6 65.7135034 -27.3234254 29.0781501 -21.6655798 -22.2135389 44.6564352 7 8 9 10 11 12 39.6937674 -6.1746030 -10.9982251 -27.5061225 41.2919292 -12.0788390 13 14 15 16 17 18 26.9934025 -21.6114713 -9.8832237 2.0774275 -5.8024492 -26.5892450 19 20 21 22 23 24 34.8574941 -7.9341387 -19.9743607 -8.1659855 -10.8865003 -5.5280241 25 26 27 28 29 30 -15.2541148 -4.1716596 -10.4577183 -24.2996795 -22.4501100 4.4835333 31 32 33 34 35 36 -17.9278260 -12.1028648 21.7188323 12.6775923 -9.9988990 -0.3839834 37 38 39 40 41 42 21.6694538 -10.7997682 -5.1406574 -12.9936003 -23.9452711 37.2739743 43 44 45 46 47 48 -14.9549799 -2.2025541 -21.1637021 -23.5018486 -12.1512127 12.2929819 49 50 51 52 53 54 -18.6628196 9.6549034 -13.3468930 -5.5765767 19.3131931 -4.3323745 55 56 57 58 59 60 -20.3495914 -6.5306603 3.2050944 36.7897653 -17.3531963 -17.2760644 61 62 63 64 65 66 17.2452819 -17.9509208 1.0167116 -0.8603947 9.7718389 38.5508346 67 68 69 70 71 72 -18.1146520 -11.6135285 -2.3198365 -27.2618242 25.4765944 2.9509785 73 74 75 76 77 78 -11.2633705 2.1865946 -25.1660532 -14.1174436 -16.6841105 9.9774186 79 80 81 82 83 84 26.1236812 41.0766216 9.9670448 28.3168993 41.0211273 -32.1651357 85 86 87 88 89 90 -11.7741807 9.1795571 22.3745801 6.9542295 -9.9240103 17.2027996 91 92 93 94 95 96 -6.7537516 21.1081744 24.0729066 -10.9001814 -18.7273109 34.2339332 97 98 99 100 101 102 -12.4481505 -32.8515363 -3.1987071 28.1422050 -13.9806875 -24.5294863 103 104 105 106 107 108 59.7636910 20.6489693 -13.6540196 17.8901135 -4.2539741 -24.1605804 109 110 111 112 113 114 33.2575192 -22.6642922 10.5306343 -9.9923594 13.6909303 -11.2614975 115 116 117 -22.0203870 -7.6302032 -6.2663594 > postscript(file="/var/www/html/rcomp/tmp/6ixnj1200395909.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 117 Frequency = 1 lag(myerror, k = 1) myerror 0 65.7135034 NA 1 -27.3234254 65.7135034 2 29.0781501 -27.3234254 3 -21.6655798 29.0781501 4 -22.2135389 -21.6655798 5 44.6564352 -22.2135389 6 39.6937674 44.6564352 7 -6.1746030 39.6937674 8 -10.9982251 -6.1746030 9 -27.5061225 -10.9982251 10 41.2919292 -27.5061225 11 -12.0788390 41.2919292 12 26.9934025 -12.0788390 13 -21.6114713 26.9934025 14 -9.8832237 -21.6114713 15 2.0774275 -9.8832237 16 -5.8024492 2.0774275 17 -26.5892450 -5.8024492 18 34.8574941 -26.5892450 19 -7.9341387 34.8574941 20 -19.9743607 -7.9341387 21 -8.1659855 -19.9743607 22 -10.8865003 -8.1659855 23 -5.5280241 -10.8865003 24 -15.2541148 -5.5280241 25 -4.1716596 -15.2541148 26 -10.4577183 -4.1716596 27 -24.2996795 -10.4577183 28 -22.4501100 -24.2996795 29 4.4835333 -22.4501100 30 -17.9278260 4.4835333 31 -12.1028648 -17.9278260 32 21.7188323 -12.1028648 33 12.6775923 21.7188323 34 -9.9988990 12.6775923 35 -0.3839834 -9.9988990 36 21.6694538 -0.3839834 37 -10.7997682 21.6694538 38 -5.1406574 -10.7997682 39 -12.9936003 -5.1406574 40 -23.9452711 -12.9936003 41 37.2739743 -23.9452711 42 -14.9549799 37.2739743 43 -2.2025541 -14.9549799 44 -21.1637021 -2.2025541 45 -23.5018486 -21.1637021 46 -12.1512127 -23.5018486 47 12.2929819 -12.1512127 48 -18.6628196 12.2929819 49 9.6549034 -18.6628196 50 -13.3468930 9.6549034 51 -5.5765767 -13.3468930 52 19.3131931 -5.5765767 53 -4.3323745 19.3131931 54 -20.3495914 -4.3323745 55 -6.5306603 -20.3495914 56 3.2050944 -6.5306603 57 36.7897653 3.2050944 58 -17.3531963 36.7897653 59 -17.2760644 -17.3531963 60 17.2452819 -17.2760644 61 -17.9509208 17.2452819 62 1.0167116 -17.9509208 63 -0.8603947 1.0167116 64 9.7718389 -0.8603947 65 38.5508346 9.7718389 66 -18.1146520 38.5508346 67 -11.6135285 -18.1146520 68 -2.3198365 -11.6135285 69 -27.2618242 -2.3198365 70 25.4765944 -27.2618242 71 2.9509785 25.4765944 72 -11.2633705 2.9509785 73 2.1865946 -11.2633705 74 -25.1660532 2.1865946 75 -14.1174436 -25.1660532 76 -16.6841105 -14.1174436 77 9.9774186 -16.6841105 78 26.1236812 9.9774186 79 41.0766216 26.1236812 80 9.9670448 41.0766216 81 28.3168993 9.9670448 82 41.0211273 28.3168993 83 -32.1651357 41.0211273 84 -11.7741807 -32.1651357 85 9.1795571 -11.7741807 86 22.3745801 9.1795571 87 6.9542295 22.3745801 88 -9.9240103 6.9542295 89 17.2027996 -9.9240103 90 -6.7537516 17.2027996 91 21.1081744 -6.7537516 92 24.0729066 21.1081744 93 -10.9001814 24.0729066 94 -18.7273109 -10.9001814 95 34.2339332 -18.7273109 96 -12.4481505 34.2339332 97 -32.8515363 -12.4481505 98 -3.1987071 -32.8515363 99 28.1422050 -3.1987071 100 -13.9806875 28.1422050 101 -24.5294863 -13.9806875 102 59.7636910 -24.5294863 103 20.6489693 59.7636910 104 -13.6540196 20.6489693 105 17.8901135 -13.6540196 106 -4.2539741 17.8901135 107 -24.1605804 -4.2539741 108 33.2575192 -24.1605804 109 -22.6642922 33.2575192 110 10.5306343 -22.6642922 111 -9.9923594 10.5306343 112 13.6909303 -9.9923594 113 -11.2614975 13.6909303 114 -22.0203870 -11.2614975 115 -7.6302032 -22.0203870 116 -6.2663594 -7.6302032 117 NA -6.2663594 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -27.3234254 65.7135034 [2,] 29.0781501 -27.3234254 [3,] -21.6655798 29.0781501 [4,] -22.2135389 -21.6655798 [5,] 44.6564352 -22.2135389 [6,] 39.6937674 44.6564352 [7,] -6.1746030 39.6937674 [8,] -10.9982251 -6.1746030 [9,] -27.5061225 -10.9982251 [10,] 41.2919292 -27.5061225 [11,] -12.0788390 41.2919292 [12,] 26.9934025 -12.0788390 [13,] -21.6114713 26.9934025 [14,] -9.8832237 -21.6114713 [15,] 2.0774275 -9.8832237 [16,] -5.8024492 2.0774275 [17,] -26.5892450 -5.8024492 [18,] 34.8574941 -26.5892450 [19,] -7.9341387 34.8574941 [20,] -19.9743607 -7.9341387 [21,] -8.1659855 -19.9743607 [22,] -10.8865003 -8.1659855 [23,] -5.5280241 -10.8865003 [24,] -15.2541148 -5.5280241 [25,] -4.1716596 -15.2541148 [26,] -10.4577183 -4.1716596 [27,] -24.2996795 -10.4577183 [28,] -22.4501100 -24.2996795 [29,] 4.4835333 -22.4501100 [30,] -17.9278260 4.4835333 [31,] -12.1028648 -17.9278260 [32,] 21.7188323 -12.1028648 [33,] 12.6775923 21.7188323 [34,] -9.9988990 12.6775923 [35,] -0.3839834 -9.9988990 [36,] 21.6694538 -0.3839834 [37,] -10.7997682 21.6694538 [38,] -5.1406574 -10.7997682 [39,] -12.9936003 -5.1406574 [40,] -23.9452711 -12.9936003 [41,] 37.2739743 -23.9452711 [42,] -14.9549799 37.2739743 [43,] -2.2025541 -14.9549799 [44,] -21.1637021 -2.2025541 [45,] -23.5018486 -21.1637021 [46,] -12.1512127 -23.5018486 [47,] 12.2929819 -12.1512127 [48,] -18.6628196 12.2929819 [49,] 9.6549034 -18.6628196 [50,] -13.3468930 9.6549034 [51,] -5.5765767 -13.3468930 [52,] 19.3131931 -5.5765767 [53,] -4.3323745 19.3131931 [54,] -20.3495914 -4.3323745 [55,] -6.5306603 -20.3495914 [56,] 3.2050944 -6.5306603 [57,] 36.7897653 3.2050944 [58,] -17.3531963 36.7897653 [59,] -17.2760644 -17.3531963 [60,] 17.2452819 -17.2760644 [61,] -17.9509208 17.2452819 [62,] 1.0167116 -17.9509208 [63,] -0.8603947 1.0167116 [64,] 9.7718389 -0.8603947 [65,] 38.5508346 9.7718389 [66,] -18.1146520 38.5508346 [67,] -11.6135285 -18.1146520 [68,] -2.3198365 -11.6135285 [69,] -27.2618242 -2.3198365 [70,] 25.4765944 -27.2618242 [71,] 2.9509785 25.4765944 [72,] -11.2633705 2.9509785 [73,] 2.1865946 -11.2633705 [74,] -25.1660532 2.1865946 [75,] -14.1174436 -25.1660532 [76,] -16.6841105 -14.1174436 [77,] 9.9774186 -16.6841105 [78,] 26.1236812 9.9774186 [79,] 41.0766216 26.1236812 [80,] 9.9670448 41.0766216 [81,] 28.3168993 9.9670448 [82,] 41.0211273 28.3168993 [83,] -32.1651357 41.0211273 [84,] -11.7741807 -32.1651357 [85,] 9.1795571 -11.7741807 [86,] 22.3745801 9.1795571 [87,] 6.9542295 22.3745801 [88,] -9.9240103 6.9542295 [89,] 17.2027996 -9.9240103 [90,] -6.7537516 17.2027996 [91,] 21.1081744 -6.7537516 [92,] 24.0729066 21.1081744 [93,] -10.9001814 24.0729066 [94,] -18.7273109 -10.9001814 [95,] 34.2339332 -18.7273109 [96,] -12.4481505 34.2339332 [97,] -32.8515363 -12.4481505 [98,] -3.1987071 -32.8515363 [99,] 28.1422050 -3.1987071 [100,] -13.9806875 28.1422050 [101,] -24.5294863 -13.9806875 [102,] 59.7636910 -24.5294863 [103,] 20.6489693 59.7636910 [104,] -13.6540196 20.6489693 [105,] 17.8901135 -13.6540196 [106,] -4.2539741 17.8901135 [107,] -24.1605804 -4.2539741 [108,] 33.2575192 -24.1605804 [109,] -22.6642922 33.2575192 [110,] 10.5306343 -22.6642922 [111,] -9.9923594 10.5306343 [112,] 13.6909303 -9.9923594 [113,] -11.2614975 13.6909303 [114,] -22.0203870 -11.2614975 [115,] -7.6302032 -22.0203870 [116,] -6.2663594 -7.6302032 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -27.3234254 65.7135034 2 29.0781501 -27.3234254 3 -21.6655798 29.0781501 4 -22.2135389 -21.6655798 5 44.6564352 -22.2135389 6 39.6937674 44.6564352 7 -6.1746030 39.6937674 8 -10.9982251 -6.1746030 9 -27.5061225 -10.9982251 10 41.2919292 -27.5061225 11 -12.0788390 41.2919292 12 26.9934025 -12.0788390 13 -21.6114713 26.9934025 14 -9.8832237 -21.6114713 15 2.0774275 -9.8832237 16 -5.8024492 2.0774275 17 -26.5892450 -5.8024492 18 34.8574941 -26.5892450 19 -7.9341387 34.8574941 20 -19.9743607 -7.9341387 21 -8.1659855 -19.9743607 22 -10.8865003 -8.1659855 23 -5.5280241 -10.8865003 24 -15.2541148 -5.5280241 25 -4.1716596 -15.2541148 26 -10.4577183 -4.1716596 27 -24.2996795 -10.4577183 28 -22.4501100 -24.2996795 29 4.4835333 -22.4501100 30 -17.9278260 4.4835333 31 -12.1028648 -17.9278260 32 21.7188323 -12.1028648 33 12.6775923 21.7188323 34 -9.9988990 12.6775923 35 -0.3839834 -9.9988990 36 21.6694538 -0.3839834 37 -10.7997682 21.6694538 38 -5.1406574 -10.7997682 39 -12.9936003 -5.1406574 40 -23.9452711 -12.9936003 41 37.2739743 -23.9452711 42 -14.9549799 37.2739743 43 -2.2025541 -14.9549799 44 -21.1637021 -2.2025541 45 -23.5018486 -21.1637021 46 -12.1512127 -23.5018486 47 12.2929819 -12.1512127 48 -18.6628196 12.2929819 49 9.6549034 -18.6628196 50 -13.3468930 9.6549034 51 -5.5765767 -13.3468930 52 19.3131931 -5.5765767 53 -4.3323745 19.3131931 54 -20.3495914 -4.3323745 55 -6.5306603 -20.3495914 56 3.2050944 -6.5306603 57 36.7897653 3.2050944 58 -17.3531963 36.7897653 59 -17.2760644 -17.3531963 60 17.2452819 -17.2760644 61 -17.9509208 17.2452819 62 1.0167116 -17.9509208 63 -0.8603947 1.0167116 64 9.7718389 -0.8603947 65 38.5508346 9.7718389 66 -18.1146520 38.5508346 67 -11.6135285 -18.1146520 68 -2.3198365 -11.6135285 69 -27.2618242 -2.3198365 70 25.4765944 -27.2618242 71 2.9509785 25.4765944 72 -11.2633705 2.9509785 73 2.1865946 -11.2633705 74 -25.1660532 2.1865946 75 -14.1174436 -25.1660532 76 -16.6841105 -14.1174436 77 9.9774186 -16.6841105 78 26.1236812 9.9774186 79 41.0766216 26.1236812 80 9.9670448 41.0766216 81 28.3168993 9.9670448 82 41.0211273 28.3168993 83 -32.1651357 41.0211273 84 -11.7741807 -32.1651357 85 9.1795571 -11.7741807 86 22.3745801 9.1795571 87 6.9542295 22.3745801 88 -9.9240103 6.9542295 89 17.2027996 -9.9240103 90 -6.7537516 17.2027996 91 21.1081744 -6.7537516 92 24.0729066 21.1081744 93 -10.9001814 24.0729066 94 -18.7273109 -10.9001814 95 34.2339332 -18.7273109 96 -12.4481505 34.2339332 97 -32.8515363 -12.4481505 98 -3.1987071 -32.8515363 99 28.1422050 -3.1987071 100 -13.9806875 28.1422050 101 -24.5294863 -13.9806875 102 59.7636910 -24.5294863 103 20.6489693 59.7636910 104 -13.6540196 20.6489693 105 17.8901135 -13.6540196 106 -4.2539741 17.8901135 107 -24.1605804 -4.2539741 108 33.2575192 -24.1605804 109 -22.6642922 33.2575192 110 10.5306343 -22.6642922 111 -9.9923594 10.5306343 112 13.6909303 -9.9923594 113 -11.2614975 13.6909303 114 -22.0203870 -11.2614975 115 -7.6302032 -22.0203870 116 -6.2663594 -7.6302032 > plot(z,main=paste('Residual Lag plot, lowess, and regression line'), ylab='values of Residuals', xlab='lagged values of Residuals') > lines(lowess(z)) > abline(lm(z)) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/791dr1200395909.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/8ibrd1200395909.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/9gm221200395910.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0)) > plot(mylm, las = 1, sub='Residual Diagnostics') > par(opar) > dev.off() null device 1 > load(file='/var/www/html/rcomp/createtable') > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE) > a<-table.row.end(a) > myeq <- colnames(x)[1] > myeq <- paste(myeq, '[t] = ', sep='') > for (i in 1:k){ + if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '') + myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ') + if (rownames(mysum$coefficients)[i] != '(Intercept)') { + myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='') + if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='') + } + } > myeq <- paste(myeq, ' + e[t]') > a<-table.row.start(a) > a<-table.element(a, myeq) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/10iuhc1200395910.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,hyperlink('http://www.xycoon.com/ols1.htm','Multiple Linear Regression - Ordinary Least Squares',''), 6, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Variable',header=TRUE) > a<-table.element(a,'Parameter',header=TRUE) > a<-table.element(a,'S.D.',header=TRUE) > a<-table.element(a,'T-STAT
H0: parameter = 0',header=TRUE) > a<-table.element(a,'2-tail p-value',header=TRUE) > a<-table.element(a,'1-tail p-value',header=TRUE) > a<-table.row.end(a) > for (i in 1:k){ + a<-table.row.start(a) + a<-table.element(a,rownames(mysum$coefficients)[i],header=TRUE) + a<-table.element(a,mysum$coefficients[i,1]) + a<-table.element(a, round(mysum$coefficients[i,2],6)) + a<-table.element(a, round(mysum$coefficients[i,3],4)) + a<-table.element(a, round(mysum$coefficients[i,4],6)) + a<-table.element(a, round(mysum$coefficients[i,4]/2,6)) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/11f2yi1200395910.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Regression Statistics', 2, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Multiple R',1,TRUE) > a<-table.element(a, sqrt(mysum$r.squared)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'R-squared',1,TRUE) > a<-table.element(a, mysum$r.squared) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Adjusted R-squared',1,TRUE) > a<-table.element(a, mysum$adj.r.squared) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (value)',1,TRUE) > a<-table.element(a, mysum$fstatistic[1]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE) > a<-table.element(a, mysum$fstatistic[2]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE) > a<-table.element(a, mysum$fstatistic[3]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'p-value',1,TRUE) > a<-table.element(a, 1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3])) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Residual Statistics', 2, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Residual Standard Deviation',1,TRUE) > a<-table.element(a, mysum$sigma) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Sum Squared Residuals',1,TRUE) > a<-table.element(a, sum(myerror*myerror)) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/12orrt1200395910.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Actuals, Interpolation, and Residuals', 4, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Time or Index', 1, TRUE) > a<-table.element(a, 'Actuals', 1, TRUE) > a<-table.element(a, 'Interpolation
Forecast', 1, TRUE) > a<-table.element(a, 'Residuals
Prediction Error', 1, TRUE) > a<-table.row.end(a) > for (i in 1:n) { + a<-table.row.start(a) + a<-table.element(a,i, 1, TRUE) + a<-table.element(a,x[i]) + a<-table.element(a,x[i]-mysum$resid[i]) + a<-table.element(a,mysum$resid[i]) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/13l6bj1200395910.tab") > > system("convert tmp/1cr6x1200395909.ps tmp/1cr6x1200395909.png") > system("convert tmp/2hhaw1200395909.ps tmp/2hhaw1200395909.png") > system("convert tmp/33pg01200395909.ps tmp/33pg01200395909.png") > system("convert tmp/4lao71200395909.ps tmp/4lao71200395909.png") > system("convert tmp/51ony1200395909.ps tmp/51ony1200395909.png") > system("convert tmp/6ixnj1200395909.ps tmp/6ixnj1200395909.png") > system("convert tmp/791dr1200395909.ps tmp/791dr1200395909.png") > system("convert tmp/8ibrd1200395909.ps tmp/8ibrd1200395909.png") > system("convert tmp/9gm221200395910.ps tmp/9gm221200395910.png") > > > proc.time() user system elapsed 4.371 2.569 4.730