Free Statistics

of Irreproducible Research!

Author's title

Author*Unverified author*
R Software Modulerwasp_multipleregression.wasp
Title produced by softwareMultiple Regression
Date of computationWed, 21 Nov 2007 16:15:18 -0700
Cite this page as followsStatistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?v=date/2007/Nov/22/t11956864880f3wcjmo5w65avt.htm/, Retrieved Thu, 02 May 2024 15:05:41 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=5903, Retrieved Thu, 02 May 2024 15:05:41 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywordsdummy
Estimated Impact208
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
-       [Multiple Regression] [Workshop Q3 herst...] [2007-11-21 23:15:18] [44cf2be50bc8700e14714598feda9df9] [Current]
Feedback Forum

Post a new message
Dataseries X:
523	0
519	0
509	0
512	0
519	0
517	0
510	0
509	0
501	0
507	0
569	0
580	0
578	1
565	1
547	1
555	0
562	0
561	0
555	0
544	0
537	0
543	0
594	0
611	1
613	1
611	1
594	1
595	1
591	0
589	0
584	0
573	0
567	0
569	0
621	0
629	0
628	0
612	0
595	0
597	0
593	0
590	0
580	0
574	0
573	0
573	0
620	0
626	0
620	0
588	1
566	1
557	1
561	0
549	0
532	0
526	0
511	0
499	0
555	0
565	0
542	0




Summary of compuational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time8 seconds
R Server'Herman Ole Andreas Wold' @ 193.190.124.10:1001

\begin{tabular}{lllllllll}
\hline
Summary of compuational transaction \tabularnewline
Raw Input & view raw input (R code)  \tabularnewline
Raw Output & view raw output of R engine  \tabularnewline
Computing time & 8 seconds \tabularnewline
R Server & 'Herman Ole Andreas Wold' @ 193.190.124.10:1001 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=5903&T=0

[TABLE]
[ROW][C]Summary of compuational transaction[/C][/ROW]
[ROW][C]Raw Input[/C][C]view raw input (R code) [/C][/ROW]
[ROW][C]Raw Output[/C][C]view raw output of R engine [/C][/ROW]
[ROW][C]Computing time[/C][C]8 seconds[/C][/ROW]
[ROW][C]R Server[/C][C]'Herman Ole Andreas Wold' @ 193.190.124.10:1001[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=5903&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=5903&T=0

As an alternative you can also use a QR Code:  

The GUIDs for individual cells are displayed in the table below:

Summary of compuational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time8 seconds
R Server'Herman Ole Andreas Wold' @ 193.190.124.10:1001







Multiple Linear Regression - Estimated Regression Equation
y[t] = + 561.4 + 22.6909090909091x[t] + e[t]

\begin{tabular}{lllllllll}
\hline
Multiple Linear Regression - Estimated Regression Equation \tabularnewline
y[t] =  +  561.4 +  22.6909090909091x[t]  + e[t] \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=5903&T=1

[TABLE]
[ROW][C]Multiple Linear Regression - Estimated Regression Equation[/C][/ROW]
[ROW][C]y[t] =  +  561.4 +  22.6909090909091x[t]  + e[t][/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=5903&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=5903&T=1

As an alternative you can also use a QR Code:  

The GUIDs for individual cells are displayed in the table below:

Multiple Linear Regression - Estimated Regression Equation
y[t] = + 561.4 + 22.6909090909091x[t] + e[t]







Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STATH0: parameter = 02-tail p-value1-tail p-value
(Intercept)561.45.042763111.327900
x22.690909090909111.8750971.91080.0608930.030447

\begin{tabular}{lllllllll}
\hline
Multiple Linear Regression - Ordinary Least Squares \tabularnewline
Variable & Parameter & S.D. & T-STATH0: parameter = 0 & 2-tail p-value & 1-tail p-value \tabularnewline
(Intercept) & 561.4 & 5.042763 & 111.3279 & 0 & 0 \tabularnewline
x & 22.6909090909091 & 11.875097 & 1.9108 & 0.060893 & 0.030447 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=5903&T=2

[TABLE]
[ROW][C]Multiple Linear Regression - Ordinary Least Squares[/C][/ROW]
[ROW][C]Variable[/C][C]Parameter[/C][C]S.D.[/C][C]T-STATH0: parameter = 0[/C][C]2-tail p-value[/C][C]1-tail p-value[/C][/ROW]
[ROW][C](Intercept)[/C][C]561.4[/C][C]5.042763[/C][C]111.3279[/C][C]0[/C][C]0[/C][/ROW]
[ROW][C]x[/C][C]22.6909090909091[/C][C]11.875097[/C][C]1.9108[/C][C]0.060893[/C][C]0.030447[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=5903&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=5903&T=2

As an alternative you can also use a QR Code:  

The GUIDs for individual cells are displayed in the table below:

Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STATH0: parameter = 02-tail p-value1-tail p-value
(Intercept)561.45.042763111.327900
x22.690909090909111.8750971.91080.0608930.030447







Multiple Linear Regression - Regression Statistics
Multiple R0.241407204914485
R-squared0.0582774385846243
Adjusted R-squared0.0423160392386011
F-TEST (value)3.65114845642552
F-TEST (DF numerator)1
F-TEST (DF denominator)59
p-value0.0608933048341368
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation35.6577205586551
Sum Squared Residuals75016.9090909091

\begin{tabular}{lllllllll}
\hline
Multiple Linear Regression - Regression Statistics \tabularnewline
Multiple R & 0.241407204914485 \tabularnewline
R-squared & 0.0582774385846243 \tabularnewline
Adjusted R-squared & 0.0423160392386011 \tabularnewline
F-TEST (value) & 3.65114845642552 \tabularnewline
F-TEST (DF numerator) & 1 \tabularnewline
F-TEST (DF denominator) & 59 \tabularnewline
p-value & 0.0608933048341368 \tabularnewline
Multiple Linear Regression - Residual Statistics \tabularnewline
Residual Standard Deviation & 35.6577205586551 \tabularnewline
Sum Squared Residuals & 75016.9090909091 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=5903&T=3

[TABLE]
[ROW][C]Multiple Linear Regression - Regression Statistics[/C][/ROW]
[ROW][C]Multiple R[/C][C]0.241407204914485[/C][/ROW]
[ROW][C]R-squared[/C][C]0.0582774385846243[/C][/ROW]
[ROW][C]Adjusted R-squared[/C][C]0.0423160392386011[/C][/ROW]
[ROW][C]F-TEST (value)[/C][C]3.65114845642552[/C][/ROW]
[ROW][C]F-TEST (DF numerator)[/C][C]1[/C][/ROW]
[ROW][C]F-TEST (DF denominator)[/C][C]59[/C][/ROW]
[ROW][C]p-value[/C][C]0.0608933048341368[/C][/ROW]
[ROW][C]Multiple Linear Regression - Residual Statistics[/C][/ROW]
[ROW][C]Residual Standard Deviation[/C][C]35.6577205586551[/C][/ROW]
[ROW][C]Sum Squared Residuals[/C][C]75016.9090909091[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=5903&T=3

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=5903&T=3

As an alternative you can also use a QR Code:  

The GUIDs for individual cells are displayed in the table below:

Multiple Linear Regression - Regression Statistics
Multiple R0.241407204914485
R-squared0.0582774385846243
Adjusted R-squared0.0423160392386011
F-TEST (value)3.65114845642552
F-TEST (DF numerator)1
F-TEST (DF denominator)59
p-value0.0608933048341368
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation35.6577205586551
Sum Squared Residuals75016.9090909091







Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolationForecastResidualsPrediction Error
1523561.4-38.4000000000001
2519561.4-42.4
3509561.4-52.4
4512561.4-49.4
5519561.4-42.4
6517561.4-44.4
7510561.4-51.4
8509561.4-52.4
9501561.4-60.4
10507561.4-54.4
11569561.47.6
12580561.418.6
13578584.090909090909-6.09090909090909
14565584.090909090909-19.0909090909091
15547584.090909090909-37.0909090909091
16555561.4-6.4
17562561.40.600000000000003
18561561.4-0.399999999999997
19555561.4-6.4
20544561.4-17.4
21537561.4-24.4
22543561.4-18.4
23594561.432.6
24611584.09090909090926.9090909090909
25613584.09090909090928.9090909090909
26611584.09090909090926.9090909090909
27594584.0909090909099.9090909090909
28595584.09090909090910.9090909090909
29591561.429.6
30589561.427.6
31584561.422.6
32573561.411.6
33567561.45.6
34569561.47.6
35621561.459.6
36629561.467.6
37628561.466.6
38612561.450.6
39595561.433.6
40597561.435.6
41593561.431.6
42590561.428.6
43580561.418.6
44574561.412.6
45573561.411.6
46573561.411.6
47620561.458.6
48626561.464.6
49620561.458.6
50588584.0909090909093.90909090909091
51566584.090909090909-18.0909090909091
52557584.090909090909-27.0909090909091
53561561.4-0.399999999999997
54549561.4-12.4
55532561.4-29.4
56526561.4-35.4
57511561.4-50.4
58499561.4-62.4
59555561.4-6.4
60565561.43.60000000000000
61542561.4-19.4

\begin{tabular}{lllllllll}
\hline
Multiple Linear Regression - Actuals, Interpolation, and Residuals \tabularnewline
Time or Index & Actuals & InterpolationForecast & ResidualsPrediction Error \tabularnewline
1 & 523 & 561.4 & -38.4000000000001 \tabularnewline
2 & 519 & 561.4 & -42.4 \tabularnewline
3 & 509 & 561.4 & -52.4 \tabularnewline
4 & 512 & 561.4 & -49.4 \tabularnewline
5 & 519 & 561.4 & -42.4 \tabularnewline
6 & 517 & 561.4 & -44.4 \tabularnewline
7 & 510 & 561.4 & -51.4 \tabularnewline
8 & 509 & 561.4 & -52.4 \tabularnewline
9 & 501 & 561.4 & -60.4 \tabularnewline
10 & 507 & 561.4 & -54.4 \tabularnewline
11 & 569 & 561.4 & 7.6 \tabularnewline
12 & 580 & 561.4 & 18.6 \tabularnewline
13 & 578 & 584.090909090909 & -6.09090909090909 \tabularnewline
14 & 565 & 584.090909090909 & -19.0909090909091 \tabularnewline
15 & 547 & 584.090909090909 & -37.0909090909091 \tabularnewline
16 & 555 & 561.4 & -6.4 \tabularnewline
17 & 562 & 561.4 & 0.600000000000003 \tabularnewline
18 & 561 & 561.4 & -0.399999999999997 \tabularnewline
19 & 555 & 561.4 & -6.4 \tabularnewline
20 & 544 & 561.4 & -17.4 \tabularnewline
21 & 537 & 561.4 & -24.4 \tabularnewline
22 & 543 & 561.4 & -18.4 \tabularnewline
23 & 594 & 561.4 & 32.6 \tabularnewline
24 & 611 & 584.090909090909 & 26.9090909090909 \tabularnewline
25 & 613 & 584.090909090909 & 28.9090909090909 \tabularnewline
26 & 611 & 584.090909090909 & 26.9090909090909 \tabularnewline
27 & 594 & 584.090909090909 & 9.9090909090909 \tabularnewline
28 & 595 & 584.090909090909 & 10.9090909090909 \tabularnewline
29 & 591 & 561.4 & 29.6 \tabularnewline
30 & 589 & 561.4 & 27.6 \tabularnewline
31 & 584 & 561.4 & 22.6 \tabularnewline
32 & 573 & 561.4 & 11.6 \tabularnewline
33 & 567 & 561.4 & 5.6 \tabularnewline
34 & 569 & 561.4 & 7.6 \tabularnewline
35 & 621 & 561.4 & 59.6 \tabularnewline
36 & 629 & 561.4 & 67.6 \tabularnewline
37 & 628 & 561.4 & 66.6 \tabularnewline
38 & 612 & 561.4 & 50.6 \tabularnewline
39 & 595 & 561.4 & 33.6 \tabularnewline
40 & 597 & 561.4 & 35.6 \tabularnewline
41 & 593 & 561.4 & 31.6 \tabularnewline
42 & 590 & 561.4 & 28.6 \tabularnewline
43 & 580 & 561.4 & 18.6 \tabularnewline
44 & 574 & 561.4 & 12.6 \tabularnewline
45 & 573 & 561.4 & 11.6 \tabularnewline
46 & 573 & 561.4 & 11.6 \tabularnewline
47 & 620 & 561.4 & 58.6 \tabularnewline
48 & 626 & 561.4 & 64.6 \tabularnewline
49 & 620 & 561.4 & 58.6 \tabularnewline
50 & 588 & 584.090909090909 & 3.90909090909091 \tabularnewline
51 & 566 & 584.090909090909 & -18.0909090909091 \tabularnewline
52 & 557 & 584.090909090909 & -27.0909090909091 \tabularnewline
53 & 561 & 561.4 & -0.399999999999997 \tabularnewline
54 & 549 & 561.4 & -12.4 \tabularnewline
55 & 532 & 561.4 & -29.4 \tabularnewline
56 & 526 & 561.4 & -35.4 \tabularnewline
57 & 511 & 561.4 & -50.4 \tabularnewline
58 & 499 & 561.4 & -62.4 \tabularnewline
59 & 555 & 561.4 & -6.4 \tabularnewline
60 & 565 & 561.4 & 3.60000000000000 \tabularnewline
61 & 542 & 561.4 & -19.4 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=5903&T=4

[TABLE]
[ROW][C]Multiple Linear Regression - Actuals, Interpolation, and Residuals[/C][/ROW]
[ROW][C]Time or Index[/C][C]Actuals[/C][C]InterpolationForecast[/C][C]ResidualsPrediction Error[/C][/ROW]
[ROW][C]1[/C][C]523[/C][C]561.4[/C][C]-38.4000000000001[/C][/ROW]
[ROW][C]2[/C][C]519[/C][C]561.4[/C][C]-42.4[/C][/ROW]
[ROW][C]3[/C][C]509[/C][C]561.4[/C][C]-52.4[/C][/ROW]
[ROW][C]4[/C][C]512[/C][C]561.4[/C][C]-49.4[/C][/ROW]
[ROW][C]5[/C][C]519[/C][C]561.4[/C][C]-42.4[/C][/ROW]
[ROW][C]6[/C][C]517[/C][C]561.4[/C][C]-44.4[/C][/ROW]
[ROW][C]7[/C][C]510[/C][C]561.4[/C][C]-51.4[/C][/ROW]
[ROW][C]8[/C][C]509[/C][C]561.4[/C][C]-52.4[/C][/ROW]
[ROW][C]9[/C][C]501[/C][C]561.4[/C][C]-60.4[/C][/ROW]
[ROW][C]10[/C][C]507[/C][C]561.4[/C][C]-54.4[/C][/ROW]
[ROW][C]11[/C][C]569[/C][C]561.4[/C][C]7.6[/C][/ROW]
[ROW][C]12[/C][C]580[/C][C]561.4[/C][C]18.6[/C][/ROW]
[ROW][C]13[/C][C]578[/C][C]584.090909090909[/C][C]-6.09090909090909[/C][/ROW]
[ROW][C]14[/C][C]565[/C][C]584.090909090909[/C][C]-19.0909090909091[/C][/ROW]
[ROW][C]15[/C][C]547[/C][C]584.090909090909[/C][C]-37.0909090909091[/C][/ROW]
[ROW][C]16[/C][C]555[/C][C]561.4[/C][C]-6.4[/C][/ROW]
[ROW][C]17[/C][C]562[/C][C]561.4[/C][C]0.600000000000003[/C][/ROW]
[ROW][C]18[/C][C]561[/C][C]561.4[/C][C]-0.399999999999997[/C][/ROW]
[ROW][C]19[/C][C]555[/C][C]561.4[/C][C]-6.4[/C][/ROW]
[ROW][C]20[/C][C]544[/C][C]561.4[/C][C]-17.4[/C][/ROW]
[ROW][C]21[/C][C]537[/C][C]561.4[/C][C]-24.4[/C][/ROW]
[ROW][C]22[/C][C]543[/C][C]561.4[/C][C]-18.4[/C][/ROW]
[ROW][C]23[/C][C]594[/C][C]561.4[/C][C]32.6[/C][/ROW]
[ROW][C]24[/C][C]611[/C][C]584.090909090909[/C][C]26.9090909090909[/C][/ROW]
[ROW][C]25[/C][C]613[/C][C]584.090909090909[/C][C]28.9090909090909[/C][/ROW]
[ROW][C]26[/C][C]611[/C][C]584.090909090909[/C][C]26.9090909090909[/C][/ROW]
[ROW][C]27[/C][C]594[/C][C]584.090909090909[/C][C]9.9090909090909[/C][/ROW]
[ROW][C]28[/C][C]595[/C][C]584.090909090909[/C][C]10.9090909090909[/C][/ROW]
[ROW][C]29[/C][C]591[/C][C]561.4[/C][C]29.6[/C][/ROW]
[ROW][C]30[/C][C]589[/C][C]561.4[/C][C]27.6[/C][/ROW]
[ROW][C]31[/C][C]584[/C][C]561.4[/C][C]22.6[/C][/ROW]
[ROW][C]32[/C][C]573[/C][C]561.4[/C][C]11.6[/C][/ROW]
[ROW][C]33[/C][C]567[/C][C]561.4[/C][C]5.6[/C][/ROW]
[ROW][C]34[/C][C]569[/C][C]561.4[/C][C]7.6[/C][/ROW]
[ROW][C]35[/C][C]621[/C][C]561.4[/C][C]59.6[/C][/ROW]
[ROW][C]36[/C][C]629[/C][C]561.4[/C][C]67.6[/C][/ROW]
[ROW][C]37[/C][C]628[/C][C]561.4[/C][C]66.6[/C][/ROW]
[ROW][C]38[/C][C]612[/C][C]561.4[/C][C]50.6[/C][/ROW]
[ROW][C]39[/C][C]595[/C][C]561.4[/C][C]33.6[/C][/ROW]
[ROW][C]40[/C][C]597[/C][C]561.4[/C][C]35.6[/C][/ROW]
[ROW][C]41[/C][C]593[/C][C]561.4[/C][C]31.6[/C][/ROW]
[ROW][C]42[/C][C]590[/C][C]561.4[/C][C]28.6[/C][/ROW]
[ROW][C]43[/C][C]580[/C][C]561.4[/C][C]18.6[/C][/ROW]
[ROW][C]44[/C][C]574[/C][C]561.4[/C][C]12.6[/C][/ROW]
[ROW][C]45[/C][C]573[/C][C]561.4[/C][C]11.6[/C][/ROW]
[ROW][C]46[/C][C]573[/C][C]561.4[/C][C]11.6[/C][/ROW]
[ROW][C]47[/C][C]620[/C][C]561.4[/C][C]58.6[/C][/ROW]
[ROW][C]48[/C][C]626[/C][C]561.4[/C][C]64.6[/C][/ROW]
[ROW][C]49[/C][C]620[/C][C]561.4[/C][C]58.6[/C][/ROW]
[ROW][C]50[/C][C]588[/C][C]584.090909090909[/C][C]3.90909090909091[/C][/ROW]
[ROW][C]51[/C][C]566[/C][C]584.090909090909[/C][C]-18.0909090909091[/C][/ROW]
[ROW][C]52[/C][C]557[/C][C]584.090909090909[/C][C]-27.0909090909091[/C][/ROW]
[ROW][C]53[/C][C]561[/C][C]561.4[/C][C]-0.399999999999997[/C][/ROW]
[ROW][C]54[/C][C]549[/C][C]561.4[/C][C]-12.4[/C][/ROW]
[ROW][C]55[/C][C]532[/C][C]561.4[/C][C]-29.4[/C][/ROW]
[ROW][C]56[/C][C]526[/C][C]561.4[/C][C]-35.4[/C][/ROW]
[ROW][C]57[/C][C]511[/C][C]561.4[/C][C]-50.4[/C][/ROW]
[ROW][C]58[/C][C]499[/C][C]561.4[/C][C]-62.4[/C][/ROW]
[ROW][C]59[/C][C]555[/C][C]561.4[/C][C]-6.4[/C][/ROW]
[ROW][C]60[/C][C]565[/C][C]561.4[/C][C]3.60000000000000[/C][/ROW]
[ROW][C]61[/C][C]542[/C][C]561.4[/C][C]-19.4[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=5903&T=4

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=5903&T=4

As an alternative you can also use a QR Code:  

The GUIDs for individual cells are displayed in the table below:

Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolationForecastResidualsPrediction Error
1523561.4-38.4000000000001
2519561.4-42.4
3509561.4-52.4
4512561.4-49.4
5519561.4-42.4
6517561.4-44.4
7510561.4-51.4
8509561.4-52.4
9501561.4-60.4
10507561.4-54.4
11569561.47.6
12580561.418.6
13578584.090909090909-6.09090909090909
14565584.090909090909-19.0909090909091
15547584.090909090909-37.0909090909091
16555561.4-6.4
17562561.40.600000000000003
18561561.4-0.399999999999997
19555561.4-6.4
20544561.4-17.4
21537561.4-24.4
22543561.4-18.4
23594561.432.6
24611584.09090909090926.9090909090909
25613584.09090909090928.9090909090909
26611584.09090909090926.9090909090909
27594584.0909090909099.9090909090909
28595584.09090909090910.9090909090909
29591561.429.6
30589561.427.6
31584561.422.6
32573561.411.6
33567561.45.6
34569561.47.6
35621561.459.6
36629561.467.6
37628561.466.6
38612561.450.6
39595561.433.6
40597561.435.6
41593561.431.6
42590561.428.6
43580561.418.6
44574561.412.6
45573561.411.6
46573561.411.6
47620561.458.6
48626561.464.6
49620561.458.6
50588584.0909090909093.90909090909091
51566584.090909090909-18.0909090909091
52557584.090909090909-27.0909090909091
53561561.4-0.399999999999997
54549561.4-12.4
55532561.4-29.4
56526561.4-35.4
57511561.4-50.4
58499561.4-62.4
59555561.4-6.4
60565561.43.60000000000000
61542561.4-19.4



Parameters (Session):
par1 = 1 ; par2 = Do not include Seasonal Dummies ; par3 = No Linear Trend ;
Parameters (R input):
par1 = 1 ; par2 = Do not include Seasonal Dummies ; par3 = No Linear Trend ;
R code (references can be found in the software module):
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
k <- length(x[1,])
df <- as.data.frame(x)
(mylm <- lm(df))
(mysum <- summary(mylm))
bitmap(file='test0.png')
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()
bitmap(file='test1.png')
plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
grid()
dev.off()
bitmap(file='test2.png')
hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
grid()
dev.off()
bitmap(file='test3.png')
densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
dev.off()
bitmap(file='test4.png')
qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
grid()
dev.off()
(myerror <- as.ts(mysum$resid))
bitmap(file='test5.png')
dum <- cbind(lag(myerror,k=1),myerror)
dum
dum1 <- dum[2:length(myerror),]
dum1
z <- as.data.frame(dum1)
z
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()
bitmap(file='test6.png')
acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
grid()
dev.off()
bitmap(file='test7.png')
pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
grid()
dev.off()
bitmap(file='test8.png')
opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
plot(mylm, las = 1, sub='Residual Diagnostics')
par(opar)
dev.off()
load(file='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='mytable1.tab')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,hyperlink('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='mytable2.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='mytable3.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='mytable4.tab')