Home » date » 2007 » Dec » 17 » attachments

R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Mon, 17 Dec 2007 13:01:29 -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/Dec/17/t1197920702hpwx5e66cf0s4bm.htm/, Retrieved Mon, 17 Dec 2007 20:45:02 +0100
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
85,6 92,81 88 75,6 89 59,04 88,4 48,7 97,5 72,81 95 111,7 104 91,81 101,8 119,5 99,4 68,07 107,6 103,4 103,2 49,16 118,9 96,3 103 124,61 126,9 96,6 91,2 109,89 106,3 110,4 85,9 110,51 109,2 104,4 80,7 114,77 104,6 110,7 86,7 92,37 100,8 93,6 80,7 103,63 92,1 114,8 81,5 90,43 86,4 74,9 83,4 65,86 96 69,8 83,5 83,33 98,5 104,2 89,5 94,49 112 109,3 85,8 68,98 113,9 92,7 77,4 55,46 120 91,7 67,5 132,89 126,7 84,4 63,7 121,71 112,8 94,5 59,4 127,01 116,2 103,6 62 134,04 110,6 105,9 62,4 106,48 105 108 58,1 117,55 101,2 119,9 58 101,61 99,3 84,5 56,3 82,66 101,9 76,7 61,4 89,28 106,4 120,5 59,8 109,24 118,9 119,6 54,3 88,16 121,9 102,3 47 59,23 132 101,7 50,5 164,21 121,4 86,9 48,1 125,13 117 93,6 58,8 152,68 122,7 113,6 70,4 132,96 113 106,7 71,9 112,42 104 96,1 73,3 136,43 101,2 124,6 83,5 107,32 100,8 72,5 90,1 87,61 98,9 89 101,3 97,86 103 115,3 98,3 106,60 117,8 119,1 106,7 92,17 126,6 104,4 109,9 65,31 127,6 104,9 111,1 161,49 115,8 76,9 119 162,25 114,8 95,3 120,7 175,13 119,2 114,9 104,5 147,28 109,9 98,9 121,6 144,48 98,9 102,9 129,6 122,67 98,6 90 124,5 102,27 96,6 81 130,1 88,64 96,7 66,2 142,3 89,59 103,5 86,7 140 112,20 115,3 86,7 143,3 91,98 122,5 103,4 113,4 57,85 125,3 89,5 113,8 160,49 111,2 113,7 120,7 128,33 110,7 120,2 112,9 140,69 114,2 137,8 115,5 126,61 105,6 99,1 121,9 129,27 95,5 110,4 119,3 124,27 97,3 112,3 111 112,90 95,5 82,2 114,2 92,54 96,3 72,2 113,5 85,70 100,2 106,7 94 116,72 113,4 106,4 83,2 92,08 121,4 110 82,8 58,98 122,1 87,5 85,8 154,50 119,3 79,7 88,7 145,55 110,8 83,3 105,3 146,60 110,1 91,8 113,1 143,51 99,7 89,2 113,8 113,52 104,8 90,6 109,4 104,80 105,4 92,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
olie[t] = + 131.058720667153 + 0.0777048133057692wagens[t] -0.365660000574707electric[t] -0.0686328689875479vervoers[t] + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)131.05872066715332.0371714.09080.0001165.8e-05
wagens0.07770481330576920.0995940.78020.4379710.218985
electric-0.3656600005747070.28047-1.30370.1967180.098359
vervoers-0.06863286898754790.191959-0.35750.7217960.360898


Multiple Linear Regression - Regression Statistics
Multiple R0.189440361235054
R-squared0.0358876504648676
Adjusted R-squared-0.00664671789697646
F-TEST (value)0.843733005732395
F-TEST (DF numerator)3
F-TEST (DF denominator)68
p-value0.474688991216682
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation24.6583433727325
Sum Squared Residuals41346.3050563555


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
185.6100.903779444029-15.3037794440286
28999.9796480742283-10.9796480742283
397.594.31241660344013.18758339655989
410492.766983674238811.2330163257612
599.489.90643259372619.4935674062739
6103.284.792369937431418.4076300625686
710387.709328236057815.2906717639422
891.293.1509758040077-1.95097580400765
985.992.5505360005159-6.65053600051587
1080.794.1312074332206-13.4312074332205
1186.794.9537496770423-8.25374967704227
1280.797.5549310573292-16.8549310573292
1381.5101.351940997572-19.851940997572
1483.496.2824253609686-12.8824253609686
1583.594.364807754812-10.8648077548119
1689.589.9455558317093-0.445555831709287
1785.888.4078576683805-2.60785766838047
1877.485.1953954579683-7.7953954579683
1967.589.2631770919926-21.7631770919926
2063.792.7839193104483-29.0839193104483
2159.491.3279517112282-31.9279517112282
226293.7640569533147-31.7640569533147
2362.493.5260792769522-31.1260792769522
2458.194.9590484214792-36.8590484214792
255896.8447912606363-38.8447912606363
2656.394.9569054251006-38.6569054251006
2761.490.819721624944-29.4197216249440
2859.887.8617292734322-28.0617292734322
2954.386.314080440707-32.014080440707
304780.4140939073591-33.4140939073591
3150.593.4633076753063-42.9633076753063
3248.191.575667351629-43.475667351629
3358.890.2595155751762-31.4595155751762
3470.492.7476454583751-22.3476454583751
3571.995.170037009515-23.270037009515
3673.396.1035408124506-22.8035408124506
3783.597.5635901716008-14.0635901716008
3890.195.5943399641415-5.49433996414148
39101.393.08656384379688.2134361562032
4098.388.093131001430910.2068689985691
41106.784.762945714488221.9370542855118
42109.982.275817994026727.6241820059733
43111.195.985975276208515.1140247237915
4411995.147846145524723.8521538544753
45120.793.194575906218327.5054240937816
46104.595.52926076479828.97073923520178
47121.699.059415817913622.5405841820863
48129.698.359735849826631.2402641501734
49124.598.123573480426326.3764265195737
50130.198.043657336026932.0563426639731
51142.394.224015090514648.0759849094854
5214091.666132912576548.3338670874235
53143.386.31602067130456.9839793286961
54113.483.594104270495829.8058957295043
55113.895.064616886804618.7353831131954
56120.792.302346442759428.3976535572406
57112.990.775029439026422.1249705609737
58115.595.481713702441720.0182862975583
59121.998.606023092080323.2939769079197
60119.397.428908573440621.8710914265594
6111199.269442203713711.7305577962863
62114.298.08117289422416.1188271057760
63113.593.755763988900719.7442360110993
649491.36004515075582.63995484924417
6583.286.2730402179489-3.07304021794885
6682.884.9892884493454-2.18928844934544
6785.893.9708365960246-8.17083659602456
6888.796.1364101934678-7.43641019346775
69105.395.8905828614479.40941713855305
70113.199.631784453676713.4682155463233
71113.895.340465083123118.4595349168769
72109.494.306217372776915.0937826272231
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/17/t1197920702hpwx5e66cf0s4bm/141sx1197921679.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/17/t1197920702hpwx5e66cf0s4bm/141sx1197921679.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/17/t1197920702hpwx5e66cf0s4bm/26rr41197921679.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/17/t1197920702hpwx5e66cf0s4bm/26rr41197921679.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/17/t1197920702hpwx5e66cf0s4bm/355ib1197921680.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/17/t1197920702hpwx5e66cf0s4bm/355ib1197921680.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/17/t1197920702hpwx5e66cf0s4bm/4vy1m1197921680.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/17/t1197920702hpwx5e66cf0s4bm/4vy1m1197921680.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/17/t1197920702hpwx5e66cf0s4bm/5v2j91197921680.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/17/t1197920702hpwx5e66cf0s4bm/5v2j91197921680.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/17/t1197920702hpwx5e66cf0s4bm/6ouud1197921680.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/17/t1197920702hpwx5e66cf0s4bm/6ouud1197921680.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/17/t1197920702hpwx5e66cf0s4bm/7vqrx1197921680.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/17/t1197920702hpwx5e66cf0s4bm/7vqrx1197921680.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/17/t1197920702hpwx5e66cf0s4bm/8rh1t1197921680.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/17/t1197920702hpwx5e66cf0s4bm/8rh1t1197921680.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/17/t1197920702hpwx5e66cf0s4bm/9akhd1197921680.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/17/t1197920702hpwx5e66cf0s4bm/9akhd1197921680.ps (open in new window)


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

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