Home » date » 2007 » Nov » 18 » attachments

Paper bouwen model

R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Sun, 18 Nov 2007 09:05:02 -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/18/t1195401575rkcxgfio9ctlhge.htm/, Retrieved Sun, 18 Nov 2007 16:59:35 +0100
 
User-defined keywords:
paper, wim, dhondt, model
 
Dataseries X:
» Textbox « » Textfile « » CSV «
0 115.4 0 106.9 0 107.1 0 99.3 0 99.2 0 108.3 0 105.6 0 99.5 0 107.4 0 93.1 0 88.1 0 110.7 0 113.1 0 99.6 0 93.6 0 98.6 0 99.6 0 114.3 1 107.8 1 101.2 1 112.5 1 100.5 1 93.9 1 116.2 1 112 1 106.4 1 95.7 1 96 1 95.8 1 103 1 102.2 1 98.4 1 111.4 1 86.6 1 91.3 1 107.9 1 101.8 1 104.4 1 93.4 1 100.1 1 98.5 1 112.9 1 101.4 1 107.1 1 110.8 1 90.3 1 95.5 1 111.4 1 113 1 107.5 1 95.9 1 106.3 1 105.2 1 117.2 1 106.9 1 108.2 1 110 1 96.1 1 100.6
 
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
B [t] = + 110.608581349206 -1.81894841269841A[t] -0.378570601851804M1[t] -6.55542493386244M2[t] -14.4522792658730M3[t] -11.6091335978836M4[t] -12.0859879298942M5[t] -0.682842261904766M6[t] -6.75590691137567M7[t] -8.73276124338625M8[t] -1.26961557539683M9[t] -18.4464699074074M10[t] -17.963324239418M11[t] + 0.0768543320105817t + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)110.6085813492062.39371746.207900
A-1.818948412698412.063509-0.88150.3827410.19137
M1-0.3785706018518042.904091-0.13040.8968640.448432
M2-6.555424933862442.904031-2.25740.0288860.014443
M3-14.45227926587302.905029-4.97491e-055e-06
M4-11.60913359788362.907084-3.99340.0002380.000119
M5-12.08598792989422.910194-4.1530.0001447.2e-05
M6-0.6828422619047662.914355-0.23430.8158120.407906
M7-6.755906911375672.898667-2.33070.024310.012155
M8-8.732761243386252.898687-3.01270.004240.00212
M9-1.269615575396832.899767-0.43780.6636010.331801
M10-18.44646990740742.901905-6.356700
M11-17.9633242394182.9051-6.183400
t0.07685433201058170.0554321.38650.1724370.086218


Multiple Linear Regression - Regression Statistics
Multiple R0.862898988561897
R-squared0.744594664461145
Adjusted R-squared0.670810900861031
F-TEST (value)10.0915787990516
F-TEST (DF numerator)13
F-TEST (DF denominator)45
p-value1.94781590856508e-09
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation4.31989105790929
Sum Squared Residuals839.76564384921


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
1115.4110.3068650793655.09313492063515
2106.9104.2068650793652.69313492063491
3107.196.38686507936510.7131349206349
499.399.306865079365-0.00686507936508507
599.298.9068650793650.293134920634920
6108.3110.386865079365-2.08686507936509
7105.6104.3906547619051.20934523809522
899.5102.490654761905-2.99065476190477
9107.4110.030654761905-2.63065476190477
1093.192.93065476190480.169345238095228
1188.193.4906547619048-5.39065476190477
12110.7111.530833333333-0.830833333333343
13113.1111.2291170634921.87088293650787
1499.6105.129117063492-5.52911706349207
1593.697.309117063492-3.70911706349208
1698.6100.229117063492-1.62911706349207
1799.699.829117063492-0.229117063492073
18114.3111.3091170634922.99088293650793
19107.8103.4939583333334.30604166666666
20101.2101.593958333333-0.393958333333335
21112.5109.1339583333333.36604166666666
22100.592.03395833333338.46604166666667
2393.992.59395833333331.30604166666667
24116.2110.6341369047625.56586309523809
25112110.3324206349211.66757936507931
26106.4104.2324206349212.16757936507937
2795.796.4124206349206-0.712420634920633
289699.3324206349206-3.33242063492063
2995.898.9324206349206-3.13242063492064
30103110.412420634921-7.41242063492064
31102.2104.416210317460-2.21621031746032
3298.4102.516210317460-4.11621031746031
33111.4110.0562103174601.34378968253969
3486.692.9562103174603-6.35621031746032
3591.393.5162103174603-2.21621031746032
36107.9111.556388888889-3.65638888888888
37101.8111.254672619048-9.45467261904767
38104.4105.154672619048-0.75467261904761
3993.497.3346726190476-3.93467261904761
40100.1100.254672619048-0.154672619047616
4198.599.8546726190476-1.35467261904762
42112.9111.3346726190481.56532738095239
43101.4105.338462301587-3.93846230158729
44107.1103.4384623015873.6615376984127
45110.8110.978462301587-0.178462301587302
4690.393.8784623015873-3.57846230158730
4795.594.43846230158731.06153769841270
48111.4112.478640873016-1.07864087301586
49113112.1769246031750.823075396825353
50107.5106.0769246031751.42307539682540
5195.998.2569246031746-2.35692460317459
52106.3101.1769246031755.12307539682541
53105.2100.7769246031754.42307539682541
54117.2112.2569246031754.94307539682541
55106.9106.2607142857140.639285714285728
56108.2104.3607142857143.83928571428572
57110111.900714285714-1.90071428571428
5896.194.80071428571431.29928571428572
59100.695.36071428571435.23928571428572
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195401575rkcxgfio9ctlhge/1yl3w1195401892.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195401575rkcxgfio9ctlhge/1yl3w1195401892.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195401575rkcxgfio9ctlhge/20xxq1195401892.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195401575rkcxgfio9ctlhge/20xxq1195401892.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195401575rkcxgfio9ctlhge/38eqa1195401892.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195401575rkcxgfio9ctlhge/38eqa1195401892.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195401575rkcxgfio9ctlhge/4rgxe1195401892.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195401575rkcxgfio9ctlhge/4rgxe1195401892.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195401575rkcxgfio9ctlhge/5dg3e1195401892.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195401575rkcxgfio9ctlhge/5dg3e1195401892.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195401575rkcxgfio9ctlhge/6s7jn1195401892.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195401575rkcxgfio9ctlhge/6s7jn1195401892.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195401575rkcxgfio9ctlhge/7zxgg1195401892.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195401575rkcxgfio9ctlhge/7zxgg1195401892.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195401575rkcxgfio9ctlhge/86f2r1195401892.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195401575rkcxgfio9ctlhge/86f2r1195401892.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195401575rkcxgfio9ctlhge/9jd831195401893.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195401575rkcxgfio9ctlhge/9jd831195401893.ps (open in new window)


 
Parameters:
par1 = 2 ; 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