Home » date » 2008 » Nov » 27 »

workshop 3 eigen tijdreeksen q2, deel 2

*Unverified author*
R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Thu, 27 Nov 2008 06:40:54 -0700
 
Cite this page as follows:
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL http://www.freestatistics.org/blog/date/2008/Nov/27/t1227793517pl3veu4aop2x0n6.htm/, Retrieved Thu, 27 Nov 2008 13:45:26 +0000
 
BibTeX entries for LaTeX users:
@Manual{KEY,
    author = {{YOUR NAME}},
    publisher = {Office for Research Development and Education},
    title = {Statistical Computations at FreeStatistics.org, URL http://www.freestatistics.org/blog/date/2008/Nov/27/t1227793517pl3veu4aop2x0n6.htm/},
    year = {2008},
}
@Manual{R,
    title = {R: A Language and Environment for Statistical Computing},
    author = {{R Development Core Team}},
    organization = {R Foundation for Statistical Computing},
    address = {Vienna, Austria},
    year = {2008},
    note = {{ISBN} 3-900051-07-0},
    url = {http://www.R-project.org},
}
 
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
 
Feedback Forum:
2008-11-27 13:41:43 [a2386b643d711541400692649981f2dc] [reply
test

Post a new message
 
Original text written by user:
 
IsPrivate?
No (this computation is public)
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
92.7 0 105.2 0 91.5 0 75.3 0 60.5 0 80.4 0 84.5 0 93.9 0 78 0 92.3 0 90 0 72.1 0 76.9 0 76 0 88.7 0 55.4 0 46.6 0 90.9 0 84.9 0 89 0 90.2 0 72.3 0 83 0 71.6 0 75.4 0 85.1 0 81.2 0 68.7 0 68.4 0 93.7 0 96.6 0 101.8 0 93.6 0 88.9 0 114.1 0 82.3 0 96.4 0 104 0 88.2 0 85.2 0 87.1 0 85.5 0 89.1 0 105.2 0 82.9 0 86.8 0 112 0 97.4 0 88.9 0 109.4 0 87.8 0 90.5 0 79.3 0 114.9 0 118.8 0 125 0 96.1 0 116.7 0 119.5 0 104.1 0 121 0 127.3 0 117.7 0 108 0 89.4 0 137.4 1 142 1 137.3 1 122.8 1 126.1 1 147.6 1 115.7 1 139.2 1 151.2 1 123.8 1 109 1 112.1 1 136.4 1 135.5 1 138.7 1 137.5 1 141.5 1 143.6 1 146.5 1 200.7 1
 
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 computational 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
L&S[t] = + 65.0887417218543 + 20.0648178807947D[t] + 16.4741776056448M1[t] + 18.4244136313465M2[t] + 6.51861252365184M3[t] -6.45861715547149M4[t] -13.9929896917376M5[t] + 10.5348066461684M6[t] + 11.7004341099022M7[t] + 16.7660615736361M8[t] + 3.36026046594133M9[t] + 6.14017364396088M10[t] + 17.7343725362661M11[t] + 0.577229679123305t + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)65.08874172185435.21202712.488200
D20.06481788079474.398564.56172.1e-051e-05
M116.47417760564485.9877842.75130.0075270.003764
M218.42441363134656.1990342.97210.0040350.002018
M36.518612523651846.1958771.05210.2963260.148163
M4-6.458617155471496.193644-1.04280.3005870.150294
M5-13.99298969173766.192336-2.25970.0269080.013454
M610.53480664616846.1938661.70080.0933480.046674
M711.70043410990226.1887751.89060.062760.03138
M816.76606157363616.1846062.71090.0084080.004204
M93.360260465941336.1813630.54360.5884120.294206
M106.140173643960886.1790440.99370.3237390.16187
M1117.73437253626616.1776532.87070.0053930.002697
t0.5772296791233050.0757017.625100


Multiple Linear Regression - Regression Statistics
Multiple R0.913091388812815
R-squared0.833735884324115
Adjusted R-squared0.803293158918671
F-TEST (value)27.3870316543679
F-TEST (DF numerator)13
F-TEST (DF denominator)71
p-value0
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation11.5564627533259
Sum Squared Residuals9482.18002719962


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
192.782.140149006622610.5598509933774
2105.284.667614711447520.5323852885525
391.573.33904328287618.1609567171240
475.360.939043282876114.3609567171239
560.553.98190042573326.5180995742668
680.479.08692644276251.31307355723751
784.580.82978358561973.67021641438035
893.986.47264072847687.42735927152319
97873.64406929990544.35593070009461
1092.377.001212157048315.2987878429517
119089.17264072847680.8273592715232
1272.172.0154978713340.0845021286660279
1376.989.0669051561022-12.1669051561022
147691.5943708609271-15.5943708609271
1588.780.26579943235578.43420056764426
1655.467.8657994323557-12.4657994323557
1746.660.9086565752129-14.3086565752129
1890.986.01368259224224.8863174077578
1984.987.7565397350993-2.85653973509934
208993.3993968779565-4.39939687795648
2190.280.5708254493859.62917455061495
2272.383.9279683065279-11.6279683065279
238396.0993968779565-13.0993968779565
2471.678.9422540208136-7.34225402081364
2575.495.9936613055818-20.5936613055818
2685.198.5211270104068-13.4211270104068
2781.287.1925555818354-5.9925555818354
2868.774.7925555818354-6.09255558183539
2968.467.83541272469250.564587275307474
3093.792.94043874172190.759561258278139
3196.694.6832958845791.91670411542100
32101.8100.3261530274361.47384697256386
3393.687.49758159886476.10241840113529
3488.990.8547244560076-1.95472445600756
35114.1103.02615302743611.0738469725638
3682.385.8690101702933-3.56901017029329
3796.4102.920417455061-6.52041745506146
38104105.447883159886-1.44788315988646
3988.294.119311731315-5.91931173131506
4085.281.7193117313153.48068826868495
4187.174.762168874172212.3378311258278
4285.599.8671948912015-14.3671948912015
4389.1101.610052034059-12.5100520340587
44105.2107.252909176916-2.0529091769158
4582.994.4243377483444-11.5243377483444
4686.897.7814806054872-10.9814806054872
47112109.9529091769162.0470908230842
4897.492.7957663197734.60423368022707
4988.9109.847173604541-20.9471736045411
50109.4112.374639309366-2.97463930936611
5187.8101.046067880795-13.2460678807947
5290.588.64606788079471.85393211920530
5379.381.6889250236518-2.38892502365185
54114.9106.7939510406818.10604895931882
55118.8108.53680818353810.2631918164617
56125114.17966532639510.8203346736045
5796.1101.351093897824-5.25109389782403
58116.7104.70823675496711.9917632450331
59119.5116.8796653263952.62033467360453
60104.199.72252246925264.37747753074739
61121116.7739297540214.22607024597922
62127.3119.3013954588467.99860454115422
63117.7107.9728240302749.72717596972563
6410895.572824030274412.4271759697256
6589.488.61568117313150.784318826868499
66137.4133.7855250709563.61447492904446
67142135.5283822138136.47161778618732
68137.3141.171239356670-3.87123935666981
69122.8128.342667928098-5.5426679280984
70126.1131.699810785241-5.59981078524125
71147.6143.8712393566703.72876064333017
72115.7126.714096499527-11.0140964995270
73139.2143.765503784295-4.56550378429516
74151.2146.292969489124.90703051087985
75123.8134.964398060549-11.1643980605487
76109122.564398060549-13.5643980605487
77112.1115.607255203406-3.50725520340587
78136.4140.712281220435-4.31228122043519
79135.5142.455138363292-6.95513836329234
80138.7148.097995506149-9.3979955061495
81137.5135.2694240775782.23057592242195
82141.5138.6265669347212.87343306527910
83143.6150.797995506149-7.19799550614948
84146.5133.64085264900712.8591473509934
85200.7150.69225993377550.0077400662252
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t1227793517pl3veu4aop2x0n6/1ofdn1227793249.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t1227793517pl3veu4aop2x0n6/1ofdn1227793249.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t1227793517pl3veu4aop2x0n6/20zqy1227793249.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t1227793517pl3veu4aop2x0n6/20zqy1227793249.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t1227793517pl3veu4aop2x0n6/30vh61227793249.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t1227793517pl3veu4aop2x0n6/30vh61227793249.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t1227793517pl3veu4aop2x0n6/4rszj1227793249.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t1227793517pl3veu4aop2x0n6/4rszj1227793249.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t1227793517pl3veu4aop2x0n6/51jbk1227793249.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t1227793517pl3veu4aop2x0n6/51jbk1227793249.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t1227793517pl3veu4aop2x0n6/6dz4z1227793249.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t1227793517pl3veu4aop2x0n6/6dz4z1227793249.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t1227793517pl3veu4aop2x0n6/79dfr1227793249.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t1227793517pl3veu4aop2x0n6/79dfr1227793249.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t1227793517pl3veu4aop2x0n6/824ns1227793249.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t1227793517pl3veu4aop2x0n6/824ns1227793249.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t1227793517pl3veu4aop2x0n6/9wtqv1227793249.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t1227793517pl3veu4aop2x0n6/9wtqv1227793249.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:

  • personalize online software applications according to your needs
  • enforce strict security rules with respect to the data that you upload (e.g. statistical data)
  • manage user sessions of online applications
  • alert you about important changes or upgrades in resources or applications

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