Home » date » 2007 » Nov » 22 » attachments

WS_03: Q3

R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Thu, 22 Nov 2007 06:36:57 -0700
 
Cite this page as follows:
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL http://www.freestatistics.org/blog/date/2007/Nov/22/t1195738658pr04x52dhbikwj5.htm/, Retrieved Thu, 22 Nov 2007 14:37:39 +0100
 
User-defined keywords:
Christel Stuer, Steven Coomans
 
Dataseries X:
» Textbox « » Textfile « » CSV «
527 0 516 0 503 0 489 0 479 0 475 0 524 0 552 0 532 0 511 0 492 0 492 0 493 0 481 0 462 0 457 0 442 0 439 0 488 0 521 0 501 0 485 0 464 0 460 0 467 0 460 0 448 0 443 0 436 0 431 0 484 0 510 0 513 0 503 0 471 0 471 1 476 1 475 1 470 1 461 1 455 1 456 1 517 1 525 1 523 1 519 1 509 1 512 1 519 1 517 1 510 1 509 1 501 1 507 1 569 1 580 1 578 1 565 1 547 1 555 1 562 1 561 1 555 1 544 1 537 1 543 1 594 1 611 1 613 1 611 1 594 1 595 1 591 1 589 1 584 1 573 1 567 1 569 1 621 1 629 1 628 1 612 1 595 1 597 1 593 1 590 1 580 1 574 1 573 1 573 1 620 1 626 1
 
Text written by user:
 
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 compuational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time6 seconds
R Server'Herman Ole Andreas Wold' @ 193.190.124.10:1001


Multiple Linear Regression - Estimated Regression Equation
y[t] = + 448.89250965251 -7.84630630630631x[t] + 10.4152697340197M1[t] + 3.81710317460317M2[t] -7.53106338481338M3[t] -17.0042299442299M4[t] -26.2273965036465M5[t] -27.5755630630631M6[t] + 23.7012703775204M7[t] + 39.1031038181038M8[t] + 33.4771702059202M9[t] + 20.0397179322179M10[t] -0.826305770055772M11[t] + 1.72316655941656t + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)448.8925096525111.84819337.88700
x-7.8463063063063111.26193-0.69670.4880550.244028
M110.415269734019714.5174380.71740.4752510.237625
M23.8171031746031714.5163350.2630.7932810.39664
M3-7.5310633848133814.518154-0.51870.6054150.302707
M4-17.004229944229914.522893-1.17090.2452210.12261
M5-26.227396503646514.530549-1.8050.0749360.037468
M6-27.575563063063114.541118-1.89640.0616120.030806
M723.701270377520414.5545931.62840.1074650.053732
M839.103103818103814.5709672.68360.008890.004445
M933.477170205920215.0250972.22810.0287560.014378
M1020.039717932217915.0366541.33270.1865020.093251
M11-0.82630577005577215.05102-0.05490.9563580.478179
t1.723166559416560.2059368.367500


Multiple Linear Regression - Regression Statistics
Multiple R0.880000929800104
R-squared0.774401636449048
Adjusted R-squared0.736801909190556
F-TEST (value)20.5959376014928
F-TEST (DF numerator)13
F-TEST (DF denominator)78
p-value0
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation28.0288528529369
Sum Squared Residuals61278.0941956242


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
1527461.03094594594665.9690540540539
2516456.15594594594659.844054054054
3503446.53094594594656.469054054054
4489438.78094594594650.2190540540541
5479431.28094594594647.7190540540541
6475431.65594594594643.344054054054
7524484.65594594594639.3440540540541
8552501.78094594594650.219054054054
9532497.87817889317934.1218211068211
10511486.16389317889324.8361068211068
11492467.02103603603624.978963963964
12492469.57050836550822.4294916344916
13493481.70894465894511.2910553410554
14481476.8339446589454.16605534105536
15462467.208944658945-5.20894465894465
16457459.458944658945-2.45894465894465
17442451.958944658945-9.95894465894465
18439452.333944658945-13.3339446589447
19488505.333944658945-17.3339446589447
20521522.458944658945-1.45894465894465
21501518.556177606178-17.5561776061776
22485506.841891891892-21.8418918918919
23464487.699034749035-23.6990347490347
24460490.248507078507-30.2485070785071
25467502.386943371943-35.3869433719434
26460497.511943371943-37.5119433719434
27448487.886943371943-39.8869433719434
28443480.136943371943-37.1369433719434
29436472.636943371943-36.6369433719434
30431473.011943371943-42.0119433719434
31484526.011943371943-42.0119433719434
32510543.136943371943-33.1369433719434
33513539.234176319176-26.2341763191763
34503527.519890604891-24.5198906048906
35471508.377033462033-37.3770334620335
36471503.080199485199-32.0801994851994
37476515.218635778636-39.2186357786358
38475510.343635778636-35.3436357786358
39470500.718635778636-30.7186357786358
40461492.968635778636-31.9686357786358
41455485.468635778636-30.4686357786357
42456485.843635778636-29.8436357786357
43517538.843635778636-21.8436357786358
44525555.968635778636-30.9686357786358
45523552.065868725869-29.0658687258687
46519540.351583011583-21.351583011583
47509521.208725868726-12.2087258687259
48512523.758198198198-11.7581981981982
49519535.896634491634-16.8966344916345
50517531.021634491634-14.0216344916345
51510521.396634491634-11.3966344916345
52509513.646634491634-4.64663449163449
53501506.146634491634-5.14663449163449
54507506.5216344916340.478365508365511
55569559.5216344916349.4783655083655
56580576.6466344916343.35336550836551
57578572.7438674388675.25613256113256
58565561.0295817245823.97041827541827
59547541.8867245817255.11327541827542
60555544.43619691119710.5638030888031
61562556.5746332046335.42536679536681
62561551.6996332046339.3003667953668
63555542.07463320463312.9253667953668
64544534.3246332046339.6753667953668
65537526.82463320463310.1753667953668
66543527.19963320463315.8003667953668
67594580.19963320463313.8003667953668
68611597.32463320463313.6753667953668
69613593.42186615186619.5781338481338
70611581.7075804375829.2924195624195
71594562.56472329472331.4352767052767
72595565.11419562419629.8858043758044
73591577.25263191763213.7473680823681
74589572.37763191763216.6223680823681
75584562.75263191763221.2473680823681
76573555.00263191763217.9973680823681
77567547.50263191763219.4973680823681
78569547.87763191763221.1223680823681
79621600.87763191763220.1223680823681
80629618.00263191763210.9973680823681
81628614.09986486486513.9001351351352
82612602.3855791505799.61442084942083
83595583.24272200772211.7572779922780
84597585.79219433719411.2078056628057
85593597.930630630631-4.93063063063063
86590593.055630630631-3.05563063063066
87580583.430630630631-3.43063063063064
88574575.680630630631-1.68063063063065
89573568.1806306306314.81936936936935
90573568.5556306306314.44436936936936
91620621.55563063063-1.55563063063065
92626638.68063063063-12.6806306306306
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195738658pr04x52dhbikwj5/1r1oa1195738607.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195738658pr04x52dhbikwj5/1r1oa1195738607.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195738658pr04x52dhbikwj5/2jmsp1195738607.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195738658pr04x52dhbikwj5/2jmsp1195738607.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195738658pr04x52dhbikwj5/3lzw01195738607.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195738658pr04x52dhbikwj5/3lzw01195738607.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195738658pr04x52dhbikwj5/4srs51195738607.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195738658pr04x52dhbikwj5/4srs51195738607.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195738658pr04x52dhbikwj5/5b03j1195738607.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195738658pr04x52dhbikwj5/5b03j1195738607.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195738658pr04x52dhbikwj5/6c2ev1195738607.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195738658pr04x52dhbikwj5/6c2ev1195738607.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195738658pr04x52dhbikwj5/7zgva1195738607.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195738658pr04x52dhbikwj5/7zgva1195738607.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195738658pr04x52dhbikwj5/84tdq1195738607.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195738658pr04x52dhbikwj5/84tdq1195738607.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195738658pr04x52dhbikwj5/9dzo41195738607.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195738658pr04x52dhbikwj5/9dzo41195738607.ps (open in new window)


 
Parameters:
par1 = 1 ; par2 = Include Monthly Dummies ; par3 = Linear Trend ;
 
R code (references can be found in the software module):
library(lattice)
par1 <- as.numeric(par1)
x <- t(y)
k <- length(x[1,])
n <- length(x[,1])
x1 <- cbind(x[,par1], x[,1:k!=par1])
mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
colnames(x1) <- mycolnames #colnames(x)[par1]
x <- x1
if (par3 == 'First Differences'){
x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
for (i in 1:n-1) {
for (j in 1:k) {
x2[i,j] <- x[i+1,j] - x[i,j]
}
}
x <- x2
}
if (par2 == 'Include Monthly Dummies'){
x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
for (i in 1:11){
x2[seq(i,n,12),i] <- 1
}
x <- cbind(x, x2)
}
if (par2 == 'Include Quarterly Dummies'){
x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
for (i in 1:3){
x2[seq(i,n,4),i] <- 1
}
x <- cbind(x, x2)
}
k <- length(x[1,])
if (par3 == 'Linear Trend'){
x <- cbind(x, c(1:n))
colnames(x)[k+1] <- 't'
}
x
k <- length(x[1,])
df <- as.data.frame(x)
(mylm <- lm(df))
(mysum <- summary(mylm))
bitmap(file='test0.png')
plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
points(x[,1]-mysum$resid)
grid()
dev.off()
bitmap(file='test1.png')
plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
grid()
dev.off()
bitmap(file='test2.png')
hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
grid()
dev.off()
bitmap(file='test3.png')
densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
dev.off()
bitmap(file='test4.png')
qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
grid()
dev.off()
(myerror <- as.ts(mysum$resid))
bitmap(file='test5.png')
dum <- cbind(lag(myerror,k=1),myerror)
dum
dum1 <- dum[2:length(myerror),]
dum1
z <- as.data.frame(dum1)
z
plot(z,main=paste('Residual Lag plot, lowess, and regression line'), ylab='values of Residuals', xlab='lagged values of Residuals')
lines(lowess(z))
abline(lm(z))
grid()
dev.off()
bitmap(file='test6.png')
acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
grid()
dev.off()
bitmap(file='test7.png')
pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
grid()
dev.off()
bitmap(file='test8.png')
opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
plot(mylm, las = 1, sub='Residual Diagnostics')
par(opar)
dev.off()
load(file='createtable')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE)
a<-table.row.end(a)
myeq <- colnames(x)[1]
myeq <- paste(myeq, '[t] = ', sep='')
for (i in 1:k){
if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '')
myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ')
if (rownames(mysum$coefficients)[i] != '(Intercept)') {
myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='')
if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='')
}
}
myeq <- paste(myeq, ' + e[t]')
a<-table.row.start(a)
a<-table.element(a, myeq)
a<-table.row.end(a)
a<-table.end(a)
table.save(a,file='mytable1.tab')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,hyperlink('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')
 





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:

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