Home » date » 2008 » Nov » 27 »

Seatbelt law Q3

*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: Thu, 27 Nov 2008 08:57: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/t122780164296oa0qzh5y8ajga.htm/, Retrieved Thu, 27 Nov 2008 16:00:54 +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/t122780164296oa0qzh5y8ajga.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 «
119.5 0 125 0 145 0 105.3 0 116.9 0 120.1 0 88.9 0 78.4 0 114.6 0 113.3 0 117 0 99.6 0 99.4 0 101.9 0 115.2 0 108.5 0 113.8 0 121 0 92.2 0 90.2 0 101.5 0 126.6 0 93.9 0 89.8 0 93.4 0 101.5 0 110.4 0 105.9 0 108.4 0 113.9 0 86.1 0 69.4 0 101.2 0 100.5 0 98 0 106.6 0 90.1 0 96.9 0 125.9 0 112 0 100 0 123.9 0 79.8 0 83.4 0 113.6 0 112.9 0 104 0 109.9 0 99 0 106.3 0 128.9 0 111.1 0 102.9 0 130 0 87 0 87.5 0 117.6 0 103.4 0 110.8 0 112.6 0 102.5 0 112.4 0 135.6 0 105.1 0 127.7 0 137 0 91 0 90.5 0 122.4 1 123.3 1 124.3 1 120 1 118.1 1 119 1 142.7 1 123.6 1 129.6 1 151.6 1 110.4 1 99.2 1 130.5 1 136.2 1 129.7 1 128 1 121.6 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
y[t] = + 104.117760617761 + 18.8378378378379x[t] -3.37722007722016M1[t] + 2.1911196911197M2[t] + 22.2911196911197M3[t] + 3.40540540540541M4[t] + 7.376833976834M5[t] + 21.4054054054054M6[t] -16.0374517374517M7[t] -21.2945945945946M8[t] + 4.98571428571428M9[t] + 7.1M10[t] + 1.60000000000000M11[t] + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)104.1177606177613.17269932.816800
x18.83783783783792.2608058.332400
M1-3.377220077220164.254171-0.79390.4298850.214943
M22.19111969111974.4047540.49740.6203920.310196
M322.29111969111974.4047545.06073e-062e-06
M43.405405405405414.4047540.77310.4419820.220991
M57.3768339768344.4047541.67470.0983230.049162
M621.40540540540544.4047544.85967e-063e-06
M7-16.03745173745174.404754-3.64090.0005080.000254
M8-21.29459459459464.404754-4.83457e-064e-06
M94.985714285714284.3928971.13490.2601610.13008
M107.14.3928971.61620.1104150.055207
M111.600000000000004.3928970.36420.7167580.358379


Multiple Linear Regression - Regression Statistics
Multiple R0.882344007477198
R-squared0.778530947530921
Adjusted R-squared0.741619438786075
F-TEST (value)21.0918213317308
F-TEST (DF numerator)12
F-TEST (DF denominator)72
p-value0
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation8.21835773764464
Sum Squared Residuals4862.98108108106


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
1119.5100.74054054054118.7594594594589
2125106.30888030888018.6911196911197
3145126.40888030888018.5911196911197
4105.3107.523166023166-2.22316602316603
5116.9111.4945945945955.40540540540541
6120.1125.523166023166-5.42316602316601
788.988.08030888030890.819691119691102
878.482.823166023166-4.42316602316602
9114.6109.1034749034755.49652509652507
10113.3111.2177606177612.08223938223938
11117105.71776061776111.2822393822394
1299.6104.117760617761-4.51776061776064
1399.4100.740540540540-1.34054054054046
14101.9106.308880308880-4.4088803088803
15115.2126.408880308880-11.2088803088803
16108.5107.5231660231660.97683397683398
17113.8111.4945945945952.30540540540540
18121125.523166023166-4.52316602316602
1992.288.08030888030894.11969111969113
2090.282.8231660231667.37683397683398
21101.5109.103474903475-7.60347490347489
22126.6111.21776061776115.3822393822394
2393.9105.717760617761-11.8177606177606
2489.8104.117760617761-14.3177606177606
2593.4100.740540540540-7.34054054054047
26101.5106.308880308880-4.8088803088803
27110.4126.408880308880-16.0088803088803
28105.9107.523166023166-1.62316602316601
29108.4111.494594594595-3.09459459459459
30113.9125.523166023166-11.6231660231660
3186.188.0803088803089-1.98030888030888
3269.482.823166023166-13.4231660231660
33101.2109.103474903475-7.90347490347489
34100.5111.217760617761-10.7177606177606
3598105.717760617761-7.71776061776062
36106.6104.1177606177612.48223938223938
3790.1100.740540540540-10.6405405405405
3896.9106.308880308880-9.4088803088803
39125.9126.408880308880-0.508880308880307
40112107.5231660231664.47683397683398
41100111.494594594595-11.4945945945946
42123.9125.523166023166-1.62316602316602
4379.888.0803088803089-8.28030888030888
4483.482.8231660231660.576833976833985
45113.6109.1034749034754.4965250965251
46112.9111.2177606177611.68223938223940
47104105.717760617761-1.71776061776061
48109.9104.1177606177615.78223938223939
4999100.740540540540-1.74054054054047
50106.3106.308880308880-0.00888030888031
51128.9126.4088803088802.49111969111969
52111.1107.5231660231663.57683397683398
53102.9111.494594594595-8.59459459459459
54130125.5231660231664.47683397683398
558788.0803088803089-1.08030888030887
5687.582.8231660231664.67683397683398
57117.6109.1034749034758.4965250965251
58103.4111.217760617761-7.81776061776061
59110.8105.7177606177615.08223938223939
60112.6104.1177606177618.48223938223938
61102.5100.7405405405401.75945945945953
62112.4106.3088803088806.0911196911197
63135.6126.4088803088809.19111969111968
64105.1107.523166023166-2.42316602316603
65127.7111.49459459459516.2054054054054
66137125.52316602316611.4768339768340
679188.08030888030892.91969111969112
6890.582.8231660231667.67683397683398
69122.4127.941312741313-5.54131274131273
70123.3130.055598455598-6.75559845559846
71124.3124.555598455598-0.25559845559846
72120122.955598455598-2.95559845559846
73118.1119.578378378378-1.47837837837832
74119125.146718146718-6.14671814671815
75142.7145.246718146718-2.54671814671817
76123.6126.361003861004-2.76100386100387
77129.6130.332432432432-0.732432432432446
78151.6144.3610038610047.23899613899611
79110.4106.9181467181473.48185328185328
8099.2101.661003861004-2.46100386100387
81130.5127.9413127413132.55868725868726
82136.2130.0555984555986.14440154440153
83129.7124.5555984555985.14440154440153
84128122.9555984555985.04440154440154
85121.6119.5783783783782.02162162162168
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t122780164296oa0qzh5y8ajga/1pwbl1227801470.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t122780164296oa0qzh5y8ajga/1pwbl1227801470.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t122780164296oa0qzh5y8ajga/2fnm41227801470.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t122780164296oa0qzh5y8ajga/2fnm41227801470.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t122780164296oa0qzh5y8ajga/3opnv1227801470.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t122780164296oa0qzh5y8ajga/3opnv1227801470.ps (open in new window)


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


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t122780164296oa0qzh5y8ajga/5shop1227801470.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t122780164296oa0qzh5y8ajga/5shop1227801470.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t122780164296oa0qzh5y8ajga/697rb1227801470.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t122780164296oa0qzh5y8ajga/697rb1227801470.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t122780164296oa0qzh5y8ajga/75nsf1227801470.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t122780164296oa0qzh5y8ajga/75nsf1227801470.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t122780164296oa0qzh5y8ajga/8ckh31227801470.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t122780164296oa0qzh5y8ajga/8ckh31227801470.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t122780164296oa0qzh5y8ajga/9dqj51227801470.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/27/t122780164296oa0qzh5y8ajga/9dqj51227801470.ps (open in new window)


 
Parameters (Session):
par1 = 1 ; par2 = Include Monthly Dummies ; par3 = No Linear Trend ;
 
Parameters (R input):
par1 = 1 ; par2 = Include Monthly Dummies ; par3 = No 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