Home » date » 2010 » Dec » 02 »

Mini tutorial - Multiple Linear 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: Thu, 02 Dec 2010 11:31:15 +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/Dec/02/t1291291026jg8ozfvprf7wr9q.htm/, Retrieved Thu, 02 Dec 2010 12:57:23 +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/Dec/02/t1291291026jg8ozfvprf7wr9q.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:
Not popular test
 
IsPrivate?
No (this computation is public)
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
2 13 13 14 13 3 5 3 12 12 8 13 5 3 3 15 10 12 16 6 0 3 12 9 7 12 6 7 3 10 10 10 11 5 4 3 12 12 7 12 3 1 2 15 13 16 18 8 6 3 9 12 11 11 4 3 3 12 12 14 14 4 12 4 11 6 6 9 4 0 3 11 5 16 14 6 5 3 11 12 11 12 6 6 2 15 11 16 11 5 6 3 7 14 12 12 4 6 3 11 14 7 13 6 2 3 11 12 13 11 4 1 3 10 12 11 12 6 5 3 14 11 15 16 6 7 2 10 11 7 9 4 3 4 6 7 9 11 4 3 3 11 9 7 13 2 3 2 15 11 14 15 7 7 3 11 11 15 10 5 8 3 12 12 7 11 4 6 2 14 12 15 13 6 3 2 15 11 17 16 6 5 4 9 11 15 15 7 5 2 13 8 14 14 5 10 3 13 9 14 14 6 2 2 16 12 8 14 4 6 4 13 10 8 8 4 4 3 12 10 14 13 7 6 2 14 12 14 15 7 8 3 11 8 8 13 4 4 3 9 12 11 11 4 5 1 16 11 16 15 6 10 3 12 12 10 15 6 6 3 10 7 8 9 5 7 3 13 11 14 13 6 4 2 16 11 16 16 7 10 3 14 12 13 13 6 4 15 9 5 11 3 3 5 5 15 8 12 3 3 4 8 11 10 12 4 3 3 11 11 8 12 6 3 2 16 11 13 14 7 7 2 17 11 15 14 5 15 3 9 15 6 8 4 0 4 9 11 12 13 5 0 2 13 12 16 16 6 4 3 10 12 5 13 6 5 4 6 9 15 11 6 5 3 12 12 12 14 5 2 4 8 12 8 13 4 3 3 14 13 13 13 5 0 3 12 11 14 13 5 9 4 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 time11 seconds
R Server'George Udny Yule' @ 72.249.76.132


Multiple Linear Regression - Estimated Regression Equation
NotPopular[t] = + 2.98670740628656 -0.0111064541653232Popularity[t] + 0.496005575693039FindingFriends[t] + 0.560172927756955KnowingPeople[t] -0.80285171304812Liked[t] + 0.137898841611536Celebrity[t] -0.293925773283954WeightedSum[t] + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)2.986707406286561.6454631.81510.0715170.035759
Popularity-0.01110645416532320.118792-0.09350.9256360.462818
FindingFriends0.4960055756930390.0762396.505900
KnowingPeople0.5601729277569550.0905296.187800
Liked-0.802851713048120.071574-11.217100
Celebrity0.1378988416115360.0782461.76240.0800560.040028
WeightedSum-0.2939257732839540.141543-2.07660.0395580.019779


Multiple Linear Regression - Regression Statistics
Multiple R0.84624116396135
R-squared0.716124107582662
Adjusted R-squared0.704692863592702
F-TEST (value)62.6462096523909
F-TEST (DF numerator)6
F-TEST (DF denominator)149
p-value0
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation2.65918914845553
Sum Squared Residuals1053.62175216228


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
125.63981236353336-3.63981236353336
232.657524905255030.342475094744966
332.484007124719860.515992875280144
430.3743827119428082.62561728805719
534.11985017052585-1.11985017052585
633.21225755389104-0.212257553891044
723.1192551802499-1.11925518024990
835.83916763550658-2.83916763550658
932.432479957581530.567520042418473
1042.527537380181021.47246261981898
1132.425171333620240.574828666379757
1234.40812337749902-1.40812337749902
1327.33350949536604-5.33350949536604
1435.72893559008028-2.72893559008028
1533.53229419794498-0.532294197944976
1637.52515212925775-4.52515212925775
1734.7131556049483-1.7131556049483
1832.61415752486140.3858424751386
1924.69706732071663-2.69706732071663
2042.272113264023451.72788673597655
2130.2067451797496892.79325482025031
2222.98362869759878-0.983628697598777
2337.0327625507506-4.03276255075059
2432.683379242130920.316620757869077
2526.69442133283461-4.69442133283461
2624.3112484727779-2.31124847277790
2744.19829189691558-0.198291896915585
2821.163101588823490.836898411176508
2934.1484121923997-1.14841219239970
3020.7905712140822261.20942878591777
3145.23684125004874-1.23684125004874
3234.4205716837819-1.4205716837819
3323.19681495417318-1.19681495417318
3430.252784441752722.74721555824728
3535.25131608893867-2.25131608893867
3613.07319193748396-2.07319193748396
3731.428288856432391.57171114356761
3832.235413694177150.76458630582285
3935.35542351026599-2.35542351026599
4022.40823906604738-0.408239066047379
4135.28014970403675-2.28014970403675
42158.064191921860816.93580807813919
43510.3396686249889-5.33966862498889
44810.8671796532721-2.8671796532721
45118.563390849073742.43660915092626
461611.91250823645094.08749176354913
471715.31948777354151.68051222645849
4895.890417524692273.10958247530773
49911.4967412678164-2.49674126781636
501314.6049937798081-1.60499377980813
51107.312386732241422.68761326775858
52611.4793417694378-5.47934176943782
531211.73375387806320.266246121936845
54810.4242349754777-2.42423497547765
551411.67660816189482.3233918381052
561213.1419904471384-1.14199044713835
571112.0374306446612-1.03743064466125
581614.75808389385481.24191610614525
59814.9989230023693-6.9989230023693
601511.10869716469713.89130283530288
61710.5471430092182-3.54714300921817
621614.31204097396341.68795902603657
631413.90376624841630.096233751583721
641612.65021962999583.34978037000419
6598.792012753840150.207987246159846
661412.51510766572931.48489233427067
671112.8335883843680-1.83358838436802
68138.85913053226354.1408694677365
691511.69412786262033.30587213737967
7056.24994206653401-1.24994206653401
711513.43591622042231.56408377957769
721312.63487841728000.365121582720013
731112.6640993527726-1.66409935277256
741114.7913896476171-3.79138964761709
751211.37636212693040.623637873069637
761212.7042671040673-0.704267104067294
771212.3019350178886-0.301935017888561
781212.5776615724515-0.577661572451516
791411.10417865478532.89582134521474
8069.62365562138995-3.62365562138995
8179.52408340370008-2.52408340370008
821412.34004057286941.65995942713063
831413.38575310005650.614246899943477
841010.8472376533054-0.847237653305417
851310.00629008335892.99370991664108
861210.64497099506591.3550290049341
8799.03062032959518-0.0306203295951838
881212.4413050475216-0.441305047521602
891611.16428695545024.83571304454977
901010.9227694440252-0.922769444025204
911411.48403984814282.5159601518572
921013.1376340356444-3.13763403564441
931614.50976436487861.49023563512143
941513.49828327131411.50171672868595
951210.97403004075161.02596995924837
96108.890192595129141.10980740487086
9786.320318060928861.67968193907114
9889.60917933190357-1.60917933190357
991114.0379860719860-3.03798607198605
1001310.87627173296762.12372826703244
1011615.01687639473690.983123605263068
1021613.15966008814462.84033991185538
1031415.7854357778498-1.78543577784982
104119.17343132320941.82656867679060
10548.81943483875701-4.81943483875701
1061410.26982003855053.73017996144948
107913.1510128487701-4.15101284877014
1081411.93609021436632.06390978563366
109812.3696590611040-4.36965906110396
110811.9582198358997-3.95821983589969
1111112.1877914012893-1.18779140128929
1121211.53214468284590.467855317154133
113117.908829448853773.09117055114623
1141412.57493221503291.42506778496706
1151512.66364090371802.33635909628205
1161613.34926436680362.65073563319644
1171612.23496717974603.76503282025405
1181111.3626995624433-0.362699562443263
1191413.97206232994280.0279376700571903
1201412.27288732949281.72711267050722
1211212.8219538030844-0.821953803084415
1221412.74643562109831.25356437890174
123811.1985671272483-3.19856712724827
1241313.6851581925544-0.685158192554415
1251613.54023771504732.45976228495268
126129.069774287249762.93022571275024
1271612.42097572716043.57902427283958
1281211.87687405439810.123125945601918
1291110.90593929488900.0940607051109729
13044.31532253938963-0.315322539389629
1311613.68019339172512.31980660827488
1321511.08945798954203.91054201045803
1331012.5547064637049-2.55470646370489
1341312.10528188586680.894718114133203
1351511.99663119721513.0033688027849
1361210.78234170955921.21765829044084
1371412.98162071270561.01837928729438
138713.7347931858019-6.73479318580192
1391913.98063989125365.01936010874637
1401213.7132698290606-1.71326982906063
1411214.6973118084712-2.69731180847124
1421312.64866370458060.351336295419442
1431514.37316491478820.62683508521181
14488.48254043217644-0.482540432176445
1451211.55414496847530.445855031524733
146106.391578177548453.60842182245155
147810.7694077367544-2.7694077367544
1481014.6368147368153-4.63681473681533
1491514.20337667657810.796623323421898
150169.903499756736646.09650024326336
1511310.71843089138932.28156910861066
1521613.85773185751312.14226814248689
15399.95747755274446-0.957477552744455
1541412.08301145760971.91698854239033
1551412.21079042122881.78920957877123
1561214.6589579670823-2.65895796708231


Goldfeld-Quandt test for Heteroskedasticity
p-valuesAlternative Hypothesis
breakpoint indexgreater2-sidedless
100.0004293881229472940.0008587762458945880.999570611877053
110.0007305274672893610.001461054934578720.99926947253271
120.0001385576203380370.0002771152406760750.999861442379662
131.79910848727217e-053.59821697454433e-050.999982008915127
142.12852836940137e-064.25705673880274e-060.99999787147163
152.25805436844015e-074.51610873688031e-070.999999774194563
165.01683168676068e-081.00336633735214e-070.999999949831683
175.51575124385806e-091.10315024877161e-080.999999994484249
182.43208360751691e-094.86416721503383e-090.999999997567916
192.21510726346730e-084.43021452693460e-080.999999977848927
203.37144747107402e-096.74289494214805e-090.999999996628553
219.41760948767846e-101.88352189753569e-090.99999999905824
222.3334810497393e-104.6669620994786e-100.999999999766652
237.85517199778525e-111.57103439955705e-100.999999999921448
241.37859176788035e-112.75718353576069e-110.999999999986214
253.57235974493121e-127.14471948986243e-120.999999999996428
267.8881926041566e-131.57763852083132e-120.999999999999211
276.32062223754689e-131.26412444750938e-120.999999999999368
283.79816315907879e-137.59632631815759e-130.99999999999962
297.40780612979165e-141.48156122595833e-130.999999999999926
301.20067499811604e-142.40134999623207e-140.999999999999988
311.03416084774483e-132.06832169548966e-130.999999999999897
322.17651337368183e-144.35302674736367e-140.999999999999978
336.13804271494524e-151.22760854298905e-140.999999999999994
341.22119633916234e-152.44239267832467e-150.999999999999999
352.75990869642768e-165.51981739285537e-161
363.86687701497779e-167.73375402995558e-161
378.89025431016517e-171.77805086203303e-161
382.27582297035992e-174.55164594071984e-171
391.30450771407335e-172.60901542814669e-171
403.721601180822e-177.443202361644e-171
411.96523337595439e-153.93046675190878e-150.999999999999998
420.05147267407672120.1029453481534420.948527325923279
430.08592245458169910.1718449091633980.9140775454183
440.08289278119355190.1657855623871040.917107218806448
450.1997507346741560.3995014693483130.800249265325844
460.83385723951610.3322855209678000.166142760483900
470.8334078910317130.3331842179365750.166592108968287
480.8540391728893350.291921654221330.145960827110665
490.8546584208087660.2906831583824680.145341579191234
500.8881726390323060.2236547219353870.111827360967694
510.8689736266838910.2620527466322180.131026373316109
520.9576873904172540.08462521916549120.0423126095827456
530.963338845276270.07332230944746130.0366611547237306
540.9652740006415860.06945199871682730.0347259993584136
550.9877924051888370.02441518962232590.0122075948111630
560.9842862548653960.03142749026920740.0157137451346037
570.9798463437621420.04030731247571660.0201536562378583
580.9854849058232140.02903018835357150.0145150941767857
590.9964649570388680.007070085922265020.00353504296113251
600.9991487591120260.001702481775947880.000851240887973938
610.9992375352489510.001524929502097560.000762464751048781
620.9993491346682260.001301730663547680.00065086533177384
630.9991768399316010.001646320136796960.000823160068398482
640.9996221991846140.000755601630772510.000377800815386255
650.9994267923226480.001146415354704630.000573207677352313
660.9993569905079360.001286018984127520.000643009492063762
670.9994038976143710.001192204771258280.000596102385629139
680.999731939481260.0005361210374786940.000268060518739347
690.9997735113799930.0004529772400129230.000226488620006462
700.9997293372749680.0005413254500649040.000270662725032452
710.9997241225906960.0005517548186074280.000275877409303714
720.9995820269699360.0008359460601275480.000417973030063774
730.9994056392594630.001188721481073340.000594360740536668
740.999559650940660.000880698118680290.000440349059340145
750.9993662251005810.001267549798837920.00063377489941896
760.9992230953803640.001553809239272950.000776904619636477
770.9988693684322360.002261263135528290.00113063156776414
780.998375314956970.003249370086058890.00162468504302944
790.9988710266192550.002257946761490530.00112897338074526
800.9991433738450680.001713252309863420.000856626154931712
810.9991169658520180.00176606829596460.0008830341479823
820.9992041627621340.001591674475732770.000795837237866387
830.9988915494675140.002216901064971890.00110845053248595
840.998472337337290.003055325325419550.00152766266270978
850.9995696228488420.0008607543023170450.000430377151158522
860.9994223819945660.001155236010868510.000577618005434254
870.9991214148549530.001757170290093200.000878585145046599
880.9988661241407250.002267751718550930.00113387585927547
890.999246406329270.001507187341460440.000753593670730222
900.9988832214266360.002233557146727960.00111677857336398
910.99868967916310.002620641673799770.00131032083689988
920.9991378523881770.0017242952236460.000862147611823
930.9988819392593470.002236121481306770.00111806074065339
940.9985507799968950.002898440006209750.00144922000310487
950.997941697683870.004116604632258130.00205830231612906
960.997077085690290.005845828619419680.00292291430970984
970.9960497243875560.007900551224888620.00395027561244431
980.9946147773127940.0107704453744130.0053852226872065
990.994170877250710.01165824549857840.00582912274928922
1000.9928670161287950.01426596774240960.00713298387120479
1010.9904603498863220.01907930022735510.00953965011367755
1020.9890860742064430.02182785158711490.0109139257935575
1030.9915894045228720.01682119095425540.00841059547712768
1040.9927800005873990.01443999882520240.0072199994126012
1050.9934696786817140.01306064263657120.00653032131828561
1060.9931217746266680.01375645074666430.00687822537333217
1070.9924532971957780.01509340560844450.00754670280422226
1080.9933364886508580.01332702269828340.0066635113491417
1090.9948056188490240.01038876230195240.00519438115097622
1100.9958284734750530.008343053049894350.00417152652494717
1110.9950044580936040.009991083812791530.00499554190639576
1120.9967385651265880.006522869746824960.00326143487341248
1130.995786361447820.008427277104360530.00421363855218027
1140.9939148187650180.01217036246996510.00608518123498253
1150.9917000494427920.01659990111441510.00829995055720754
1160.9922917511005620.01541649779887660.00770824889943831
1170.9931035280477630.01379294390447390.00689647195223694
1180.989938915966120.02012216806776140.0100610840338807
1190.9849523853228990.03009522935420300.0150476146771015
1200.9893222114219220.0213555771561560.010677788578078
1210.984830012581230.03033997483753870.0151699874187694
1220.9779565054869330.04408698902613450.0220434945130673
1230.975198272001540.04960345599692070.0248017279984604
1240.964658967804780.070682064390440.03534103219522
1250.9611292712205040.07774145755899140.0388707287794957
1260.9593438757664370.08131224846712630.0406561242335632
1270.9472449461711570.1055101076576850.0527550538288426
1280.9448850749086930.1102298501826150.0551149250913074
1290.9623379240462180.07532415190756440.0376620759537822
1300.950774226493320.09845154701335930.0492257735066797
1310.9323813191632650.135237361673470.067618680836735
1320.9257895654597970.1484208690804060.0742104345402028
1330.8962081190987580.2075837618024840.103791880901242
1340.8561075880512930.2877848238974150.143892411948707
1350.8270296980501060.3459406038997880.172970301949894
1360.8015016935531920.3969966128936170.198498306446808
1370.7612291582073780.4775416835852440.238770841792622
1380.7887231877944140.4225536244111720.211276812205586
1390.9631823950902260.07363520981954820.0368176049097741
1400.9922415378165930.01551692436681510.00775846218340754
1410.9845447087115580.03091058257688410.0154552912884420
1420.9667492081052460.0665015837895070.0332507918947535
1430.935690789924250.1286184201515010.0643092100757505
1440.8743748336572870.2512503326854250.125625166342713
1450.8057602271101240.3884795457797520.194239772889876
1460.7352739582060970.5294520835878060.264726041793903


Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity
Description# significant tests% significant testsOK/NOK
1% type I error level750.547445255474453NOK
5% type I error level1030.751824817518248NOK
10% type I error level1130.824817518248175NOK
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2010/Dec/02/t1291291026jg8ozfvprf7wr9q/10uel61291289463.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/02/t1291291026jg8ozfvprf7wr9q/10uel61291289463.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/02/t1291291026jg8ozfvprf7wr9q/1ndoc1291289463.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/02/t1291291026jg8ozfvprf7wr9q/1ndoc1291289463.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/02/t1291291026jg8ozfvprf7wr9q/2ndoc1291289463.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/02/t1291291026jg8ozfvprf7wr9q/2ndoc1291289463.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/02/t1291291026jg8ozfvprf7wr9q/3y4nf1291289463.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/02/t1291291026jg8ozfvprf7wr9q/3y4nf1291289463.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/02/t1291291026jg8ozfvprf7wr9q/4y4nf1291289463.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/02/t1291291026jg8ozfvprf7wr9q/4y4nf1291289463.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/02/t1291291026jg8ozfvprf7wr9q/5y4nf1291289463.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/02/t1291291026jg8ozfvprf7wr9q/5y4nf1291289463.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/02/t1291291026jg8ozfvprf7wr9q/69wmi1291289463.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/02/t1291291026jg8ozfvprf7wr9q/69wmi1291289463.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/02/t1291291026jg8ozfvprf7wr9q/72n431291289463.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/02/t1291291026jg8ozfvprf7wr9q/72n431291289463.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/02/t1291291026jg8ozfvprf7wr9q/82n431291289463.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/02/t1291291026jg8ozfvprf7wr9q/82n431291289463.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/02/t1291291026jg8ozfvprf7wr9q/92n431291289463.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/02/t1291291026jg8ozfvprf7wr9q/92n431291289463.ps (open in new window)


 
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)
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