R version 2.11.1 (2010-05-31) Copyright (C) 2010 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(10 + ,14 + ,0 + ,11 + ,0 + ,24 + ,0 + ,26 + ,0 + ,14 + ,11 + ,11 + ,7 + ,7 + ,25 + ,25 + ,23 + ,23 + ,18 + ,6 + ,6 + ,17 + ,17 + ,30 + ,30 + ,25 + ,25 + ,15 + ,12 + ,0 + ,10 + ,0 + ,19 + ,0 + ,23 + ,0 + ,18 + ,8 + ,8 + ,12 + ,12 + ,22 + ,22 + ,19 + ,19 + ,11 + ,10 + ,10 + ,12 + ,12 + ,22 + ,22 + ,29 + ,29 + ,17 + ,10 + ,10 + ,11 + ,11 + ,25 + ,25 + ,25 + ,25 + ,19 + ,11 + ,11 + ,11 + ,11 + ,23 + ,23 + ,21 + ,21 + ,7 + ,16 + ,16 + ,12 + ,12 + ,17 + ,17 + ,22 + ,22 + ,12 + ,11 + ,11 + ,13 + ,13 + ,21 + ,21 + ,25 + ,25 + ,13 + ,13 + ,0 + ,14 + ,0 + ,19 + ,0 + ,24 + ,0 + ,15 + ,12 + ,12 + ,16 + ,16 + ,19 + ,19 + ,18 + ,18 + ,14 + ,8 + ,8 + ,11 + ,11 + ,15 + ,15 + ,22 + ,22 + ,14 + ,12 + ,12 + ,10 + ,10 + ,16 + ,16 + ,15 + ,15 + ,16 + ,11 + ,0 + ,11 + ,0 + ,23 + ,0 + ,22 + ,0 + ,16 + ,4 + ,0 + ,15 + ,0 + ,27 + ,0 + ,28 + ,0 + ,12 + ,9 + ,9 + ,9 + ,9 + ,22 + ,22 + ,20 + ,20 + ,12 + ,8 + ,0 + ,11 + ,0 + ,14 + ,0 + ,12 + ,0 + ,13 + ,8 + ,0 + ,17 + ,0 + ,22 + ,0 + ,24 + ,0 + ,16 + ,14 + ,14 + ,17 + ,17 + ,23 + ,23 + ,20 + ,20 + ,9 + ,15 + ,15 + ,11 + ,11 + ,23 + ,23 + ,21 + ,21 + ,11 + ,11 + ,0 + ,11 + ,0 + ,20 + ,0 + ,28 + ,0 + ,14 + ,8 + ,8 + ,15 + ,15 + ,23 + ,23 + ,24 + ,24 + ,11 + ,9 + ,0 + ,13 + ,0 + ,19 + ,0 + ,24 + ,0 + ,17 + ,9 + ,9 + ,13 + ,13 + ,22 + ,22 + ,23 + ,23 + ,14 + ,8 + ,8 + ,12 + ,12 + ,32 + ,32 + ,25 + ,25 + ,15 + ,9 + ,9 + ,17 + ,17 + ,25 + ,25 + ,21 + ,21 + ,11 + ,16 + ,0 + ,9 + ,0 + ,29 + ,0 + ,26 + ,0 + ,15 + ,11 + ,0 + ,9 + ,0 + ,28 + ,0 + ,22 + ,0 + ,14 + ,16 + ,0 + ,12 + ,0 + ,17 + ,0 + ,22 + ,0 + ,11 + ,12 + ,12 + ,18 + ,18 + ,28 + ,28 + ,22 + ,22 + ,12 + ,12 + ,0 + ,12 + ,0 + ,29 + ,0 + ,23 + ,0 + ,9 + ,10 + ,0 + ,15 + ,0 + ,14 + ,0 + ,17 + ,0 + ,16 + ,9 + ,9 + ,16 + ,16 + ,25 + ,25 + ,23 + ,23 + ,13 + ,10 + ,0 + ,10 + ,0 + ,26 + ,0 + ,23 + ,0 + ,15 + ,12 + ,0 + ,11 + ,0 + ,20 + ,0 + ,25 + ,0 + ,10 + ,14 + ,0 + ,9 + ,0 + ,32 + ,0 + ,24 + ,0 + ,13 + ,14 + ,14 + ,17 + ,17 + ,25 + ,25 + ,21 + ,21 + ,16 + ,10 + ,10 + ,12 + ,12 + ,20 + ,20 + ,28 + ,28 + ,15 + ,6 + ,6 + ,6 + ,6 + ,15 + ,15 + ,16 + ,16 + ,13 + ,13 + ,13 + ,12 + ,12 + ,24 + ,24 + ,29 + ,29 + ,16 + ,11 + ,0 + ,11 + ,0 + ,23 + ,0 + ,22 + ,0 + ,15 + ,7 + ,0 + ,7 + ,0 + ,22 + ,0 + ,28 + ,0 + ,16 + ,15 + ,15 + ,13 + ,13 + ,14 + ,14 + ,16 + ,16 + ,15 + ,9 + ,0 + ,12 + ,0 + ,24 + ,0 + ,25 + ,0 + ,13 + ,10 + ,0 + ,13 + ,0 + ,24 + ,0 + ,24 + ,0 + ,11 + ,10 + ,10 + ,12 + ,12 + ,22 + ,22 + ,29 + ,29 + ,17 + ,10 + ,0 + ,11 + ,0 + ,19 + ,0 + ,23 + ,0 + ,10 + ,11 + ,0 + ,9 + ,0 + ,31 + ,0 + ,30 + ,0 + ,17 + ,8 + ,0 + ,11 + ,0 + ,22 + ,0 + ,24 + ,0 + ,14 + ,13 + ,0 + ,10 + ,0 + ,19 + ,0 + ,25 + ,0 + ,15 + ,11 + ,11 + ,11 + ,11 + ,25 + ,25 + ,25 + ,25 + ,16 + ,9 + ,9 + ,15 + ,15 + ,27 + ,27 + ,26 + ,26 + ,12 + ,12 + ,12 + ,14 + ,14 + ,22 + ,22 + ,24 + ,24 + ,11 + ,12 + ,0 + ,13 + ,0 + ,19 + ,0 + ,22 + ,0 + ,16 + ,8 + ,8 + ,16 + ,16 + ,25 + ,25 + ,24 + ,24 + ,9 + ,14 + ,0 + ,8 + ,0 + ,19 + ,0 + ,27 + ,0 + ,15 + ,11 + ,0 + ,16 + ,0 + ,20 + ,0 + ,24 + ,0 + ,15 + ,10 + ,0 + ,12 + ,0 + ,17 + ,0 + ,21 + ,0 + ,13 + ,11 + ,0 + ,9 + ,0 + ,17 + ,0 + ,23 + ,0 + ,15 + ,10 + ,10 + ,15 + ,15 + ,22 + ,22 + ,20 + ,20 + ,15 + ,12 + ,12 + ,16 + ,16 + ,19 + ,19 + ,18 + ,18 + ,18 + ,8 + ,8 + ,15 + ,15 + ,21 + ,21 + ,22 + ,22 + ,16 + ,14 + ,0 + ,11 + ,0 + ,20 + ,0 + ,29 + ,0 + ,12 + ,14 + ,14 + ,11 + ,11 + ,17 + ,17 + ,15 + ,15 + ,15 + ,8 + ,8 + ,16 + ,16 + ,18 + ,18 + ,24 + ,24 + ,13 + ,6 + ,6 + ,8 + ,8 + ,29 + ,29 + ,23 + ,23 + ,13 + ,8 + ,8 + ,13 + ,13 + ,21 + ,21 + ,24 + ,24 + ,13 + ,14 + ,0 + ,15 + ,0 + ,22 + ,0 + ,24 + ,0 + ,14 + ,11 + ,11 + ,7 + ,7 + ,26 + ,26 + ,22 + ,22 + ,15 + ,11 + ,11 + ,12 + ,12 + ,17 + ,17 + ,16 + ,16 + ,11 + ,14 + ,14 + ,14 + ,14 + ,25 + ,25 + ,19 + ,19 + ,14 + ,11 + ,0 + ,17 + ,0 + ,21 + ,0 + ,23 + ,0 + ,17 + ,8 + ,8 + ,10 + ,10 + ,22 + ,22 + ,24 + ,24 + ,13 + ,11 + ,11 + ,13 + ,13 + ,24 + ,24 + ,18 + ,18 + ,12 + ,8 + ,8 + ,9 + ,9 + ,18 + ,18 + ,23 + ,23 + ,13 + ,13 + ,13 + ,12 + ,12 + ,22 + ,22 + ,15 + ,15 + ,16 + ,12 + ,12 + ,15 + ,15 + ,29 + ,29 + ,22 + ,22 + ,13 + ,9 + ,9 + ,12 + ,12 + ,10 + ,10 + ,13 + ,13 + ,19 + ,7 + ,7 + ,11 + ,11 + ,26 + ,26 + ,22 + ,22) + ,dim=c(9 + ,80) + ,dimnames=list(c('Perceived_happiness' + ,'Doubts_about_actions' + ,'Doubts_about_actions*G' + ,'Parental_expectations' + ,'Parental_expectations*G' + ,'Personal_standards' + ,'Personal_standards*G' + ,'Organization' + ,'Organization*G') + ,1:80)) > y <- array(NA,dim=c(9,80),dimnames=list(c('Perceived_happiness','Doubts_about_actions','Doubts_about_actions*G','Parental_expectations','Parental_expectations*G','Personal_standards','Personal_standards*G','Organization','Organization*G'),1:80)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = '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) > library(lmtest) Loading required package: zoo > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > 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 Perceived_happiness Doubts_about_actions Doubts_about_actions*G 1 10 14 0 2 14 11 11 3 18 6 6 4 15 12 0 5 18 8 8 6 11 10 10 7 17 10 10 8 19 11 11 9 7 16 16 10 12 11 11 11 13 13 0 12 15 12 12 13 14 8 8 14 14 12 12 15 16 11 0 16 16 4 0 17 12 9 9 18 12 8 0 19 13 8 0 20 16 14 14 21 9 15 15 22 11 11 0 23 14 8 8 24 11 9 0 25 17 9 9 26 14 8 8 27 15 9 9 28 11 16 0 29 15 11 0 30 14 16 0 31 11 12 12 32 12 12 0 33 9 10 0 34 16 9 9 35 13 10 0 36 15 12 0 37 10 14 0 38 13 14 14 39 16 10 10 40 15 6 6 41 13 13 13 42 16 11 0 43 15 7 0 44 16 15 15 45 15 9 0 46 13 10 0 47 11 10 10 48 17 10 0 49 10 11 0 50 17 8 0 51 14 13 0 52 15 11 11 53 16 9 9 54 12 12 12 55 11 12 0 56 16 8 8 57 9 14 0 58 15 11 0 59 15 10 0 60 13 11 0 61 15 10 10 62 15 12 12 63 18 8 8 64 16 14 0 65 12 14 14 66 15 8 8 67 13 6 6 68 13 8 8 69 13 14 0 70 14 11 11 71 15 11 11 72 11 14 14 73 14 11 0 74 17 8 8 75 13 11 11 76 12 8 8 77 13 13 13 78 16 12 12 79 13 9 9 80 19 7 7 Parental_expectations Parental_expectations*G Personal_standards 1 11 0 24 2 7 7 25 3 17 17 30 4 10 0 19 5 12 12 22 6 12 12 22 7 11 11 25 8 11 11 23 9 12 12 17 10 13 13 21 11 14 0 19 12 16 16 19 13 11 11 15 14 10 10 16 15 11 0 23 16 15 0 27 17 9 9 22 18 11 0 14 19 17 0 22 20 17 17 23 21 11 11 23 22 11 0 20 23 15 15 23 24 13 0 19 25 13 13 22 26 12 12 32 27 17 17 25 28 9 0 29 29 9 0 28 30 12 0 17 31 18 18 28 32 12 0 29 33 15 0 14 34 16 16 25 35 10 0 26 36 11 0 20 37 9 0 32 38 17 17 25 39 12 12 20 40 6 6 15 41 12 12 24 42 11 0 23 43 7 0 22 44 13 13 14 45 12 0 24 46 13 0 24 47 12 12 22 48 11 0 19 49 9 0 31 50 11 0 22 51 10 0 19 52 11 11 25 53 15 15 27 54 14 14 22 55 13 0 19 56 16 16 25 57 8 0 19 58 16 0 20 59 12 0 17 60 9 0 17 61 15 15 22 62 16 16 19 63 15 15 21 64 11 0 20 65 11 11 17 66 16 16 18 67 8 8 29 68 13 13 21 69 15 0 22 70 7 7 26 71 12 12 17 72 14 14 25 73 17 0 21 74 10 10 22 75 13 13 24 76 9 9 18 77 12 12 22 78 15 15 29 79 12 12 10 80 11 11 26 Personal_standards*G Organization Organization*G t 1 0 26 0 1 2 25 23 23 2 3 30 25 25 3 4 0 23 0 4 5 22 19 19 5 6 22 29 29 6 7 25 25 25 7 8 23 21 21 8 9 17 22 22 9 10 21 25 25 10 11 0 24 0 11 12 19 18 18 12 13 15 22 22 13 14 16 15 15 14 15 0 22 0 15 16 0 28 0 16 17 22 20 20 17 18 0 12 0 18 19 0 24 0 19 20 23 20 20 20 21 23 21 21 21 22 0 28 0 22 23 23 24 24 23 24 0 24 0 24 25 22 23 23 25 26 32 25 25 26 27 25 21 21 27 28 0 26 0 28 29 0 22 0 29 30 0 22 0 30 31 28 22 22 31 32 0 23 0 32 33 0 17 0 33 34 25 23 23 34 35 0 23 0 35 36 0 25 0 36 37 0 24 0 37 38 25 21 21 38 39 20 28 28 39 40 15 16 16 40 41 24 29 29 41 42 0 22 0 42 43 0 28 0 43 44 14 16 16 44 45 0 25 0 45 46 0 24 0 46 47 22 29 29 47 48 0 23 0 48 49 0 30 0 49 50 0 24 0 50 51 0 25 0 51 52 25 25 25 52 53 27 26 26 53 54 22 24 24 54 55 0 22 0 55 56 25 24 24 56 57 0 27 0 57 58 0 24 0 58 59 0 21 0 59 60 0 23 0 60 61 22 20 20 61 62 19 18 18 62 63 21 22 22 63 64 0 29 0 64 65 17 15 15 65 66 18 24 24 66 67 29 23 23 67 68 21 24 24 68 69 0 24 0 69 70 26 22 22 70 71 17 16 16 71 72 25 19 19 72 73 0 23 0 73 74 22 24 24 74 75 24 18 18 75 76 18 23 23 76 77 22 15 15 77 78 29 22 22 78 79 10 13 13 79 80 26 22 22 80 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Doubts_about_actions 18.070351 -0.345269 `Doubts_about_actions*G` Parental_expectations -0.169899 -0.055128 `Parental_expectations*G` Personal_standards 0.246452 -0.077070 `Personal_standards*G` Organization 0.172410 0.056920 `Organization*G` t -0.200014 0.001510 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -4.72922 -1.72674 -0.08011 1.62980 5.29199 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 18.07035 2.56525 7.044 1.04e-09 *** Doubts_about_actions -0.34527 0.14774 -2.337 0.0223 * `Doubts_about_actions*G` -0.16990 0.18298 -0.928 0.3563 Parental_expectations -0.05513 0.13856 -0.398 0.6919 `Parental_expectations*G` 0.24645 0.17258 1.428 0.1577 Personal_standards -0.07707 0.10012 -0.770 0.4440 `Personal_standards*G` 0.17241 0.13208 1.305 0.1960 Organization 0.05692 0.12335 0.461 0.6459 `Organization*G` -0.20001 0.14675 -1.363 0.1773 t 0.00151 0.01117 0.135 0.8929 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.252 on 70 degrees of freedom Multiple R-squared: 0.2686, Adjusted R-squared: 0.1745 F-statistic: 2.856 on 9 and 70 DF, p-value: 0.006318 > if (n > n25) { + kp3 <- k + 3 + nmkm3 <- n - k - 3 + gqarr <- array(NA, dim=c(nmkm3-kp3+1,3)) + numgqtests <- 0 + numsignificant1 <- 0 + numsignificant5 <- 0 + numsignificant10 <- 0 + for (mypoint in kp3:nmkm3) { + j <- 0 + numgqtests <- numgqtests + 1 + for (myalt in c('greater', 'two.sided', 'less')) { + j <- j + 1 + gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value + } + if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1 + } + gqarr + } [,1] [,2] [,3] [1,] 0.4377722 0.8755445 0.56222777 [2,] 0.5823815 0.8352370 0.41761852 [3,] 0.4585966 0.9171933 0.54140336 [4,] 0.3858734 0.7717467 0.61412663 [5,] 0.8292780 0.3414439 0.17072196 [6,] 0.8857716 0.2284568 0.11422842 [7,] 0.8298225 0.3403549 0.17017746 [8,] 0.8019358 0.3961285 0.19806425 [9,] 0.8312278 0.3375444 0.16877220 [10,] 0.8140587 0.3718827 0.18594133 [11,] 0.7532549 0.4934901 0.24674507 [12,] 0.7390199 0.5219603 0.26098015 [13,] 0.7970648 0.4058703 0.20293516 [14,] 0.7707706 0.4584589 0.22922944 [15,] 0.7159125 0.5681751 0.28408754 [16,] 0.6474914 0.7050173 0.35250863 [17,] 0.6219652 0.7560696 0.37803481 [18,] 0.7604820 0.4790360 0.23951802 [19,] 0.8273653 0.3452695 0.17263474 [20,] 0.7755581 0.4488839 0.22444194 [21,] 0.9064794 0.1870412 0.09352058 [22,] 0.8862983 0.2274034 0.11370172 [23,] 0.8467091 0.3065818 0.15329091 [24,] 0.8503732 0.2992537 0.14962685 [25,] 0.8277065 0.3445869 0.17229345 [26,] 0.8061175 0.3877649 0.19388246 [27,] 0.8638198 0.2723604 0.13618018 [28,] 0.8273934 0.3452133 0.17260665 [29,] 0.7951172 0.4097657 0.20488283 [30,] 0.8567790 0.2864421 0.14322103 [31,] 0.8459254 0.3081493 0.15407464 [32,] 0.9354240 0.1291519 0.06457596 [33,] 0.9113489 0.1773022 0.08865110 [34,] 0.8767524 0.2464953 0.12324764 [35,] 0.8716222 0.2567555 0.12837776 [36,] 0.8898659 0.2202682 0.11013410 [37,] 0.8930548 0.2138904 0.10694521 [38,] 0.8904771 0.2190458 0.10952292 [39,] 0.8922751 0.2154498 0.10772490 [40,] 0.8902929 0.2194141 0.10970705 [41,] 0.8542803 0.2914394 0.14571972 [42,] 0.8082227 0.3835546 0.19177731 [43,] 0.7838497 0.4323007 0.21615033 [44,] 0.7129593 0.5740814 0.28704069 [45,] 0.7759590 0.4480820 0.22404102 [46,] 0.7186348 0.5627304 0.28136522 [47,] 0.6404673 0.7190654 0.35953268 [48,] 0.5451656 0.9096688 0.45483438 [49,] 0.4425117 0.8850235 0.55748826 [50,] 0.3587374 0.7174748 0.64126260 [51,] 0.4340530 0.8681059 0.56594703 [52,] 0.3462471 0.6924942 0.65375292 [53,] 0.2896742 0.5793484 0.71032580 [54,] 0.2167545 0.4335091 0.78324547 [55,] 0.2877372 0.5754744 0.71226278 > postscript(file="/var/www/rcomp/tmp/1x3gb1290530486.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/rcomp/tmp/2x3gb1290530486.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/rcomp/tmp/38cfw1290530486.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/rcomp/tmp/48cfw1290530486.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/rcomp/tmp/58cfw1290530486.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mysum$resid, main='Residual Normal Q-Q Plot') > qqline(mysum$resid) > grid() > dev.off() null device 1 > (myerror <- as.ts(mysum$resid)) Time Series: Start = 1 End = 80 Frequency = 1 1 2 3 4 5 6 -2.26193114 1.16184916 0.48074853 1.77328463 2.36884546 -2.17139332 7 8 9 10 11 12 3.16002568 5.29199019 -3.60986968 -1.33062160 0.27157788 0.79658111 13 14 15 16 17 18 -0.35524359 0.79824566 2.83173949 0.60061935 -2.41703606 -2.33302549 19 20 21 22 23 24 -1.07024857 2.52834187 -2.66696334 -2.75155812 -1.61217002 -3.18424888 25 26 27 28 29 30 2.23487303 -1.75769669 -1.10564969 -0.33705553 2.08570123 2.12814783 31 32 33 34 35 36 -3.90043649 -0.38802513 -4.72922001 0.36129467 -0.42455723 1.74333774 37 38 39 40 41 42 -1.69612825 -0.54641662 2.82637973 -0.32827776 1.13059546 2.79098249 43 44 45 46 47 48 -0.23070417 4.05826546 1.05735392 -0.48683890 -2.23328358 3.07145600 49 50 51 52 53 54 -3.16863963 2.55218960 0.93376586 1.60726490 0.76253765 -1.31163065 55 56 57 58 59 60 -2.08139733 -0.04398872 -3.95411825 1.69741860 1.06967906 -0.86578524 61 62 63 64 65 66 -0.11623051 0.72110518 2.23194284 3.16392841 -0.53506891 -0.39170136 67 68 69 70 71 72 -3.08479264 -2.10676990 0.81563275 0.82076797 0.86214102 -2.30995579 73 74 75 76 77 78 0.86389383 2.36280422 -1.71641634 -2.21062306 -0.73637637 1.50724736 79 80 -1.94216838 2.97970711 > postscript(file="/var/www/rcomp/tmp/6jmez1290530486.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 = 80 Frequency = 1 lag(myerror, k = 1) myerror 0 -2.26193114 NA 1 1.16184916 -2.26193114 2 0.48074853 1.16184916 3 1.77328463 0.48074853 4 2.36884546 1.77328463 5 -2.17139332 2.36884546 6 3.16002568 -2.17139332 7 5.29199019 3.16002568 8 -3.60986968 5.29199019 9 -1.33062160 -3.60986968 10 0.27157788 -1.33062160 11 0.79658111 0.27157788 12 -0.35524359 0.79658111 13 0.79824566 -0.35524359 14 2.83173949 0.79824566 15 0.60061935 2.83173949 16 -2.41703606 0.60061935 17 -2.33302549 -2.41703606 18 -1.07024857 -2.33302549 19 2.52834187 -1.07024857 20 -2.66696334 2.52834187 21 -2.75155812 -2.66696334 22 -1.61217002 -2.75155812 23 -3.18424888 -1.61217002 24 2.23487303 -3.18424888 25 -1.75769669 2.23487303 26 -1.10564969 -1.75769669 27 -0.33705553 -1.10564969 28 2.08570123 -0.33705553 29 2.12814783 2.08570123 30 -3.90043649 2.12814783 31 -0.38802513 -3.90043649 32 -4.72922001 -0.38802513 33 0.36129467 -4.72922001 34 -0.42455723 0.36129467 35 1.74333774 -0.42455723 36 -1.69612825 1.74333774 37 -0.54641662 -1.69612825 38 2.82637973 -0.54641662 39 -0.32827776 2.82637973 40 1.13059546 -0.32827776 41 2.79098249 1.13059546 42 -0.23070417 2.79098249 43 4.05826546 -0.23070417 44 1.05735392 4.05826546 45 -0.48683890 1.05735392 46 -2.23328358 -0.48683890 47 3.07145600 -2.23328358 48 -3.16863963 3.07145600 49 2.55218960 -3.16863963 50 0.93376586 2.55218960 51 1.60726490 0.93376586 52 0.76253765 1.60726490 53 -1.31163065 0.76253765 54 -2.08139733 -1.31163065 55 -0.04398872 -2.08139733 56 -3.95411825 -0.04398872 57 1.69741860 -3.95411825 58 1.06967906 1.69741860 59 -0.86578524 1.06967906 60 -0.11623051 -0.86578524 61 0.72110518 -0.11623051 62 2.23194284 0.72110518 63 3.16392841 2.23194284 64 -0.53506891 3.16392841 65 -0.39170136 -0.53506891 66 -3.08479264 -0.39170136 67 -2.10676990 -3.08479264 68 0.81563275 -2.10676990 69 0.82076797 0.81563275 70 0.86214102 0.82076797 71 -2.30995579 0.86214102 72 0.86389383 -2.30995579 73 2.36280422 0.86389383 74 -1.71641634 2.36280422 75 -2.21062306 -1.71641634 76 -0.73637637 -2.21062306 77 1.50724736 -0.73637637 78 -1.94216838 1.50724736 79 2.97970711 -1.94216838 80 NA 2.97970711 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 1.16184916 -2.26193114 [2,] 0.48074853 1.16184916 [3,] 1.77328463 0.48074853 [4,] 2.36884546 1.77328463 [5,] -2.17139332 2.36884546 [6,] 3.16002568 -2.17139332 [7,] 5.29199019 3.16002568 [8,] -3.60986968 5.29199019 [9,] -1.33062160 -3.60986968 [10,] 0.27157788 -1.33062160 [11,] 0.79658111 0.27157788 [12,] -0.35524359 0.79658111 [13,] 0.79824566 -0.35524359 [14,] 2.83173949 0.79824566 [15,] 0.60061935 2.83173949 [16,] -2.41703606 0.60061935 [17,] -2.33302549 -2.41703606 [18,] -1.07024857 -2.33302549 [19,] 2.52834187 -1.07024857 [20,] -2.66696334 2.52834187 [21,] -2.75155812 -2.66696334 [22,] -1.61217002 -2.75155812 [23,] -3.18424888 -1.61217002 [24,] 2.23487303 -3.18424888 [25,] -1.75769669 2.23487303 [26,] -1.10564969 -1.75769669 [27,] -0.33705553 -1.10564969 [28,] 2.08570123 -0.33705553 [29,] 2.12814783 2.08570123 [30,] -3.90043649 2.12814783 [31,] -0.38802513 -3.90043649 [32,] -4.72922001 -0.38802513 [33,] 0.36129467 -4.72922001 [34,] -0.42455723 0.36129467 [35,] 1.74333774 -0.42455723 [36,] -1.69612825 1.74333774 [37,] -0.54641662 -1.69612825 [38,] 2.82637973 -0.54641662 [39,] -0.32827776 2.82637973 [40,] 1.13059546 -0.32827776 [41,] 2.79098249 1.13059546 [42,] -0.23070417 2.79098249 [43,] 4.05826546 -0.23070417 [44,] 1.05735392 4.05826546 [45,] -0.48683890 1.05735392 [46,] -2.23328358 -0.48683890 [47,] 3.07145600 -2.23328358 [48,] -3.16863963 3.07145600 [49,] 2.55218960 -3.16863963 [50,] 0.93376586 2.55218960 [51,] 1.60726490 0.93376586 [52,] 0.76253765 1.60726490 [53,] -1.31163065 0.76253765 [54,] -2.08139733 -1.31163065 [55,] -0.04398872 -2.08139733 [56,] -3.95411825 -0.04398872 [57,] 1.69741860 -3.95411825 [58,] 1.06967906 1.69741860 [59,] -0.86578524 1.06967906 [60,] -0.11623051 -0.86578524 [61,] 0.72110518 -0.11623051 [62,] 2.23194284 0.72110518 [63,] 3.16392841 2.23194284 [64,] -0.53506891 3.16392841 [65,] -0.39170136 -0.53506891 [66,] -3.08479264 -0.39170136 [67,] -2.10676990 -3.08479264 [68,] 0.81563275 -2.10676990 [69,] 0.82076797 0.81563275 [70,] 0.86214102 0.82076797 [71,] -2.30995579 0.86214102 [72,] 0.86389383 -2.30995579 [73,] 2.36280422 0.86389383 [74,] -1.71641634 2.36280422 [75,] -2.21062306 -1.71641634 [76,] -0.73637637 -2.21062306 [77,] 1.50724736 -0.73637637 [78,] -1.94216838 1.50724736 [79,] 2.97970711 -1.94216838 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 1.16184916 -2.26193114 2 0.48074853 1.16184916 3 1.77328463 0.48074853 4 2.36884546 1.77328463 5 -2.17139332 2.36884546 6 3.16002568 -2.17139332 7 5.29199019 3.16002568 8 -3.60986968 5.29199019 9 -1.33062160 -3.60986968 10 0.27157788 -1.33062160 11 0.79658111 0.27157788 12 -0.35524359 0.79658111 13 0.79824566 -0.35524359 14 2.83173949 0.79824566 15 0.60061935 2.83173949 16 -2.41703606 0.60061935 17 -2.33302549 -2.41703606 18 -1.07024857 -2.33302549 19 2.52834187 -1.07024857 20 -2.66696334 2.52834187 21 -2.75155812 -2.66696334 22 -1.61217002 -2.75155812 23 -3.18424888 -1.61217002 24 2.23487303 -3.18424888 25 -1.75769669 2.23487303 26 -1.10564969 -1.75769669 27 -0.33705553 -1.10564969 28 2.08570123 -0.33705553 29 2.12814783 2.08570123 30 -3.90043649 2.12814783 31 -0.38802513 -3.90043649 32 -4.72922001 -0.38802513 33 0.36129467 -4.72922001 34 -0.42455723 0.36129467 35 1.74333774 -0.42455723 36 -1.69612825 1.74333774 37 -0.54641662 -1.69612825 38 2.82637973 -0.54641662 39 -0.32827776 2.82637973 40 1.13059546 -0.32827776 41 2.79098249 1.13059546 42 -0.23070417 2.79098249 43 4.05826546 -0.23070417 44 1.05735392 4.05826546 45 -0.48683890 1.05735392 46 -2.23328358 -0.48683890 47 3.07145600 -2.23328358 48 -3.16863963 3.07145600 49 2.55218960 -3.16863963 50 0.93376586 2.55218960 51 1.60726490 0.93376586 52 0.76253765 1.60726490 53 -1.31163065 0.76253765 54 -2.08139733 -1.31163065 55 -0.04398872 -2.08139733 56 -3.95411825 -0.04398872 57 1.69741860 -3.95411825 58 1.06967906 1.69741860 59 -0.86578524 1.06967906 60 -0.11623051 -0.86578524 61 0.72110518 -0.11623051 62 2.23194284 0.72110518 63 3.16392841 2.23194284 64 -0.53506891 3.16392841 65 -0.39170136 -0.53506891 66 -3.08479264 -0.39170136 67 -2.10676990 -3.08479264 68 0.81563275 -2.10676990 69 0.82076797 0.81563275 70 0.86214102 0.82076797 71 -2.30995579 0.86214102 72 0.86389383 -2.30995579 73 2.36280422 0.86389383 74 -1.71641634 2.36280422 75 -2.21062306 -1.71641634 76 -0.73637637 -2.21062306 77 1.50724736 -0.73637637 78 -1.94216838 1.50724736 79 2.97970711 -1.94216838 > 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/rcomp/tmp/7cdw21290530486.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/rcomp/tmp/8cdw21290530486.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/rcomp/tmp/9cdw21290530486.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 > if (n > n25) { + postscript(file="/var/www/rcomp/tmp/104mvn1290530486.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) + plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint') + grid() + dev.off() + } null device 1 > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/1185ca1290530486.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/rcomp/tmp/12tnay1290530486.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/rcomp/tmp/13067s1290530486.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/rcomp/tmp/14sfod1290530486.tab") > if (n > n25) { + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Goldfeld-Quandt test for Heteroskedasticity',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'p-values',header=TRUE) + a<-table.element(a,'Alternative Hypothesis',3,header=TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'breakpoint index',header=TRUE) + a<-table.element(a,'greater',header=TRUE) + a<-table.element(a,'2-sided',header=TRUE) + a<-table.element(a,'less',header=TRUE) + a<-table.row.end(a) + for (mypoint in kp3:nmkm3) { + a<-table.row.start(a) + a<-table.element(a,mypoint,header=TRUE) + a<-table.element(a,gqarr[mypoint-kp3+1,1]) + a<-table.element(a,gqarr[mypoint-kp3+1,2]) + a<-table.element(a,gqarr[mypoint-kp3+1,3]) + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/www/rcomp/tmp/15egn11290530486.tab") + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Description',header=TRUE) + a<-table.element(a,'# significant tests',header=TRUE) + a<-table.element(a,'% significant tests',header=TRUE) + a<-table.element(a,'OK/NOK',header=TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'1% type I error level',header=TRUE) + a<-table.element(a,numsignificant1) + a<-table.element(a,numsignificant1/numgqtests) + if (numsignificant1/numgqtests < 0.01) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'5% type I error level',header=TRUE) + a<-table.element(a,numsignificant5) + a<-table.element(a,numsignificant5/numgqtests) + if (numsignificant5/numgqtests < 0.05) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'10% type I error level',header=TRUE) + a<-table.element(a,numsignificant10) + a<-table.element(a,numsignificant10/numgqtests) + if (numsignificant10/numgqtests < 0.1) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.end(a) + table.save(a,file="/var/www/rcomp/tmp/16s8391290530486.tab") + } > try(system("convert tmp/1x3gb1290530486.ps tmp/1x3gb1290530486.png",intern=TRUE)) character(0) > try(system("convert tmp/2x3gb1290530486.ps tmp/2x3gb1290530486.png",intern=TRUE)) character(0) > try(system("convert tmp/38cfw1290530486.ps tmp/38cfw1290530486.png",intern=TRUE)) character(0) > try(system("convert tmp/48cfw1290530486.ps tmp/48cfw1290530486.png",intern=TRUE)) character(0) > try(system("convert tmp/58cfw1290530486.ps tmp/58cfw1290530486.png",intern=TRUE)) character(0) > try(system("convert tmp/6jmez1290530486.ps tmp/6jmez1290530486.png",intern=TRUE)) character(0) > try(system("convert tmp/7cdw21290530486.ps tmp/7cdw21290530486.png",intern=TRUE)) character(0) > try(system("convert tmp/8cdw21290530486.ps tmp/8cdw21290530486.png",intern=TRUE)) character(0) > try(system("convert tmp/9cdw21290530486.ps tmp/9cdw21290530486.png",intern=TRUE)) character(0) > try(system("convert tmp/104mvn1290530486.ps tmp/104mvn1290530486.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.110 2.070 6.183