Home » date » 2010 » Nov » 22 »

Workshop 7, tutorial Multiple Regression

*The author of this computation has been verified*
R Software Module: /rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Mon, 22 Nov 2010 21:19:35 +0000
 
Cite this page as follows:
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL http://www.freestatistics.org/blog/date/2010/Nov/22/t1290460784wzimxo3d1rsgr1v.htm/, Retrieved Mon, 22 Nov 2010 22:19:55 +0100
 
BibTeX entries for LaTeX users:
@Manual{KEY,
    author = {{YOUR NAME}},
    publisher = {Office for Research Development and Education},
    title = {Statistical Computations at FreeStatistics.org, URL http://www.freestatistics.org/blog/date/2010/Nov/22/t1290460784wzimxo3d1rsgr1v.htm/},
    year = {2010},
}
@Manual{R,
    title = {R: A Language and Environment for Statistical Computing},
    author = {{R Development Core Team}},
    organization = {R Foundation for Statistical Computing},
    address = {Vienna, Austria},
    year = {2010},
    note = {{ISBN} 3-900051-07-0},
    url = {http://www.R-project.org},
}
 
Original text written by user:
 
IsPrivate?
No (this computation is public)
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
5,6 5,5 6 12 4,4 3,5 4 11 2,4 8,5 4 14 4,8 5 4 12 3,2 6 4,5 21 4 6 3,5 12 4 5,5 2 22 4,4 5,5 5,5 11 6,4 6 3,5 10 4,4 6,5 3,5 13 5,2 7 6 10 4,8 8 5 8 3,2 5,5 5 15 4,8 5 4 14 4,4 5,5 4 10 1,6 7,5 2 14 3,6 4,5 4,5 14 3,2 5,5 4 11 3,2 8,5 3,5 10 5,6 8,5 5,5 13 6 5,5 4,5 7 6,4 9 5,5 14 3,6 7 6,5 12 5,6 5 4 14 4,4 5,5 4 11 3,2 7,5 4,5 9 3,6 7,5 3 11 3,6 6,5 4,5 15 3,6 8 4,5 14 3,6 6,5 3 13 4 4,5 3 9 6,4 9 8 15 4,4 9 2,5 10 3,2 6 3,5 11 3,6 8,5 4,5 13 6,4 4,5 3 8 4,4 4,5 3 20 6,4 6 2,5 12 4,8 9 6 10 4,8 6 3,5 10 5,6 9 5 9 3,6 7 4,5 14 4 7,5 4 8 3,6 8 2,5 14 4 5 4 11 4,8 5,5 4 13 5,6 7 5 9 5,6 4,5 3 11 4 6 4 15 5,6 8,5 3,5 11 6,4 2,5 2 10 3,6 6 4 14 4 6 4 18 2,4 3 2 14 3,2 12 10 11 5,2 6 4 12 4 6 4 13 3,2 7 3 9 2,8 3,5 2 10 6 6,5 4 15 3,6 6 4,5 20 4 6,5 3 12 4,8 7 3,5 12 5,2 4 4,5 14 4 5,5 2,5 13 4,4 4,5 2,5 11 3,2 5,5 4 17 3,6 6,5 4 12 5,2 5 3 13 4,4 5,5 4 14 3,2 6 3,5 13 3,6 4,5 3,5 15 3,6 7,5 4,5 13 6 9 5,5 10 3,6 7,5 3 11 4 6 4 19 5,6 6,5 etc...
 
Output produced by software:

Enter (or paste) a matrix (table) containing all data (time) series. Every column represents a different variable and must be delimited by a space or Tab. Every row represents a period in time (or category) and must be delimited by hard returns. The easiest way to enter data is to copy and paste a block of spreadsheet cells. Please, do not use commas or spaces to seperate groups of digits!


Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time9 seconds
R Server'Gwilym Jenkins' @ 72.249.127.135


Multiple Linear Regression - Estimated Regression Equation
Depression[t] = + 14.2746162191590 -0.199901806823605Doubts[t] -0.054501555912315Expect[t] -0.038947120698009Criticism[t] + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)14.27461621915901.36530510.455300
Doubts-0.1999018068236050.228178-0.87610.3823430.191172
Expect-0.0545015559123150.182095-0.29930.765110.382555
Criticism-0.0389471206980090.23449-0.16610.86830.43415


Multiple Linear Regression - Regression Statistics
Multiple R0.0855457044326433
R-squared0.00731806754687717
Adjusted R-squared-0.0118951311457638
F-TEST (value)0.380887517167045
F-TEST (DF numerator)3
F-TEST (DF denominator)155
p-value0.766914280365275
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation3.16405509068659
Sum Squared Residuals1551.74291561946


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
11212.621724819241-0.621724819240985
21113.0485043406500-2.04850434064998
31413.17580017473560.824199825264388
41212.8867912840521-0.88679128405206
52113.13265905870857.86734094129149
61213.0116847339476-1.01168473394764
72213.09735619295088.9026438070492
81112.8810805477783-1.88108054777833
91012.5319203975710-2.53192039757098
101312.90447323326200.0955267667379638
111012.6199332081020-2.61993320810197
12812.6843394956171-4.68433949561711
131513.14043627631571.85956372368434
141412.88679128405211.11320871594794
151012.9395012288253-2.93950122882535
161413.46811741750280.53188258249717
171413.13445066984750.865549330152459
181113.1793833970137-2.17938339701367
191013.0353522896257-3.03535228962573
201312.47769371185310.522306288146938
21712.6001847775586-5.60018477755857
221412.29052148843801.70947851156198
231212.9203025386707-0.920302538670735
241412.72686983859321.27313016140682
251112.9395012288253-1.93950122882535
26913.0509067248400-4.05090672484004
271113.0293666831576-2.02936668315761
281513.02544755802291.97455244197709
291412.94369522415441.05630477584556
301313.0838682390699-0.083868239069925
31913.1129106281651-4.11291062816511
321512.1931536866932.80684631330700
331012.8071664641793-2.80716646417926
341113.1716061794065-2.17160617940652
351312.91644444619830.0835555538017188
36812.6331462917885-4.63314629178846
372013.03294990543576.96705009456433
381212.570867518269-0.570867518268993
391012.5908908190068-2.59089081900678
401012.8517632884888-2.85176328848875
41912.4699164942459-3.46991649424591
421412.99819678006681.00180321993325
43812.9104588397302-4.91045883973016
441413.02158946555050.978410534449543
451113.0467127295109-2.04671272951095
461312.85954050609590.140459493904095
47912.5789196060705-3.57891960607054
481112.7930677372473-1.79306773724734
491512.99221117359862.00778882640137
501112.5555879532491-1.55558795324908
511012.7810965243111-2.7810965243111
521413.07217189632810.927828103671927
531812.99221117359865.00778882640137
541413.55345297364940.446547026350637
551112.5914405593956-1.59144055939557
561212.7523290054103-0.752329005410305
571312.99221117359860.00778882640136876
58913.1365781838432-4.13657818384321
591013.4462414729638-3.44624147296376
601512.56515678199532.43484321800474
612013.05269833597916.94730166402093
621213.0039075163405-1.00390751634048
631212.7972617325764-0.797261732576437
641412.84185855688591.15814144311407
651313.0778826326018-0.0778826326018025
661113.0524234657847-2.05242346578468
671713.17938339701373.82061660298633
681213.0449211183719-1.04492111837192
691312.84577768202060.154222317979371
701412.93950122882531.06049877117465
711313.1716061794065-0.17160617940652
721513.17339779054561.82660220945445
731312.97094600211060.0290539978894038
741012.3704822111675-2.37048221116746
751113.0293666831576-2.02936668315761
761912.99221117359866.00778882640137
771312.68406462542270.315935374577285
781712.75831461187844.24168538812157
791312.88679128405210.113208715947938
80912.9239467936110-3.92394679361104
811112.6061703840267-1.60617038402670
821013.3393048424726-3.33930484247256
83912.8050389501836-3.80503895018359
841213.0041823865349-1.00418238653488
851212.8397920755525-0.839792075552507
861312.82272089939360.177279100606436
871313.0778826326018-0.0778826326018025
881212.7541206165493-0.754120616549335
891512.60644525422112.39355474577891
902213.01168473394768.98831526605236
911312.61786672676850.382133273231452
921513.53996501976851.46003498023152
931313.0524234657847-0.0524234657846753
941512.94940596042822.05059403957183
951013.0604755535862-3.06047555358622
961112.6690599305972-1.66905993059720
971612.43847172096073.56152827903934
981112.5109300962773-1.51093009627734
991113.0916454566771-2.09164545667708
1001012.9649603956425-2.96496039564247
1011012.8715117190321-2.87151171903215
1021613.27104046248502.72895953751503
1031212.8424693299370-0.842469329936962
1041113.0314331644910-2.03143316449103
1051612.6606719399393.33932806006099
1061912.75803974168406.24196025831596
1071113.2261077353188-2.22610773531883
1081613.00597399767392.99402600232609
1091512.53219526776542.46780473223462
1102412.711315403378911.2886845966211
1111413.17160617940650.82839382059348
1121512.96523526583692.03476473416313
1131113.1754642718790-2.17546427187897
1141513.0101679930031.989832006997
1151213.3626364952940-1.36263649529402
1161013.1833025221484-3.18330252214837
1171413.17580017473560.824199825264388
1181313.0329499054357-0.0329499054356707
119912.5711423884634-3.57114238846339
1201513.09914780408981.90085219591016
1211513.1263985820461.87360141795401
1221412.93172401121821.06827598878181
1231112.5594460457215-1.55944604572153
124813.3545844074925-5.35458440749247
1251112.3210806184778-1.32108061847785
1261112.7759965610884-1.77599656108840
127813.2845284163659-5.28452841636585
1281012.9395012288253-2.93950122882535
1291112.9182360573373-1.91823605733731
1301312.69961906063700.300380939362979
1311112.8265789918660-1.82657899186602
1322013.07217189632816.92782810367193
1331013.1578433553312-3.15784335533124
1341513.3117791943221.68822080567799
1351212.9922111735986-0.992211173598631
1361412.49537566106301.50462433893696
1372312.791276126108310.2087238738917
1381412.78556538983461.21443461016541
1391613.13265905870852.86734094129149
1401112.6549612036653-1.65496120366528
1411212.7346470562003-0.734647056200331
1421012.7115902735733-2.71159027357327
1431412.11167622301891.88832377698108
1441212.7870821307792-0.787082130779222
1451212.5576544345825-0.557654434582504
1461112.5786447358761-1.57864473587615
1471212.9164444461983-0.916444446198281
1481313.1188962346332-0.118896234633235
1491113.0526983359791-2.05269833597907
1501913.05868394244725.94131605755281
1511213.2398705593941-1.23987055939411
1521712.40344372539734.59655627460265
153912.6864670096128-3.68646700961278
1541213.0566174611138-1.05661746111377
1551912.59687642547496.4031235745251
1561813.08386823906994.91613176093007
1571512.69961906063702.30038093936298
1581412.63162955084381.36837044915618
1591112.1659029087368-1.16590290873684


Goldfeld-Quandt test for Heteroskedasticity
p-valuesAlternative Hypothesis
breakpoint indexgreater2-sidedless
70.9763945343223430.0472109313553140.023605465677657
80.9519033864738520.09619322705229530.0480966135261477
90.919862850969680.1602742980606410.0801371490303206
100.8734981349108290.2530037301783420.126501865089171
110.8120660700240990.3758678599518020.187933929975901
120.7875880455577190.4248239088845630.212411954442281
130.7107855469434470.5784289061131060.289214453056553
140.6275139946371130.7449720107257740.372486005362887
150.655004303657230.6899913926855390.344995696342770
160.7231855862794660.5536288274410680.276814413720534
170.6548202727026850.690359454594630.345179727297315
180.6717619284925590.6564761430148820.328238071507441
190.6481642799530950.703671440093810.351835720046905
200.6801043632379490.6397912735241020.319895636762051
210.7239831092510410.5520337814979180.276016890748959
220.7757135223738430.4485729552523150.224286477626157
230.7213784112292490.5572431775415020.278621588770751
240.6809238141058710.6381523717882580.319076185894129
250.6409547019220630.7180905961558740.359045298077937
260.6709884044313020.6580231911373960.329011595568698
270.6397386130684420.7205227738631150.360261386931558
280.6074907111638080.7850185776723840.392509288836192
290.5590874947117170.8818250105765650.440912505288282
300.4988272051628970.9976544103257950.501172794837103
310.5521156235527370.8957687528945260.447884376447263
320.5875479371278360.8249041257443280.412452062872164
330.5592706680493490.8814586639013030.440729331950651
340.5248368770783180.9503262458433640.475163122921682
350.4674083881988340.9348167763976680.532591611801166
360.471386567142910.942773134285820.52861343285709
370.7110003344301020.5779993311397960.288999665569898
380.6671047364263160.6657905271473690.332895263573684
390.6380647697654220.7238704604691550.361935230234578
400.6156478983205740.7687042033588520.384352101679426
410.5980691228967110.8038617542065770.401930877103289
420.5520874783404260.8958250433191470.447912521659574
430.6041859239779230.7916281520441530.395814076022076
440.5649215840851150.870156831829770.435078415914885
450.5331389735170780.9337220529658450.466861026482922
460.4839402159407610.9678804318815230.516059784059239
470.475629581972340.951259163944680.52437041802766
480.4342053895758110.8684107791516220.565794610424189
490.4092801291161460.8185602582322910.590719870883854
500.3687095324497430.7374190648994850.631290467550257
510.3461149953245370.6922299906490730.653885004675463
520.3051913028609880.6103826057219770.694808697139012
530.3845158578042760.7690317156085520.615484142195724
540.3408710699859120.6817421399718240.659128930014088
550.3064383857865780.6128767715731560.693561614213422
560.2671610987884230.5343221975768460.732838901211577
570.2285880992830110.4571761985660230.771411900716989
580.2568831810490840.5137663620981670.743116818950916
590.2745880595697560.5491761191395110.725411940430244
600.2791563264731100.5583126529462190.72084367352689
610.4554114919013560.9108229838027130.544588508098644
620.4122932075406010.8245864150812020.587706792459399
630.3701274628886050.7402549257772110.629872537111395
640.3334285615732030.6668571231464070.666571438426797
650.2921198280752720.5842396561505440.707880171924728
660.2681159144557270.5362318289114540.731884085544273
670.2834864028708270.5669728057416540.716513597129173
680.2490556492467850.498111298493570.750944350753215
690.2157105354925420.4314210709850830.784289464507459
700.1872142120409470.3744284240818930.812785787959053
710.1575481542610030.3150963085220060.842451845738997
720.1384071295983720.2768142591967430.861592870401628
730.1143033090028130.2286066180056260.885696690997187
740.1039474776663580.2078949553327160.896052522333642
750.09184987705739970.1836997541147990.9081501229426
760.1567894774278830.3135789548557660.843210522572117
770.1356587137988730.2713174275977460.864341286201127
780.1624841312496690.3249682624993390.83751586875033
790.1356913843047010.2713827686094010.8643086156953
800.1504863610716010.3009727221432010.8495136389284
810.1315156059765900.2630312119531810.86848439402341
820.1398427199632080.2796854399264160.860157280036792
830.1527122610588750.305424522117750.847287738941125
840.1295234287280730.2590468574561470.870476571271927
850.1098277463201570.2196554926403130.890172253679843
860.0919694246949320.1839388493898640.908030575305068
870.07484782119113260.1496956423822650.925152178808867
880.0611017633601320.1222035267202640.938898236639868
890.05618713967745850.1123742793549170.943812860322542
900.2206192822434070.4412385644868140.779380717756593
910.1917346453349020.3834692906698040.808265354665098
920.1715339776665610.3430679553331220.828466022333439
930.1438210971347130.2876421942694270.856178902865287
940.1288770935290390.2577541870580780.871122906470961
950.1268348373574080.2536696747148170.873165162642592
960.1113944000625050.222788800125010.888605599937495
970.1166238470471300.2332476940942600.88337615295287
980.1022680855837870.2045361711675730.897731914416213
990.09135894350606570.1827178870121310.908641056493934
1000.09028123037788170.1805624607557630.909718769622118
1010.08822234698612260.1764446939722450.911777653013877
1020.08243453090799940.1648690618159990.917565469092
1030.06839921857331290.1367984371466260.931600781426687
1040.05994715340278720.1198943068055740.940052846597213
1050.06023543065923190.1204708613184640.939764569340768
1060.1032293560501170.2064587121002350.896770643949883
1070.09201326223543640.1840265244708730.907986737764564
1080.08872883547709940.1774576709541990.9112711645229
1090.07911388361759850.1582277672351970.920886116382401
1100.4694955174981090.9389910349962190.530504482501891
1110.4226012129416330.8452024258832660.577398787058367
1120.3901185754757490.7802371509514970.609881424524251
1130.3582048904587480.7164097809174960.641795109541252
1140.3244309034064660.6488618068129330.675569096593534
1150.2841011877408250.568202375481650.715898812259175
1160.2865558433895440.5731116867790870.713444156610456
1170.2448946266746740.4897892533493480.755105373325326
1180.2053927789849160.4107855579698310.794607221015085
1190.2220611367925620.4441222735851240.777938863207438
1200.1981849617377750.3963699234755510.801815038262225
1210.1791478713483680.3582957426967360.820852128651632
1220.1488822848268990.2977645696537970.851117715173101
1230.1274058136315770.2548116272631550.872594186368423
1240.1658552504021980.3317105008043960.834144749597802
1250.1379903326775870.2759806653551740.862009667322413
1260.1227200304925090.2454400609850190.87727996950749
1270.1854987574403240.3709975148806480.814501242559676
1280.1870855288297060.3741710576594120.812914471170294
1290.1732312817887210.3464625635774410.82676871821128
1300.1378118073419510.2756236146839020.862188192658049
1310.1234524859534590.2469049719069170.876547514046541
1320.2216726277150680.4433452554301360.778327372284932
1330.2416486224226460.4832972448452920.758351377577354
1340.1973356875461800.3946713750923590.80266431245382
1350.1664140782409560.3328281564819110.833585921759044
1360.1301232111664730.2602464223329470.869876788833527
1370.594958682119830.810082635760340.40504131788017
1380.5275513942361810.9448972115276370.472448605763819
1390.4885350858341130.9770701716682260.511464914165887
1400.4479763225579990.8959526451159980.552023677442001
1410.3792579954715690.7585159909431380.620742004528431
1420.3872579397152110.7745158794304230.612742060284789
1430.3165923067498930.6331846134997860.683407693250107
1440.2486312826476220.4972625652952450.751368717352378
1450.1982100256484440.3964200512968870.801789974351556
1460.168858314784440.337716629568880.83114168521556
1470.1258886329907120.2517772659814250.874111367009288
1480.08647370444620570.1729474088924110.913526295553794
1490.09387707512965520.1877541502593100.906122924870345
1500.1159225677690260.2318451355380520.884077432230974
1510.1127012689504090.2254025379008170.887298731049591
1520.3545981200104810.7091962400209630.645401879989519


Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity
Description# significant tests% significant testsOK/NOK
1% type I error level00OK
5% type I error level10.00684931506849315OK
10% type I error level20.0136986301369863OK
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2010/Nov/22/t1290460784wzimxo3d1rsgr1v/10w5xw1290460765.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Nov/22/t1290460784wzimxo3d1rsgr1v/10w5xw1290460765.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Nov/22/t1290460784wzimxo3d1rsgr1v/174ik1290460765.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Nov/22/t1290460784wzimxo3d1rsgr1v/174ik1290460765.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Nov/22/t1290460784wzimxo3d1rsgr1v/2hvzn1290460765.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Nov/22/t1290460784wzimxo3d1rsgr1v/2hvzn1290460765.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Nov/22/t1290460784wzimxo3d1rsgr1v/3hvzn1290460765.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Nov/22/t1290460784wzimxo3d1rsgr1v/3hvzn1290460765.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Nov/22/t1290460784wzimxo3d1rsgr1v/4hvzn1290460765.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Nov/22/t1290460784wzimxo3d1rsgr1v/4hvzn1290460765.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Nov/22/t1290460784wzimxo3d1rsgr1v/5amy81290460765.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Nov/22/t1290460784wzimxo3d1rsgr1v/5amy81290460765.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Nov/22/t1290460784wzimxo3d1rsgr1v/6amy81290460765.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Nov/22/t1290460784wzimxo3d1rsgr1v/6amy81290460765.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Nov/22/t1290460784wzimxo3d1rsgr1v/73wgb1290460765.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Nov/22/t1290460784wzimxo3d1rsgr1v/73wgb1290460765.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Nov/22/t1290460784wzimxo3d1rsgr1v/83wgb1290460765.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Nov/22/t1290460784wzimxo3d1rsgr1v/83wgb1290460765.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Nov/22/t1290460784wzimxo3d1rsgr1v/9w5xw1290460765.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Nov/22/t1290460784wzimxo3d1rsgr1v/9w5xw1290460765.ps (open in new window)


 
Parameters (Session):
par1 = 4 ; par2 = Do not include Seasonal Dummies ; par3 = No Linear Trend ;
 
Parameters (R input):
par1 = 4 ; par2 = Do not include Seasonal Dummies ; par3 = No Linear Trend ;
 
R code (references can be found in the software module):
library(lattice)
library(lmtest)
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
k <- length(x[1,])
df <- as.data.frame(x)
(mylm <- lm(df))
(mysum <- summary(mylm))
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
}
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')
qqline(mysum$resid)
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()
if (n > n25) {
bitmap(file='test9.png')
plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
grid()
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('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<br />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<br />Forecast', 1, TRUE)
a<-table.element(a, 'Residuals<br />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')
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='mytable5.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='mytable6.tab')
}
 





Copyright

Creative Commons License

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.

Software written by Ed van Stee & Patrick Wessa


Disclaimer

Information provided on this web site is provided "AS IS" without warranty of any kind, either express or implied, including, without limitation, warranties of merchantability, fitness for a particular purpose, and noninfringement. We use reasonable efforts to include accurate and timely information and periodically update the information, and software without notice. However, we make no warranties or representations as to the accuracy or completeness of such information (or software), and we assume no liability or responsibility for errors or omissions in the content of this web site, or any software bugs in online applications. Your use of this web site is AT YOUR OWN RISK. Under no circumstances and under no legal theory shall we be liable to you or any other person for any direct, indirect, special, incidental, exemplary, or consequential damages arising from your access to, or use of, this web site.


Privacy Policy

We may request personal information to be submitted to our servers in order to be able to:

  • personalize online software applications according to your needs
  • enforce strict security rules with respect to the data that you upload (e.g. statistical data)
  • manage user sessions of online applications
  • alert you about important changes or upgrades in resources or applications

We NEVER allow other companies to directly offer registered users information about their products and services. Banner references and hyperlinks of third parties NEVER contain any personal data of the visitor.

We do NOT sell, nor transmit by any means, personal information, nor statistical data series uploaded by you to third parties.

We carefully protect your data from loss, misuse, alteration, and destruction. However, at any time, and under any circumstance you are solely responsible for managing your passwords, and keeping them secret.

We store a unique ANONYMOUS USER ID in the form of a small 'Cookie' on your computer. This allows us to track your progress when using this website which is necessary to create state-dependent features. The cookie is used for NO OTHER PURPOSE. At any time you may opt to disallow cookies from this website - this will not affect other features of this website.

We examine cookies that are used by third-parties (banner and online ads) very closely: abuse from third-parties automatically results in termination of the advertising contract without refund. We have very good reason to believe that the cookies that are produced by third parties (banner ads) do NOT cause any privacy or security risk.

FreeStatistics.org is safe. There is no need to download any software to use the applications and services contained in this website. Hence, your system's security is not compromised by their use, and your personal data - other than data you submit in the account application form, and the user-agent information that is transmitted by your browser - is never transmitted to our servers.

As a general rule, we do not log on-line behavior of individuals (other than normal logging of webserver 'hits'). However, in cases of abuse, hacking, unauthorized access, Denial of Service attacks, illegal copying, hotlinking, non-compliance with international webstandards (such as robots.txt), or any other harmful behavior, our system engineers are empowered to log, track, identify, publish, and ban misbehaving individuals - even if this leads to ban entire blocks of IP addresses, or disclosing user's identity.


FreeStatistics.org is powered by