Home » date » 2010 » Nov » 22 »

WS 7 Multiple Lineair Regression 1

*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:47:12 +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/t1290463253whxcw9yzr5smxhe.htm/, Retrieved Mon, 22 Nov 2010 23:01:03 +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/t1290463253whxcw9yzr5smxhe.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,3 6,0 5,5 12 5,6 4,0 3,5 11 3,8 4,0 8,5 14 4,0 4,0 5,0 12 4,0 4,5 6,0 21 3,6 3,5 6,0 12 4,4 2,0 5,5 22 3,6 5,5 5,5 11 4,0 3,5 6,0 10 3,8 3,5 6,5 13 5,1 6,0 7,0 10 6,7 5,0 8,0 8 5,1 5,0 5,5 15 4,0 4,0 5,0 14 3,3 4,0 5,5 10 2,7 2,0 7,5 14 4,7 4,5 4,5 14 3,3 4,0 5,5 11 4,4 3,5 8,5 10 6,9 5,5 8,5 13 6,0 4,5 5,5 7 7,6 5,5 9,0 14 4,7 6,5 7,0 12 6,9 4,0 5,0 14 4,2 4,0 5,5 11 3,6 4,5 7,5 9 4,4 3,0 7,5 11 4,7 4,5 6,5 15 4,9 4,5 8,0 14 3,8 3,0 6,5 13 5,3 3,0 4,5 9 5,6 8,0 9,0 15 5,8 2,5 9,0 10 5,6 3,5 6,0 11 3,8 4,5 8,5 13 7,1 3,0 4,5 8 7,3 3,0 4,5 20 2,9 2,5 6,0 12 7,1 6,0 9,0 10 5,6 3,5 6,0 10 6,4 5,0 9,0 9 4,9 4,5 7,0 14 4,0 4,0 7,5 8 3,8 2,5 8,0 14 4,4 4,0 5,0 11 3,3 4,0 5,5 13 4,4 5,0 7,0 9 7,3 3,0 4,5 11 6,4 4,0 6,0 15 5,1 3,5 8,5 11 5,8 2,0 2,5 10 4,0 4,0 6,0 14 4,4 4,0 6,0 18 2,4 2,0 3,0 14 6,2 10,0 12,0 11 5,8 4,0 6,0 12 4,9 4,0 6,0 13 3,8 3,0 7,0 9 2,7 2,0 3,5 10 3,1 4,0 6,5 15 3,8 4,5 6,0 20 4,7 3,0 6,5 12 4,2 3,5 7,0 12 4,0 4,5 4,0 14 2,2 2,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.1649413765651 -0.229535622522770Concerns[t] -0.0358463929726011Criticism[t] -0.00365780052241122Expectat[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.16494137656511.19434311.8600
Concerns-0.2295356225227700.212105-1.08220.2808540.140427
Criticism-0.03584639297260110.233418-0.15360.8781470.439074
Expectat-0.003657800522411220.184625-0.01980.9842190.492109


Multiple Linear Regression - Regression Statistics
Multiple R0.0994157252602019
R-squared0.00988348642901194
Adjusted R-squared-0.00928005899494266
F-TEST (value)0.515744149131063
F-TEST (DF numerator)3
F-TEST (DF denominator)155
p-value0.672036190260502
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation3.15996396263658
Sum Squared Residuals1547.73269800009


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
11212.7132063164855-0.713206316485528
21112.7233540167187-1.72335401671874
31413.11822913464770.881770865352333
41213.0851243119716-1.08512431197155
52113.06354331496287.93645668503716
61213.1912039569446-1.19120395694455
72213.06317394864648.93682605135356
81113.1213400712606-2.12134007126055
91013.0993897079354-3.09938970793544
101313.1434679321788-0.14346793217879
111012.7536267402065-2.75362674020648
12812.4185583366202-4.41855833662024
131512.79495983396272.2050401660373
141413.08512431197160.914875688028448
151013.2439703474763-3.24397034747629
161413.44606890589030.553931094109673
171412.90835507998051.09164492001948
181113.2439703474763-2.24397034747629
191012.9984309576203-2.99843095762031
201312.35289911536820.64710088463182
21712.6063009701785-5.60630097017851
221412.19039527934101.80960472065897
231212.8275177927293-0.827517792729288
241412.41947100665551.58052899334448
251113.0373882872058-2.03738828720579
26913.1498708631883-4.14987086318833
271113.0200119546290-2.02001195462902
281512.90103947893572.09896052106430
291412.84964565364751.15035434635247
301313.1613911286651-0.161391128665091
31912.8244032959258-3.82440329592576
321512.55985054195512.44014945804493
331012.7110985787998-2.71109857879982
341112.7321327118990-1.73213271189901
351313.1003059381614-0.100305938161367
36812.4112391753848-4.41123917538477
372012.36533205088027.63466794911978
381213.3877252856831-1.38772528568309
391012.2872398941161-2.28723989411612
401012.7321327118990-2.73213271189901
41912.4837612228547-3.48376122285466
421412.85330345416991.14669654583006
43813.0759798106655-5.07597981066553
441413.17382762436780.826172375632225
451112.9933100629624-1.99331006296244
461313.2439703474763-0.243970347476285
47912.9501480689450-3.95014806894502
481112.3653320508802-1.36533205088022
491512.53058101739452.46941898260551
501112.8377560218544-1.83775602185437
511012.7527974786818-2.7527974786818
521413.08146651144910.918533488550859
531812.98965226244005.01034773755997
541413.5313896949980.468610305001992
551112.3394629809290-1.33946298092897
561212.6683023909082-0.668302390908156
571312.87488445117860.125115548821352
58913.1595622284039-4.15956222840389
591013.4607001079800-3.46070010797997
601513.28621967145841.71378032854157
612013.10945043946746.8905495605326
621212.9548090683946-0.954809068394598
631213.0498247829085-1.04982478290848
641413.07085891600770.929141083992337
651313.5502291217102-0.550229121710234
661112.5898373076370-1.58983730763701
671712.41764210639434.58235789360569
681213.0337304866834-1.03373048668338
691313.5800419499897-0.580041949989693
701412.99148116270121.00851883729876
711312.59441133838530.405588661614651
721513.05896928421451.94103071578550
731312.43831043336770.561689566632254
741012.4658380263684-2.46583802636836
751112.6986620830971-1.69866208309714
761912.82897732667416.17102267332591
771313.3679731889356-0.367973188935583
781712.89921057867454.10078942132551
791313.039217187467-0.0392171874669982
80912.6105056346104-3.61050563461044
811112.7913020334403-1.79130203344029
821013.0832954117103-3.08329541171035
83912.918962675422-3.918962675422
841212.9464902684226-0.94649026842261
851212.8900625171778-0.890062517177819
861312.93139917112470.0686008288753193
871312.97639006540330.0236099345966903
881213.2476281479987-1.24762814799870
891512.46163336193642.53836663806358
902213.05348258343098.94651741656911
911312.66464459038570.335355409614255
921513.53779262600751.46220737399245
931313.2325370507008-0.232537050700767
941512.90524414336762.09475585663237
951013.0015418942332-3.00154189423319
961112.3276603178371-1.32766031783706
971612.39423220912443.6057677908756
981112.4479148298821-1.44791482988206
991113.0534825834309-2.05348258343089
1001012.8730555509174-2.87305555091744
1011012.7876442329179-2.78764423291788
1021613.27798784018772.72201215981232
1031212.941003567639-0.941003567638993
1041113.0401334176929-2.04013341769292
1051612.79495983396273.2050401660373
1061912.76980800513286.23019199486718
1071112.9423725726919-1.94237257269191
1081612.74539490893573.25460509106427
1091512.65495322517022.34504677482981
1102413.163220028926310.8367799710737
1111413.35187889271050.648121107289512
1121512.49747975490902.50252024509098
1131112.8725086870079-1.87250868700792
1141512.64946652438662.35053347561343
1151213.4940837680806-1.4940837680806
1161013.2252214496559-3.22522144965595
1171413.02641488563860.97358511436144
1181313.1687067297099-0.168706729709913
119912.6907996181428-3.69079961814279
1201513.06866064943011.93133935056994
1211512.61141830464572.38858169535428
1221413.30597176820590.694028231794066
1231112.8174570611973-1.81745706119734
124813.2889612417549-5.28896124175491
1251113.0607981844757-2.06079818447571
1261112.980507761134-1.98050776113401
127813.3174920336827-5.31749203368269
1281012.9914811627012-2.99148116270124
1291113.0598855144404-2.05988551444043
1301312.32582785738520.674172142614793
1311112.8192859614585-1.81928596145854
1322013.17328076045826.82671923954175
1331013.1829721256738-3.1829721256738
1341513.25046024718711.74953975281293
1351212.9207915756832-0.920791575683202
1361412.61782479584591.38217520415409
1372313.11731290442179.88268709557826
1381413.06171441470160.938285585298365
1391613.10945043946742.89054956053261
1401112.7852684687471-1.78526846874715
1411212.4492838349350-0.449283834934979
1421012.4203872368814-2.42038723688144
1431412.54604504119951.45395495880053
1441212.9837056664481-0.983705666448132
1451212.8578774849183-0.857877484918273
1461112.5682563106283-1.5682563106283
1471212.3887455083408-0.388745508340781
1481313.0094043591875-0.00940435918753933
1491113.1553575639719-2.15535756397195
1501912.83538025768366.16461974231636
1511212.9735579662149-0.973557966214938
1521712.56917254085424.43082745914577
153912.0729728664844-3.07297286648440
1541212.9070730436288-0.907073043628838
1551912.88540507791896.11459492208111
1561813.16139112866514.83860887133491
1571512.57831704216032.42168295783975
1581412.83355135742241.16644864257757
1591112.2596253324143-1.25962533241427


Goldfeld-Quandt test for Heteroskedasticity
p-valuesAlternative Hypothesis
breakpoint indexgreater2-sidedless
70.9796788203065210.04064235938695710.0203211796934785
80.956225755932170.0875484881356610.0437742440678305
90.9734085048559630.05318299028807480.0265914951440374
100.9571726285868540.08565474282629160.0428273714131458
110.9352458503444440.1295082993111120.064754149655556
120.9293034694027260.1413930611945490.0706965305972745
130.9220845027877290.1558309944245420.077915497212271
140.8841721330136070.2316557339727850.115827866986393
150.8999021974128110.2001956051743770.100097802587189
160.8729769181188620.2540461637622760.127023081881138
170.8292558440558180.3414883118883650.170744155944182
180.8038975157995340.3922049684009330.196102484200466
190.7834972829702810.4330054340594370.216502717029719
200.7555231676394140.4889536647211720.244476832360586
210.8457712597371940.3084574805256110.154228740262806
220.8383650437476320.3232699125047350.161634956252368
230.8021086578398110.3957826843203780.197891342160189
240.7562562749846310.4874874500307370.243743725015369
250.7217251204433230.5565497591133540.278274879556677
260.721766531431440.556466937137120.27823346856856
270.6944155593826330.6111688812347350.305584440617367
280.6745585454646210.6508829090707580.325441454535379
290.6339819846767670.7320360306464660.366018015323233
300.575636728401730.848726543196540.42436327159827
310.6285644461637630.7428711076724740.371435553836237
320.6401194658582580.7197610682834850.359880534141742
330.622152582750360.7556948344992790.377847417249640
340.5762522487392690.8474955025214620.423747751260731
350.519586372326010.960827255347980.48041362767399
360.5351077160783710.9297845678432590.464892283921629
370.7890679129560980.4218641740878040.210932087043902
380.7518346893853220.4963306212293560.248165310614678
390.7245154227075590.5509691545848820.275484577292441
400.7071422004281620.5857155991436760.292857799571838
410.7003984789882530.5992030420234940.299601521011747
420.6646214203860880.6707571592278240.335378579613912
430.7119160260882740.5761679478234530.288083973911726
440.6756187586421160.6487624827157680.324381241357884
450.6423608136973560.7152783726052890.357639186302645
460.5939670140549090.8120659718901820.406032985945091
470.6027443580721370.7945112838557260.397255641927863
480.5622411510057010.8755176979885980.437758848994299
490.5486885345196020.9026229309607970.451311465480398
500.5097709607023810.9804580785952370.490229039297619
510.498952236331660.997904472663320.50104776366834
520.4588795721098840.9177591442197670.541120427890116
530.548675846461290.9026483070774190.451324153538710
540.5009073492635480.9981853014729040.499092650736452
550.458475595851170.916951191702340.54152440414883
560.411731263876410.823462527752820.58826873612359
570.3662015858660530.7324031717321060.633798414133947
580.3898174083959890.7796348167919780.610182591604011
590.3937642281432910.7875284562865820.606235771856709
600.3690105382167010.7380210764334030.630989461783299
610.5572003200859440.8855993598281130.442799679914056
620.5136536150140850.9726927699718290.486346384985915
630.4710306383237440.9420612766474880.528969361676256
640.4282637518528720.8565275037057430.571736248147128
650.3844612139414070.7689224278828140.615538786058593
660.3491034322983220.6982068645966430.650896567701678
670.4059530756633570.8119061513267130.594046924336643
680.3656473654195490.7312947308390980.634352634580451
690.3250153790923970.6500307581847950.674984620907603
700.2890110318858550.5780220637717090.710988968114145
710.2518406766158820.5036813532317640.748159323384118
720.2295374441426860.4590748882853730.770462555857314
730.1980096931297780.3960193862595550.801990306870222
740.1831114319413350.3662228638826700.816888568058665
750.1620894185389050.3241788370778110.837910581461095
760.2590865822871880.5181731645743770.740913417712812
770.2255318092613380.4510636185226760.774468190738662
780.2518464388672300.5036928777344600.74815356113277
790.2163806910150230.4327613820300460.783619308984977
800.2254842613530080.4509685227060160.774515738646992
810.2020216992187810.4040433984375610.79797830078122
820.2009130178911390.4018260357822780.799086982108861
830.2194165585307840.4388331170615680.780583441469216
840.1910489896012000.3820979792024010.8089510103988
850.1635685696773580.3271371393547160.836431430322642
860.1394076700724300.2788153401448590.86059232992757
870.1161332640493460.2322665280986930.883866735950654
880.09845742958264830.1969148591652970.901542570417352
890.09309166134491170.1861833226898230.906908338655088
900.2956622543114690.5913245086229390.704337745688531
910.2577139213880140.5154278427760280.742286078611986
920.2273172129799930.4546344259599860.772682787020007
930.1942926738430460.3885853476860910.805707326156954
940.1758531245215770.3517062490431540.824146875478423
950.1717744609447130.3435489218894260.828225539055287
960.1506691377766340.3013382755532670.849330862223366
970.1579890160437850.315978032087570.842010983956215
980.1372880720878890.2745761441757770.86271192791211
990.1245798982747470.2491597965494940.875420101725253
1000.1222488332488810.2444976664977620.87775116675112
1010.1191193267666950.2382386535333910.880880673233305
1020.1096106200978250.2192212401956510.890389379902175
1030.09505561332500520.1901112266500100.904944386674995
1040.08694646223853250.1738929244770650.913053537761467
1050.08768505144095760.1753701028819150.912314948559042
1060.1487978642911200.2975957285822390.85120213570888
1070.1315015324534480.2630030649068960.868498467546552
1080.1316851466918150.263370293383630.868314853308185
1090.1188879957532050.2377759915064100.881112004246795
1100.513964759229030.972070481541940.48603524077097
1110.4643151815806570.9286303631613130.535684818419343
1120.4436334867824360.8872669735648730.556366513217564
1130.4042434362411970.8084868724823950.595756563758803
1140.3748647208911470.7497294417822930.625135279108853
1150.3360637744331240.6721275488662490.663936225566875
1160.3528784126336850.705756825267370.647121587366315
1170.3079005216357440.6158010432714880.692099478364256
1180.263083320557660.526166641115320.73691667944234
1190.2829094995047660.5658189990095320.717090500495234
1200.2556421430578770.5112842861157540.744357856942123
1210.2637235631289330.5274471262578650.736276436871067
1220.2217287095258350.443457419051670.778271290474165
1230.1966956667619890.3933913335239770.803304333238011
1240.2571313124026070.5142626248052140.742868687597393
1250.2301831475719080.4603662951438160.769816852428092
1260.2286058346774330.4572116693548650.771394165322568
1270.3962400234452920.7924800468905840.603759976554708
1280.4183786892834590.8367573785669190.58162131071654
1290.4466819990920150.8933639981840310.553318000907985
1300.4286836084536850.8573672169073690.571316391546315
1310.4009675879166970.8019351758333930.599032412083303
1320.4993636937697050.998727387539410.500636306230295
1330.6235526806350040.7528946387299920.376447319364996
1340.567019072396110.865961855207780.43298092760389
1350.5322315099552780.9355369800894440.467768490044722
1360.4676359645245090.9352719290490190.532364035475491
1370.8240250585024070.3519498829951860.175974941497593
1380.7751380612867180.4497238774265640.224861938713282
1390.728067025722950.54386594855410.27193297427705
1400.6896103888893540.6207792222212920.310389611110646
1410.6326306293085150.734738741382970.367369370691485
1420.5787219338628480.8425561322743040.421278066137152
1430.5093876546629080.9812246906741840.490612345337092
1440.4260804080983940.8521608161967890.573919591901606
1450.4216660487252010.8433320974504020.578333951274799
1460.3331231259063130.6662462518126270.666876874093687
1470.2492526434416510.4985052868833030.750747356558349
1480.1850900329429690.3701800658859380.81490996705703
1490.3248490452094180.6496980904188370.675150954790582
1500.3744153413454070.7488306826908150.625584658654593
1510.4112120347489960.8224240694979930.588787965251004
1520.4894531963300520.9789063926601030.510546803669948


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 level40.0273972602739726OK
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2010/Nov/22/t1290463253whxcw9yzr5smxhe/10nhfs1290462421.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Nov/22/t1290463253whxcw9yzr5smxhe/10nhfs1290462421.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Nov/22/t1290463253whxcw9yzr5smxhe/1ygiz1290462421.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Nov/22/t1290463253whxcw9yzr5smxhe/1ygiz1290462421.ps (open in new window)


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


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


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


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


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


http://www.freestatistics.org/blog/date/2010/Nov/22/t1290463253whxcw9yzr5smxhe/7c8gp1290462421.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Nov/22/t1290463253whxcw9yzr5smxhe/7c8gp1290462421.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Nov/22/t1290463253whxcw9yzr5smxhe/8c8gp1290462421.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Nov/22/t1290463253whxcw9yzr5smxhe/8c8gp1290462421.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Nov/22/t1290463253whxcw9yzr5smxhe/9c8gp1290462421.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Nov/22/t1290463253whxcw9yzr5smxhe/9c8gp1290462421.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