Home » date » 2007 » Nov » 19 » attachments

ws 6 vraag 3

R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Mon, 19 Nov 2007 03:15:52 -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/19/t1195467182ipwg5hhfzejfbki.htm/, Retrieved Mon, 19 Nov 2007 11:13:28 +0100
 
User-defined keywords:
ws 6 vraag 3 groep 1
 
Dataseries X:
» Textbox « » Textfile « » CSV «
97,3 0 101 0 113,2 0 101 0 105,7 0 113,9 0 86,4 0 96,5 0 103,3 0 114,9 0 105,8 0 94,2 0 98,4 0 99,4 0 108,8 0 112,6 0 104,4 0 112,2 0 81,1 0 97,1 0 112,6 0 113,8 0 107,8 0 103,2 0 103,3 0 101,2 0 107,7 0 110,4 0 101,9 0 115,9 0 89,9 0 88,6 0 117,2 0 123,9 0 100 1 103,6 1 94,1 1 98,7 1 119,5 1 112,7 1 104,4 1 124,7 1 89,1 1 97 1 121,6 1 118,8 1 114 1 111,5 1 97,2 1 102,5 1 113,4 1 109,8 1 104,9 1 126,1 1 80 1 96,8 1 117,2 1 112,3 1 117,3 1 111,1 1 102,2 1 104,3 1 122,9 1 107,6 1 121,3 1 131,5 1 89 1 104,4 1 128,9 1 135,9 1 133,3 1 121,3 1 120,5 1 120,4 1 137,9 1 126,1 1 133,2 1 146,6 1 103,4 1 117,2 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
y[t] = + 94.4683808553971 -8.64511201629328x[t] -4.21401537193293M1[t] -2.58969062166619M2[t] + 10.6632055571719M3[t] + 4.04467316458152M4[t] + 2.96899791484821M5[t] + 16.1076083794006M6[t] -20.3394954417612M7[t] -9.54374212006597M8[t] + 9.21712612743672M9[t] + 11.9033556396082M10[t] + 5.99710382116186M11[t] + 0.447103821161866t + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)94.46838085539712.73592334.528900
x-8.645112016293282.66331-3.2460.001840.00092
M1-4.214015371932933.319798-1.26940.2087710.104385
M2-2.589690621666193.319146-0.78020.4380460.219023
M310.66320555717193.3194713.21230.0020370.001018
M44.044673164581523.3207751.2180.2275640.113782
M52.968997914848213.3230550.89350.374860.18743
M616.10760837940063.3263114.84258e-064e-06
M7-20.33949544176123.330538-6.10700
M8-9.543742120065973.335733-2.86110.005650.002825
M99.217126127436723.4556812.66720.0096110.004805
M1011.90335563960823.4596333.44060.0010110.000505
M115.997103821161863.4422971.74220.0861350.043068
t0.4471038211618660.0569847.846100


Multiple Linear Regression - Regression Statistics
Multiple R0.910883692866785
R-squared0.829709101930632
Adjusted R-squared0.796166955341211
F-TEST (value)24.7363149439076
F-TEST (DF numerator)13
F-TEST (DF denominator)66
p-value0
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation5.96141569664024
Sum Squared Residuals2345.53948913781


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
197.390.70146930462646.59853069537361
210192.77289787605478.22710212394531
3113.2106.4728978760556.72710212394528
4101100.3014693046260.698530695373892
5105.799.67289787605476.02710212394534
6113.9113.2586121617690.641387838231008
786.477.2586121617699.14138783823105
896.588.50146930462627.99853069537385
9103.3107.709441373291-4.40944137329064
10114.9110.8427747066244.05722529337604
11105.8105.3836267093400.416373290660460
1294.299.8336267093395-5.63362670933954
1398.496.06671515856852.33328484143154
1499.498.1381437299971.26185627000294
15108.8111.838143729997-3.03814372999709
16112.6105.6667151585696.93328484143148
17104.4105.038143729997-0.638143729997084
18112.2118.623858015711-6.42385801571137
1981.182.6238580157114-1.52385801571138
2097.193.86671515856853.23328484143149
21112.6113.074687227233-0.474687227233058
22113.8116.208020560566-2.40802056056639
23107.8110.748872563282-2.94887256328193
24103.2105.198872563282-1.99887256328194
25103.3101.4319610125111.86803898748913
26101.2103.503389583939-2.30338958393948
27107.7117.203389583939-9.50338958393948
28110.4111.031961012511-0.631961012510907
29101.9110.403389583939-8.50338958393948
30115.9123.989103869654-8.08910386965376
3189.987.98910386965381.91089613034623
3288.699.231961012511-10.6319610125109
33117.2118.439933081175-1.23993308117545
34123.9121.5732664145092.32673358549123
35100107.469006400931-7.46900640093104
36103.6101.9190064009311.68099359906895
3794.198.15209485016-4.05209485015998
3898.7100.223523421589-1.52352342158859
39119.5113.9235234215895.57647657841141
40112.7107.752094850164.94790514983999
41104.4107.123523421589-2.72352342158859
42124.7120.7092377073033.99076229269713
4389.184.70923770730294.39076229269711
449795.952094850161.04790514983999
45121.6115.1600669188256.43993308117544
46118.8118.2934002521580.506599747842102
47114112.8342522548731.16574774512657
48111.5107.2842522548734.21574774512656
4997.2103.517340704102-6.31734070410237
50102.5105.588769275531-3.08876927553099
51113.4119.288769275531-5.88876927553098
52109.8113.117340704102-3.31734070410242
53104.9112.488769275531-7.58876927553099
54126.1126.0744835612450.0255164387547245
558090.0744835612453-10.0744835612453
5696.8101.317340704102-4.51734070410241
57117.2120.525312772767-3.32531277276695
58112.3123.658646106100-11.3586461061003
59117.3118.199498108816-0.899498108815835
60111.1112.649498108816-1.54949810881584
61102.2108.882586558045-6.68258655804476
62104.3110.954015129473-6.65401512947339
63122.9124.654015129473-1.75401512947337
64107.6118.482586558045-10.8825865580448
65121.3117.8540151294733.44598487052661
66131.5131.4397294151880.0602705848123345
678995.4397294151877-6.43972941518768
68104.4106.682586558045-2.2825865580448
69128.9125.8905586267093.00944137329066
70135.9129.0238919600436.87610803995732
71133.3123.5647439627589.73525603724178
72121.3118.0147439627583.28525603724176
73120.5114.2478324119876.25216758801284
74120.4116.3192609834164.08073901658422
75137.9130.0192609834167.88073901658422
76126.1123.8478324119872.25216758801279
77133.2123.2192609834169.98073901658421
78146.6136.804975269139.79502473086993
79103.4100.804975269132.59502473086993
80117.2112.0478324119875.1521675880128
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195467182ipwg5hhfzejfbki/11uvh1195467347.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195467182ipwg5hhfzejfbki/11uvh1195467347.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195467182ipwg5hhfzejfbki/22uqi1195467347.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195467182ipwg5hhfzejfbki/22uqi1195467347.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195467182ipwg5hhfzejfbki/3zz451195467347.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195467182ipwg5hhfzejfbki/3zz451195467347.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195467182ipwg5hhfzejfbki/4yim11195467347.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195467182ipwg5hhfzejfbki/4yim11195467347.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195467182ipwg5hhfzejfbki/58b151195467347.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195467182ipwg5hhfzejfbki/58b151195467347.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195467182ipwg5hhfzejfbki/6md1b1195467347.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195467182ipwg5hhfzejfbki/6md1b1195467347.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195467182ipwg5hhfzejfbki/742iv1195467347.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195467182ipwg5hhfzejfbki/742iv1195467347.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195467182ipwg5hhfzejfbki/8mq551195467347.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195467182ipwg5hhfzejfbki/8mq551195467347.ps (open in new window)


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