Home » date » 2007 » Dec » 14 » attachments

seatbelt paper

R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Fri, 14 Dec 2007 06:01:09 -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/Dec/14/t1197636356q2sugv4dxxtpq30.htm/, Retrieved Fri, 14 Dec 2007 13:45:57 +0100
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
112.61 0 113.4 0 115.18 0 121.01 0 119.44 0 116.68 0 117.07 0 117.41 0 119.58 0 120.92 0 117.09 0 116.77 0 119.39 0 122.49 0 124.08 1 118.29 1 112.94 1 113.79 1 114.43 1 118.7 1 120.36 1 118.27 1 118.34 1 117.82 1 117.65 1 118.18 1 121.02 1 124.78 1 131.16 1 130.14 1 131.75 1 134.73 1 135.35 1 140.32 1 136.35 1 131.6 1 128.9 1 133.89 1 138.25 1 146.23 1 144.76 1 149.3 1 156.8 1 159.08 1 165.12 1 163.14 1 153.43 1 151.01 1 154.72 1 154.58 1 155.63 1 161.67 1 163.51 1 162.91 1 164.80 1 164.98 1 154.54 1 148.60 1 149.19 1 150.61 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
indexcijfers[t] = + 102.582580419580 -14.8322027972028Irak[t] + 3.21714277389274M1[t] + 3.88099883449884M2[t] + 7.98129545454546M3[t] + 10.3551515151515M4[t] + 9.13100757575758M5[t] + 8.14286363636364M6[t] + 9.3587196969697M7[t] + 10.1785757575758M8[t] + 8.99843181818182M9[t] + 7.06828787878788M10[t] + 2.50814393939394M11[t] + 1.19014393939394t + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)102.5825804195803.31138530.978800
Irak-14.83220279720282.867743-5.17215e-062e-06
M13.217142773892743.9943520.80540.424720.21236
M23.880998834498843.9887720.9730.3356520.167826
M37.981295454545464.0101441.99030.0525220.026261
M410.35515151515153.9996392.5890.0128430.006422
M59.131007575757583.9903462.28830.0267650.013383
M68.142863636363643.9822762.04480.0466230.023312
M79.35871969696973.9754342.35410.0228920.011446
M810.17857575757583.9698272.5640.013680.00684
M98.998431818181823.9654612.26920.0279910.013995
M107.068287878787883.9623391.78390.0810430.040521
M112.508143939393943.9604650.63330.5296770.264839
t1.190143939393940.07035316.916700


Multiple Linear Regression - Regression Statistics
Multiple R0.949764132186859
R-squared0.902051906788657
Adjusted R-squared0.874370923924582
F-TEST (value)32.5874233302372
F-TEST (DF numerator)13
F-TEST (DF denominator)46
p-value0
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation6.26105705301434
Sum Squared Residuals1803.23842937063


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
1112.61106.9898671328675.62013286713272
2113.4108.8438671328674.55613286713287
3115.18114.1343076923081.04569230769232
4121.01117.6983076923083.31169230769233
5119.44117.6643076923081.77569230769233
6116.68117.866307692308-1.18630769230769
7117.07120.272307692308-3.2023076923077
8117.41122.282307692308-4.87230769230769
9119.58122.292307692308-2.71230769230769
10120.92121.552307692308-0.632307692307678
11117.09118.182307692308-1.09230769230769
12116.77116.864307692308-0.0943076923076862
13119.39121.271594405594-1.88159440559436
14122.49123.125594405594-0.635594405594401
15124.08113.58383216783210.4961678321678
16118.29117.1478321678321.14216783216783
17112.94117.113832167832-4.17383216783217
18113.79117.315832167832-3.52583216783216
19114.43119.721832167832-5.29183216783216
20118.7121.731832167832-3.03183216783216
21120.36121.741832167832-1.38183216783217
22118.27121.001832167832-2.73183216783217
23118.34117.6318321678320.708167832167837
24117.82116.3138321678321.50616783216783
25117.65120.721118881119-3.07111888111884
26118.18122.575118881119-4.39511888111887
27121.02127.865559440559-6.84555944055945
28124.78131.429559440559-6.64955944055944
29131.16131.395559440559-0.235559440559442
30130.14131.597559440559-1.45755944055945
31131.75134.003559440559-2.25355944055945
32134.73136.013559440559-1.28355944055945
33135.35136.023559440559-0.673559440559444
34140.32135.2835594405595.03644055944056
35136.35131.9135594405594.43644055944055
36131.6130.5955594405591.00444055944055
37128.9135.002846153846-6.10284615384612
38133.89136.856846153846-2.96684615384617
39138.25142.147286713287-3.89728671328672
40146.23145.7112867132870.51871328671328
41144.76145.677286713287-0.91728671328672
42149.3145.8792867132873.42071328671330
43156.8148.2852867132878.51471328671329
44159.08150.2952867132878.7847132867133
45165.12150.30528671328714.8147132867133
46163.14149.56528671328713.5747132867133
47153.43146.1952867132877.23471328671329
48151.01144.8772867132876.13271328671328
49154.72149.2845734265735.4354265734266
50154.58151.1385734265733.44142657342658
51155.63156.429013986014-0.799013986013992
52161.67159.9930139860141.67698601398599
53163.51159.9590139860143.550986013986
54162.91160.1610139860142.74898601398601
55164.8162.5670139860142.23298601398602
56164.98164.5770139860140.402986013986004
57154.54164.587013986014-10.047013986014
58148.6163.847013986014-15.247013986014
59149.19160.477013986014-11.287013986014
60150.61159.159013986014-8.54901398601397
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197636356q2sugv4dxxtpq30/1bn721197637260.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197636356q2sugv4dxxtpq30/1bn721197637260.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197636356q2sugv4dxxtpq30/2q6x11197637260.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197636356q2sugv4dxxtpq30/2q6x11197637260.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197636356q2sugv4dxxtpq30/38hlf1197637260.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197636356q2sugv4dxxtpq30/38hlf1197637260.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197636356q2sugv4dxxtpq30/4ng371197637260.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197636356q2sugv4dxxtpq30/4ng371197637260.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197636356q2sugv4dxxtpq30/51jsk1197637260.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197636356q2sugv4dxxtpq30/51jsk1197637260.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197636356q2sugv4dxxtpq30/6f2mp1197637260.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197636356q2sugv4dxxtpq30/6f2mp1197637260.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197636356q2sugv4dxxtpq30/74kyo1197637260.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197636356q2sugv4dxxtpq30/74kyo1197637260.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197636356q2sugv4dxxtpq30/8zhid1197637260.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197636356q2sugv4dxxtpq30/8zhid1197637260.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197636356q2sugv4dxxtpq30/9pln21197637260.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197636356q2sugv4dxxtpq30/9pln21197637260.ps (open in new window)


 
Parameters (Session):
par1 = 1 ; par2 = Include Monthly Dummies ; par3 = Linear Trend ;
 
Parameters (R input):
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