Home » date » 2008 » Nov » 24 »

seatbelt law Question 3:

*The author of this computation has been verified*
R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Mon, 24 Nov 2008 10:59:58 -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/24/t1227549657bm5u6fl0plmrn50.htm/, Retrieved Mon, 24 Nov 2008 18:01:10 +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/24/t1227549657bm5u6fl0plmrn50.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:

Post a new message
 
Original text written by user:
 
IsPrivate?
No (this computation is public)
 
User-defined keywords:
Question 3: Apply this type of analysis (see Q1 & Q2) to the time series that you selected in previous workshops. Use the following components to explain your endogenous time series: a constant term, a linear trend, seasonal dummies, and a meaningful dummy variable (about an intervention).
 
Dataseries X:
» Textbox « » Textfile « » CSV «
112.1 0 104.2 0 102.4 0 100.3 0 102.6 0 101.5 0 103.4 0 99.4 0 97.9 0 98 0 90.2 0 87.1 0 91.8 0 94.8 0 91.8 0 89.3 0 91.7 0 86.2 0 82.8 0 82.3 0 79.8 0 79.4 0 85.3 0 87.5 0 88.3 0 88.6 0 94.9 0 94.7 0 92.6 0 91.8 0 96.4 0 96.4 0 107.1 0 111.9 0 107.8 0 109.2 0 115.3 0 119.2 0 107.8 0 106.8 0 104.2 0 94.8 0 97.5 0 98.3 0 100.6 0 94.9 1 93.6 1 98 1 104.3 1 103.9 1 105.3 1 102.6 1 103.3 1 107.9 1 107.8 1 109.8 1 110.6 1 110.8 1 119.3 1 128.1 1 127.6 1 137.9 1 151.4 1 143.6 1 143.4 1 141.9 1 135.2 1 133.1 1 129.6 1 134.1 1 136.8 1 143.5 1 162.5 1 163.1 1 157.2 1 158.8 1 155.4 1 148.5 1 154.2 1 153.3 1 149.4 1 147.9 1 156 1 163 1 159.1 1 159.5 1 157.3 1 156.4 1 156.6 1 162.4 1 166.8 1 162.6 1 168.1 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 time3 seconds
R Server'Gwilym Jenkins' @ 72.249.127.135


Multiple Linear Regression - Estimated Regression Equation
genotsmiddelen[t] = + 73.6306878306878 -3.15231481481482uitvoersubsidie[t] + 7.93784722222222M1[t] + 8.27953042328043M2[t] + 6.95871362433864M3[t] + 4.07539682539685M4[t] + 2.80458002645505M5[t] + 0.0212632275132471M6[t] + 0.225446428571446M7[t] -1.82037037037036M8[t] -1.76618716931215M9[t] -3.76193783068781M10[t] -2.98096891534390M11[t] + 0.9333167989418t + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)73.63068783068785.68879312.943100
uitvoersubsidie-3.152314814814825.581109-0.56480.5737970.286899
M17.937847222222226.8467861.15940.2498040.124902
M28.279530423280436.844941.20960.2300460.115023
M36.958713624338646.8446761.01670.3124180.156209
M44.075396825396856.8459950.59530.5533470.276673
M52.804580026455056.8488960.40950.6832860.341643
M60.02126322751324716.8533770.00310.9975320.498766
M70.2254464285714466.8594350.03290.9738640.486932
M8-1.820370370370366.867066-0.26510.7916330.395816
M9-1.766187169312156.876265-0.25690.797960.39898
M10-3.761937830687817.069219-0.53220.596110.298055
M11-2.980968915343907.06692-0.42180.6743020.337151
t0.93331679894180.1040948.966100


Multiple Linear Regression - Regression Statistics
Multiple R0.890002599298968
R-squared0.79210462675892
Adjusted R-squared0.757893995719248
F-TEST (value)23.1537566740694
F-TEST (DF numerator)13
F-TEST (DF denominator)79
p-value0
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation13.2195614704814
Sum Squared Residuals13805.7876322751


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
1112.182.50185185185229.598148148148
2104.283.776851851851820.4231481481482
3102.483.389351851851919.0106481481481
4100.381.439351851851818.8606481481482
5102.681.101851851851821.4981481481481
6101.579.251851851851822.2481481481482
7103.480.389351851851823.0106481481482
899.479.276851851851820.1231481481482
997.980.264351851851917.6356481481482
109879.20191798941818.7980820105820
1190.280.91620370370379.2837962962963
1287.184.83048941798942.26951058201060
1391.893.7016534391534-1.90165343915343
1494.894.9766534391534-0.176653439153407
1591.894.5891534391534-2.78915343915344
1689.392.6391534391534-3.33915343915345
1791.792.3016534391534-0.601653439153434
1886.290.4516534391534-4.25165343915343
1982.891.5891534391534-8.78915343915343
2082.390.4766534391534-8.17665343915343
2179.891.4641534391534-11.6641534391534
2279.490.4017195767196-11.0017195767196
2385.392.1160052910053-6.8160052910053
2487.596.030291005291-8.53029100529098
2588.3104.901455026455-16.601455026455
2688.6106.176455026455-17.5764550264550
2794.9105.788955026455-10.8889550264550
2894.7103.838955026455-9.13895502645503
2992.6103.501455026455-10.9014550264550
3091.8101.651455026455-9.85145502645503
3196.4102.788955026455-6.38895502645502
3296.4101.676455026455-5.27645502645502
33107.1102.6639550264554.43604497354497
34111.9101.60152116402110.2984788359788
35107.8103.3158068783074.48419312169312
36109.2107.2300925925931.96990740740743
37115.3116.101256613757-0.801256613756592
38119.2117.3762566137571.82374338624339
39107.8116.988756613757-9.18875661375662
40106.8115.038756613757-8.23875661375663
41104.2114.701256613757-10.5012566137566
4294.8112.851256613757-18.0512566137566
4397.5113.988756613757-16.4887566137566
4498.3112.876256613757-14.5762566137566
45100.6113.863756613757-13.2637566137566
4694.9109.649007936508-14.7490079365079
4793.6111.363293650794-17.7632936507936
4898115.277579365079-17.2775793650793
49104.3124.148743386243-19.8487433862434
50103.9125.423743386243-21.5237433862434
51105.3125.036243386243-19.7362433862434
52102.6123.086243386243-20.4862433862434
53103.3122.748743386243-19.4487433862434
54107.9120.898743386243-12.9987433862434
55107.8122.036243386243-14.2362433862434
56109.8120.923743386243-11.1237433862434
57110.6121.911243386243-11.3112433862434
58110.8120.848809523810-10.0488095238095
59119.3122.563095238095-3.26309523809524
60128.1126.4773809523811.62261904761906
61127.6135.348544973545-7.74854497354495
62137.9136.6235449735451.27645502645504
63151.4136.23604497354515.1639550264550
64143.6134.2860449735459.31395502645501
65143.4133.9485449735459.45145502645503
66141.9132.0985449735459.80145502645503
67135.2133.2360449735451.96395502645501
68133.1132.1235449735450.976455026455022
69129.6133.111044973545-3.51104497354498
70134.1132.0486111111112.05138888888887
71136.8133.7628968253973.03710317460318
72143.5137.6771825396835.82281746031748
73162.5146.54834656084715.9516534391535
74163.1147.82334656084715.2766534391534
75157.2147.4358465608479.76415343915342
76158.8145.48584656084713.3141534391534
77155.4145.14834656084710.2516534391534
78148.5143.2983465608475.20165343915343
79154.2144.4358465608479.76415343915342
80153.3143.3233465608479.97665343915345
81149.4144.3108465608475.08915343915345
82147.9143.2484126984134.65158730158729
83156144.96269841269811.0373015873016
84163148.87698412698414.1230158730159
85159.1157.7481481481481.35185185185187
86159.5159.0231481481480.476851851851852
87157.3158.635648148148-1.33564814814815
88156.4156.685648148148-0.285648148148153
89156.6156.3481481481480.251851851851833
90162.4154.4981481481487.90185185185185
91166.8155.63564814814811.1643518518519
92162.6154.5231481481488.07685185185185
93168.1155.51064814814812.5893518518518
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227549657bm5u6fl0plmrn50/18nlp1227549594.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227549657bm5u6fl0plmrn50/18nlp1227549594.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227549657bm5u6fl0plmrn50/2jcbj1227549594.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227549657bm5u6fl0plmrn50/2jcbj1227549594.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227549657bm5u6fl0plmrn50/37kef1227549594.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227549657bm5u6fl0plmrn50/37kef1227549594.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227549657bm5u6fl0plmrn50/43jxk1227549594.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227549657bm5u6fl0plmrn50/43jxk1227549594.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227549657bm5u6fl0plmrn50/5wi471227549594.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227549657bm5u6fl0plmrn50/5wi471227549594.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227549657bm5u6fl0plmrn50/6vvsa1227549594.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227549657bm5u6fl0plmrn50/6vvsa1227549594.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227549657bm5u6fl0plmrn50/7qq0k1227549594.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227549657bm5u6fl0plmrn50/7qq0k1227549594.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227549657bm5u6fl0plmrn50/82h6v1227549594.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227549657bm5u6fl0plmrn50/82h6v1227549594.ps (open in new window)


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