Home » date » 2010 » Dec » 02 »

workshop 7

*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 15:30:58 +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/t1291303770t4j7fpijhxvq5xi.htm/, Retrieved Thu, 02 Dec 2010 16:29:41 +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/t1291303770t4j7fpijhxvq5xi.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 «
0 5 1 1 1 2 1 21 1 4 1 4 1 4 1 21 0 7 1 5 2 4 1 24 0 7 2 2 1 4 2 21 5 5 1 1 1 3 2 21 5 1 1 1 2 2 22 4 4 1 2 1 3 2 22 4 4 2 1 1 4 1 20 0 6 2 1 1 2 1 21 0 5 2 1 1 3 0 21 0 1 2 3 2 3 2 21 5 5 1 1 1 3 1 22 0 4 2 1 1 4 1 22 2 6 1 1 1 3 1 23 3 7 1 2 1 2 1 23 0 7 1 4 2 5 2 21 0 2 2 1 1 2 2 24 0 6 2 1 1 3 1 23 0 4 2 1 1 3 2 21 4 3 1 2 1 3 1 23 0 6 1 3 1 3 2 32 8 6 1 1 1 4 1 21 0 5 2 1 2 3 2 21 0 4 2 1 1 1 2 21 0 6 1 1 2 3 1 21 3 4 2 1 1 2 2 21 0 3 2 2 4 4 1 20 24 4 2 1 1 4 1 24 15 5 1 1 1 4 1 22 0 6 1 1 1 1 2 22 12 6 2 1 1 3 2 21 0 4 2 1 1 1 2 21 0 6 1 1 1 4 1 21 0 6 2 1 1 2 2 21 4 5 2 1 1 3 1 23 1 6 2 1 1 3 1 23 0 4 1 1 1 2 2 21 16 6 2 1 1 4 1 20 9 7 1 1 1 1 2 21 0 5 2 1 1 2 1 20 8 6 2 1 1 3 2 21 10 6 1 1 1 3 1 22 0 5 2 4 1 5 2 21 6 7 2 1 1 3 1 22 0 6 2 1 1 4 1 22 0 3 1 4 3 3 2 22 15 4 1 2 2 4 1 22 0 5 1 2 1 2 1 21 0 4 1 1 1 3 1 21 0 3 2 1 1 2 2 21 0 5 1 2 2 3 1 23 0 5 1 1 1 2 2 23 0 4 2 1 1 3 2 23 0 5 2 1 1 4 1 22 10 1 2 1 1 1 1 24 7 2 2 1 1 1 1 23 2 3 2 1 1 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 time10 seconds
R Server'Gwilym Jenkins' @ 72.249.127.135


Multiple Linear Regression - Estimated Regression Equation
meer_sport[t] = -0.312893344343957 -0.0246829759182962Fietsen[t] -0.198504165639036algemene_tevredenheid[t] + 0.284660002112055roken[t] + 0.327147951886211drugs[t] + 0.348520585269895drankgebruik[t] + 0.0154843612941977geslacht[t] + 0.00451209386384474leeftijd[t] + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)-0.3128933443439570.639265-0.48950.6252230.312612
Fietsen-0.02468297591829620.048425-0.50970.6109880.305494
algemene_tevredenheid-0.1985041656390360.108497-1.82960.0692720.034636
roken0.2846600021120550.1036232.74710.006740.00337
drugs0.3271479518862110.07314.47531.5e-057e-06
drankgebruik0.3485205852698950.1384892.51660.0128870.006444
geslacht0.01548436129419770.0170580.90770.3654560.182728
leeftijd0.004512093863844740.0114870.39280.6950260.347513


Multiple Linear Regression - Regression Statistics
Multiple R0.456956700210581
R-squared0.208809425867343
Adjusted R-squared0.172373017848076
F-TEST (value)5.73079063547996
F-TEST (DF numerator)7
F-TEST (DF denominator)152
p-value6.72660873723974e-06
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation0.809346669646454
Sum Squared Residuals99.5663888135065


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
110.1136732844338760.886326715566124
211.83851565103055-0.838515651030554
311.89303036562154-0.893030365621545
420.7138504871018311.28614951289817
510.354263351406470.64573664859353
611.35988901077752-0.359889010777522
721.711719938582030.288280061417971
811.44282604151553-0.442826041515535
910.7546485472007190.245351452799281
1010.757958889735330.242041110264669
1131.860952435379581.13904756462042
1211.32046800193846-0.320468001938459
1311.48281895183162-0.48281895183162
1411.32480566890589-0.324805668905895
1520.9594384595098541.04056154049015
1642.543094179962041.45690582003796
1711.24835412002639-0.248354120026392
1811.11276522167532-0.112765221675325
1911.49773141164880-0.497731411648796
2021.385318315069250.614681684930751
2131.835245975142791.16475402485721
2211.60744861661218-0.607448616612176
2311.73966006238718-0.739660062387176
2410.8253871324209960.174612867579004
2511.57849694842955-0.578496948429555
2611.15253508430721-0.152535084307207
2722.42977927650227-0.429779276502271
2811.57244489465000-0.572444894649997
2911.64761595382467-0.64761595382467
3011.04415483388377-0.0441548338837738
3111.43031708435682-0.430317084356825
3210.8253871324209960.174612867579004
3311.60744861661218-0.607448616612176
3411.12121750792599-0.121217507925993
3511.14196029145747-0.141960291457466
3611.11276522167532-0.112765221675325
3711.42323275176776-0.423232751767758
3811.43406893445355-0.434068934453545
3910.9498423703051430.0501576296948569
4010.7999439127355750.200056087264425
4111.47543802299527-0.475438022995272
4211.29578502602016-0.295785026020163
4342.136368527230611.86363147276939
4411.07259788446283-0.072597884462831
4511.42442881226734-0.424428812267338
4642.355355951226731.64464404877327
4721.956958931855020.0430410681449788
4820.977835688758051.02216431124195
4911.32966661656256-0.329666616562558
5011.17721806022550-0.177218060225503
5121.620612365344710.379387634655288
5211.35732499661634-0.357324996616341
5311.51065175878181-0.510651758781813
5411.49423272682408-0.494232726824082
5510.6289532158354960.371046784164504
5610.5662254093037780.433774590696222
5710.8500701083392920.149929891660708
5821.482818951831620.51718104816838
5911.1927024215197-0.192702421519701
6011.09202243814385-0.0920224381438522
6111.23467352912625-0.234673529126252
6222.26862252244703-0.268622522447034
6311.54258526962154-0.542585269621544
6421.289499279350060.710500720649936
6541.644305611290062.35569438870994
6611.44580144565102-0.445801445651023
6711.13337761129189-0.133377611291885
6811.42442881226734-0.424428812267338
6921.639033273659090.360966726340911
7031.923077341312631.07692265868737
7111.51153477390603-0.51153477390603
7211.47379476410393-0.473794764103931
7311.11351724087841-0.113517240878409
7411.30498364064426-0.304983640644262
7511.12824958296952-0.128249582969523
7611.12824958296952-0.128249582969523
7712.04444565091675-1.04444565091675
7842.005335153718661.99466484628134
7911.10630504810882-0.106305048108817
8011.91911220720419-0.91911220720419
8121.449553295747740.550446704252257
8211.55518688054954-0.555186880549545
8311.67725253116892-0.67725253116892
8411.90759298001843-0.907592980018429
8511.52675205453453-0.526752054534528
8611.15806058721018-0.158060587210182
8711.60744861661218-0.607448616612176
8811.29578502602016-0.295785026020163
8910.8500701083392920.149929891660708
9022.17676862083629-0.176768620836286
9111.63664368639432-0.636643686394317
9211.44580144565102-0.445801445651023
9311.49516739748762-0.495167397487615
9411.57713468559761-0.577134685597606
9511.44911178818563-0.449111788185634
9620.6260047609535441.37399523904646
9711.71906312727276-0.719063127272756
9851.761216886339763.23878311366024
9911.38426147505484-0.384261475054844
10011.40894445097314-0.40894445097314
10111.46128580694522-0.46128580694522
10221.439913173561540.560086826438464
10311.92564135547381-0.925641355473808
10432.138933804047230.861066195952774
10511.48870722392111-0.488707223921107
10611.47968303619342-0.479683036193417
10711.09728086038113-0.0972808603811273
10831.760775378777651.23922462122235
10911.55076744045499-0.550767440454991
11011.28030066472597-0.280300664725965
11111.08874161119082-0.0887416111908218
11211.58276564069388-0.58276564069388
11311.55373196394831-0.553731963948306
11411.03348738726474-0.0334873872647423
11521.896364277128710.103635722871285
11621.083772863794990.916227136205011
11741.812182064086202.18781793591380
11842.192252982130481.80774701786952
11911.56728127939968-0.567281279399682
12011.21592744608524-0.215927446085236
12111.13765090949543-0.137650909495426
12211.51891570274238-0.518915702742378
12341.993748816491452.00625118350855
12412.0609197421839-1.0609197421839
12511.33878345805954-0.338783458059538
12611.52678033953992-0.526780339539924
12711.45831040280973-0.458310402809733
12831.461285806945221.53871419305478
12911.40563410843853-0.405634108438529
13012.07583220200108-1.07583220200108
13112.32483696076448-1.32483696076448
13241.775513411698422.22448658830158
13341.985561746244822.01443825375518
13411.48264452493521-0.482644524935211
13521.969065840573150.0309341594268482
13610.8253871324209960.174612867579004
13721.745185565290150.254814434709849
13811.40894445097314-0.40894445097314
13931.582765640693881.41723435930612
14021.983041765065140.0169582349348603
14121.424428812267340.575571187732662
14211.42716725332493-0.427167253324928
14311.45500006027512-0.455000060275121
14421.455000060275120.544999939724879
14511.42442881226734-0.424428812267338
14622.17676862083629-0.176768620836286
14722.02703815164151-0.0270381516415052
14810.97818238933320.0218176106668005
14911.80391812012563-0.803918120125629
15021.618693434048380.381306565951621
15111.59825000198808-0.598250001988077
15221.424428812267340.575571187732662
15311.6534371158727-0.653437115872701
15411.13116245092352-0.131162450923522
15511.64292943306442-0.642929433064416
15611.47968303619342-0.479683036193417
15711.82487936353501-0.824879363535007
15811.61373436328228-0.613734363282275
15911.78942348880438-0.789423488804381
16011.39974583634904-0.399745836349042


Goldfeld-Quandt test for Heteroskedasticity
p-valuesAlternative Hypothesis
breakpoint indexgreater2-sidedless
110.4289632193230430.8579264386460850.571036780676957
120.2733755492004630.5467510984009260.726624450799537
130.205635540309920.411271080619840.79436445969008
140.1180636549364250.2361273098728500.881936345063575
150.1888178721870080.3776357443740160.811182127812992
160.719709359676990.560581280646020.28029064032301
170.6919976055077140.6160047889845720.308002394492286
180.6173841848322340.7652316303355330.382615815167766
190.6121488295493360.7757023409013270.387851170450664
200.5634167819744490.8731664360511030.436583218025551
210.5692393733517980.8615212532964050.430760626648202
220.5577222275869140.8845555448261710.442277772413086
230.5178640756662360.9642718486675280.482135924333764
240.4443780361905720.8887560723811440.555621963809428
250.3824177618784580.7648355237569170.617582238121541
260.3194478771011970.6388957542023930.680552122898803
270.2638988833922780.5277977667845560.736101116607722
280.3135689381391520.6271378762783050.686431061860848
290.2889815638296520.5779631276593050.711018436170348
300.2439429506246750.487885901249350.756057049375325
310.2214241250086290.4428482500172570.778575874991371
320.1759054403376500.3518108806753010.82409455966235
330.1521131172839710.3042262345679410.84788688271603
340.1215673020472670.2431346040945340.878432697952733
350.09290416304408920.1858083260881780.907095836955911
360.06932611532888460.1386522306577690.930673884671115
370.06215878005458700.1243175601091740.937841219945413
380.04968790861603120.09937581723206240.950312091383969
390.03585988746764900.07171977493529790.96414011253235
400.02608835988751040.05217671977502080.97391164011249
410.02234438911033710.04468877822067410.977655610889663
420.01585741080844380.03171482161688770.984142589191556
430.06078033937528150.1215606787505630.939219660624719
440.04531422218070710.09062844436141420.954685777819293
450.03705995415993560.07411990831987130.962940045840064
460.1218347330801980.2436694661603970.878165266919802
470.09817516567889830.1963503313577970.901824834321102
480.1236811381430850.2473622762861700.876318861856915
490.1030965456245130.2061930912490260.896903454375487
500.08467761655613470.1693552331122690.915322383443865
510.0746969329666510.1493938659333020.925303067033349
520.06312426080060860.1262485216012170.936875739199391
530.05717506612352350.1143501322470470.942824933876476
540.05000203130850030.1000040626170010.9499979686915
550.03920092423796990.07840184847593990.96079907576203
560.03150512153792420.06301024307584850.968494878462076
570.02373373020046480.04746746040092970.976266269799535
580.01986290636923160.03972581273846330.980137093630768
590.01528437140249870.03056874280499740.984715628597501
600.01101319955336910.02202639910673820.98898680044663
610.008603151880375680.01720630376075140.991396848119624
620.006222156964655870.01244431392931170.993777843035344
630.005653678920571570.01130735784114310.994346321079428
640.005483132222053460.01096626444410690.994516867777947
650.05342532725037160.1068506545007430.946574672749628
660.04529128079792750.0905825615958550.954708719202072
670.03491605557456310.06983211114912620.965083944425437
680.02813195781358860.05626391562717720.971868042186411
690.02205804005311930.04411608010623860.977941959946881
700.02996797133339590.05993594266679180.970032028666604
710.02639088317325780.05278176634651560.973609116826742
720.02186269197005040.04372538394010070.97813730802995
730.01705481604563800.03410963209127600.982945183954362
740.01326855856006710.02653711712013420.986731441439933
750.009726818585383110.01945363717076620.990273181414617
760.00704859250802130.01409718501604260.992951407491979
770.008872953588641930.01774590717728390.991127046411358
780.03766067239253120.07532134478506250.962339327607469
790.02921266863752450.05842533727504910.970787331362476
800.03177963881976030.06355927763952060.96822036118024
810.02806099388496140.05612198776992280.971939006115039
820.02435736165612580.04871472331225150.975642638343874
830.02221095821337130.04442191642674250.977789041786629
840.02264294912157440.04528589824314880.977357050878426
850.01928713200398190.03857426400796370.980712867996018
860.01454643915981790.02909287831963590.985453560840182
870.01260358700969370.02520717401938750.987396412990306
880.009573759897304520.01914751979460900.990426240102696
890.007282582171965130.01456516434393030.992717417828035
900.005273010849955210.01054602169991040.994726989150045
910.004673959389365410.009347918778730820.995326040610635
920.003566474826233490.007132949652466980.996433525173766
930.002811340774735750.00562268154947150.997188659225264
940.002224986139251800.004449972278503610.997775013860748
950.00170872871613690.00341745743227380.998291271283863
960.00383224665034850.0076644933006970.996167753349652
970.003456480871081980.006912961742163960.996543519128918
980.1541405641996960.3082811283993930.845859435800304
990.1326663710133730.2653327420267460.867333628986627
1000.1142177374469560.2284354748939130.885782262553044
1010.09703799244125040.1940759848825010.90296200755875
1020.08597883622024320.1719576724404860.914021163779757
1030.09176386721677430.1835277344335490.908236132783226
1040.0968548301272420.1937096602544840.903145169872758
1050.08210163232668120.1642032646533620.917898367673319
1060.06891193317751370.1378238663550270.931088066822486
1070.05393931810407830.1078786362081570.946060681895922
1080.07083341771508140.1416668354301630.929166582284919
1090.06155467068796030.1231093413759210.93844532931204
1100.04934929156254520.09869858312509040.950650708437455
1110.03873753410299270.07747506820598540.961262465897007
1120.03561583505996820.07123167011993640.964384164940032
1130.02893658569572890.05787317139145780.971063414304271
1140.02143864641964820.04287729283929640.978561353580352
1150.01767274809430840.03534549618861680.982327251905692
1160.01810540147657520.03621080295315040.981894598523425
1170.09178091197473040.1835618239494610.90821908802527
1180.1861370478557130.3722740957114260.813862952144287
1190.1766431393556100.3532862787112210.82335686064439
1200.1447728304845920.2895456609691830.855227169515408
1210.1223945064329410.2447890128658820.877605493567059
1220.09929686934607830.1985937386921570.900703130653922
1230.3728987168115550.7457974336231090.627101283188445
1240.3613315982697900.7226631965395810.63866840173021
1250.3437996188234670.6875992376469340.656200381176533
1260.2956184224427690.5912368448855380.704381577557231
1270.2488289190741520.4976578381483050.751171080925848
1280.3690348524484550.738069704896910.630965147551545
1290.3291825495790830.6583650991581670.670817450420917
1300.3180790414741420.6361580829482850.681920958525858
1310.3568204970346630.7136409940693260.643179502965337
1320.7567047968302440.4865904063395110.243295203169756
1330.9744741112902830.0510517774194340.025525888709717
1340.9615749182016950.07685016359661030.0384250817983051
1350.9418658025229460.1162683949541080.0581341974770542
1360.9142538338666330.1714923322667350.0857461661333674
1370.8953388361647950.2093223276704110.104661163835205
1380.8575128375082330.2849743249835340.142487162491767
1390.9717526252805330.05649474943893390.0282473747194669
1400.9757641500358680.04847169992826360.0242358499641318
1410.9827153803123270.03456923937534500.0172846196876725
1420.968107341613370.063785316773260.03189265838663
1430.949499935131340.1010001297373200.0505000648686602
1440.9673035030895560.06539299382088890.0326964969104445
1450.9383371987021770.1233256025956450.0616628012978227
1460.9603505407476350.07929891850472940.0396494592523647
1470.9583967930819120.08320641383617660.0416032069180883
1480.9084312654680360.1831374690639270.0915687345319636
1490.83301344227480.33397311545040.1669865577252


Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity
Description# significant tests% significant testsOK/NOK
1% type I error level70.0503597122302158NOK
5% type I error level380.273381294964029NOK
10% type I error level650.467625899280576NOK
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2010/Dec/02/t1291303770t4j7fpijhxvq5xi/10mg9o1291303847.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/02/t1291303770t4j7fpijhxvq5xi/10mg9o1291303847.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/02/t1291303770t4j7fpijhxvq5xi/17obx1291303847.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/02/t1291303770t4j7fpijhxvq5xi/17obx1291303847.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/02/t1291303770t4j7fpijhxvq5xi/27obx1291303847.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/02/t1291303770t4j7fpijhxvq5xi/27obx1291303847.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/02/t1291303770t4j7fpijhxvq5xi/37obx1291303847.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/02/t1291303770t4j7fpijhxvq5xi/37obx1291303847.ps (open in new window)


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


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


http://www.freestatistics.org/blog/date/2010/Dec/02/t1291303770t4j7fpijhxvq5xi/6iybi1291303847.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/02/t1291303770t4j7fpijhxvq5xi/6iybi1291303847.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/02/t1291303770t4j7fpijhxvq5xi/7t7al1291303847.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/02/t1291303770t4j7fpijhxvq5xi/7t7al1291303847.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/02/t1291303770t4j7fpijhxvq5xi/8mg9o1291303847.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/02/t1291303770t4j7fpijhxvq5xi/8mg9o1291303847.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/02/t1291303770t4j7fpijhxvq5xi/9mg9o1291303847.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/02/t1291303770t4j7fpijhxvq5xi/9mg9o1291303847.ps (open in new window)


 
Parameters (Session):
par1 = 3 ; par2 = Do not include Seasonal Dummies ; par3 = No Linear Trend ;
 
Parameters (R input):
par1 = 3 ; 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