Home » date » 2007 » Nov » 15 » attachments

Workshop6-Q3c

R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Thu, 15 Nov 2007 15:36:32 -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/15/t119516586797gkb078qfkp09k.htm/, Retrieved Thu, 15 Nov 2007 23:31:18 +0100
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
36409 0 33163 0 34122 0 35225 0 28249 0 30374 0 26311 0 22069 0 23651 0 28628 0 23187 0 14727 0 43080 0 32519 0 39657 0 33614 0 28671 0 34243 0 27336 0 22916 0 24537 0 26128 0 22602 0 15744 0 41086 0 39690 0 43129 0 37863 0 35953 0 29133 0 24693 0 22205 0 21725 0 27192 0 21790 0 13253 0 37702 0 30364 0 32609 0 30212 0 29965 0 28352 0 25814 0 22414 0 20506 0 28806 0 22228 0 13971 0 36845 0 35338 0 35022 0 34777 0 26887 0 23970 0 22780 0 17351 0 21382 0 24561 0 17409 0 11514 0 31514 0 27071 0 29462 0 26105 0 22397 0 23843 0 21705 0 18089 0 20764 0 25316 0 17704 0 15548 0 28029 0 29383 0 36438 0 32034 0 22679 0 24319 0 18004 0 17537 0 20366 0 22782 0 19169 0 13807 0 29743 0 25591 0 29096 1 26482 1 22405 1 27044 1 17970 1 18730 1 19684 1 19785 1 18479 1 10698 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 time4 seconds
R Server'Gwilym Jenkins' @ 72.249.127.135


Multiple Linear Regression - Estimated Regression Equation
Inschr_pw[t] = + 18507.9041208791 + 271.179120879151Olieprijzen[t] + 20932.2480082418M1[t] + 17111.5684065934M2[t] + 20470.1164148351M3[t] + 17657.6868131868M4[t] + 12859.8822115385M5[t] + 13459.3276098901M6[t] + 8966.64800824176M7[t] + 6144.34340659341M8[t] + 7647.78880494505M9[t] + 11561.1092032967M10[t] + 6572.80460164834M11[t] -90.4453983516484t + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)18507.90412087911104.96669516.749700
Olieprijzen271.1791208791511063.7507110.25490.7994180.399709
M120932.24800824181343.09213515.585100
M217111.56840659341342.63496712.744800
M320470.11641483511341.18115615.262800
M417657.68681318681340.31625513.174300
M512859.88221153851339.5526439.600100
M613459.32760989011338.89049510.052600
M78966.648008241761338.3299596.699900
M86144.343406593411337.8711644.59261.6e-058e-06
M97647.788804945051337.5142155.717900
M1011561.10920329671337.2591938.645400
M116572.804601648341337.1061564.91574e-062e-06
t-90.445398351648411.680122-7.743500


Multiple Linear Regression - Regression Statistics
Multiple R0.940569988956736
R-squared0.884671904126074
Adjusted R-squared0.866388181609476
F-TEST (value)48.3857651702474
F-TEST (DF numerator)13
F-TEST (DF denominator)82
p-value0
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation2674.11028001766
Sum Squared Residuals586370994.755082


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
13640939349.7067307692-2940.70673076920
23316335438.5817307693-2275.58173076929
33412238706.6843406594-4584.68434065937
43522535803.8093406594-578.809340659402
52824930915.5593406593-2666.55934065929
63037431424.5593406593-1050.55934065933
72631126841.4343406593-530.434340659345
82206923928.6843406593-1859.68434065931
92365125341.6843406593-1690.68434065934
102862829164.5593406593-536.559340659342
112318724085.8093406593-898.809340659341
121472717422.5593406593-2695.55934065935
134308038264.36195054954815.63804945054
143251934353.2369505494-1834.23695054943
153965737621.33956043962035.66043956045
163361434718.4645604395-1104.46456043955
172867129830.2145604396-1159.21456043957
183424330339.21456043963903.78543956044
192733625756.08956043961579.91043956044
202291622843.339560439672.660439560437
212453724256.3395604396280.660439560442
222612828079.2145604396-1951.21456043956
232260223000.4645604396-398.464560439559
241574416337.2145604396-593.214560439563
254108637179.01717032973906.98282967033
263969033267.89217032976422.10782967034
274312936535.99478021986593.00521978023
283786333633.11978021984229.88021978023
293595328744.86978021987208.13021978021
302913329253.8697802198-120.869780219783
312469324670.744780219822.2552197802215
322220521757.9947802198447.005219780217
332172523170.9947802198-1445.99478021978
342719226993.8697802198198.130219780220
352179021915.1197802198-125.119780219780
361325315251.8697802198-1998.86978021978
373770236093.67239010991608.32760989011
383036432182.5473901099-1818.54739010988
393260935450.65-2841.65
403021232547.775-2335.77499999999
412996527659.5252305.47499999999
422835228168.525183.474999999997
432581423585.42228.6
442241420672.651741.35000000000
452050622085.65-1579.65
462880625908.5252897.475
472222820829.7751398.225
481397114166.525-195.525000000002
493684535008.32760989011836.67239010989
503533831097.20260989014240.7973901099
513502234365.3052197802656.694780219784
523477731462.43021978023314.56978021979
532688726574.1802197802312.819780219774
542397027083.1802197802-3113.18021978022
552278022500.0552197802279.944780219780
561735119587.3052197802-2236.30521978022
572138221000.3052197802381.694780219780
582456124823.1802197802-262.180219780219
591740919744.4302197802-2335.43021978022
601151413081.1802197802-1567.18021978022
613151433922.9828296703-2408.98282967033
622707130011.8578296703-2940.85782967032
632946233279.9604395604-3817.96043956044
642610530377.0854395604-4272.08543956043
652239725488.8354395604-3091.83543956045
662384325997.8354395604-2154.83543956044
672170521414.7104395604290.28956043956
681808918501.9604395604-412.960439560443
692076419914.9604395604849.03956043956
702531623737.83543956041578.16456043956
711770418659.0854395604-955.085439560439
721554811995.83543956043552.16456043956
732802932837.6380494506-4808.63804945055
742938328926.5130494505456.486950549457
753643832194.61565934074243.38434065934
763203429291.74065934072742.25934065935
772267924403.4906593407-1724.49065934067
782431924912.4906593407-593.490659340663
791800420329.3656593407-2325.36565934066
801753717416.6156593407120.384340659337
812036618829.61565934071536.38434065934
822278222652.4906593407129.509340659339
831916917573.74065934071595.25934065934
841380710910.49065934072896.50934065934
852974331752.2932692308-2009.29326923077
862559127841.1682692308-2250.16826923076
872909631380.45-2284.45000000000
882648228477.575-1995.57499999999
892240523589.325-1184.32500000001
902704424098.3252945.675
911797019515.2-1545.2
921873016602.452127.55000000000
931968418015.451668.55
941978521838.325-2053.325
951847916759.5751719.425
961069810096.325601.674999999999
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/15/t119516586797gkb078qfkp09k/1h2b61195166186.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/15/t119516586797gkb078qfkp09k/1h2b61195166186.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/15/t119516586797gkb078qfkp09k/2kcam1195166187.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/15/t119516586797gkb078qfkp09k/2kcam1195166187.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/15/t119516586797gkb078qfkp09k/3jr6s1195166187.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/15/t119516586797gkb078qfkp09k/3jr6s1195166187.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/15/t119516586797gkb078qfkp09k/4dky21195166187.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/15/t119516586797gkb078qfkp09k/4dky21195166187.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/15/t119516586797gkb078qfkp09k/5y7fw1195166187.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/15/t119516586797gkb078qfkp09k/5y7fw1195166187.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/15/t119516586797gkb078qfkp09k/6rd631195166187.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/15/t119516586797gkb078qfkp09k/6rd631195166187.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/15/t119516586797gkb078qfkp09k/7mpbi1195166187.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/15/t119516586797gkb078qfkp09k/7mpbi1195166187.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/15/t119516586797gkb078qfkp09k/8ims41195166187.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/15/t119516586797gkb078qfkp09k/8ims41195166187.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/15/t119516586797gkb078qfkp09k/9busx1195166187.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/15/t119516586797gkb078qfkp09k/9busx1195166187.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