Home » date » 2007 » Dec » 04 » attachments

Paper

R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Tue, 04 Dec 2007 08:10:23 -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/04/t1196781019jtp168vfdh4bcqq.htm/, Retrieved Tue, 04 Dec 2007 16:10:29 +0100
 
User-defined keywords:
Paper regressie, alle variabelen
 
Dataseries X:
» Textbox « » Textfile « » CSV «
106,7 97,3 0 104,8 93,5 110,2 101 0 105,6 94,7 125,9 113,2 0 118,3 112,9 100,1 101 0 89,9 99,2 106,4 105,7 0 90,2 105,6 114,8 113,9 0 107 113 81,3 86,4 0 64,5 83,1 87 96,5 0 92,6 81,1 104,2 103,3 0 95,8 96,9 108 114,9 0 94,3 104,3 105 105,8 0 91,2 97,7 94,5 94,2 0 86,3 102,6 92 98,4 0 77,6 89,9 95,9 99,4 0 82,5 96 108,8 108,8 0 97,7 112,7 103,4 112,6 0 83,3 107,1 102,1 104,4 0 84,2 106,2 110,1 112,2 0 92,8 121 83,2 81,1 0 77,4 101,2 82,7 97,1 0 72,5 83,2 106,8 112,6 0 88,8 105,1 113,7 113,8 0 93,4 113,3 102,5 107,8 0 92,6 99,1 96,6 103,2 0 90,7 100,3 92,1 103,3 0 81,6 93,5 95,6 101,2 0 84,1 98,8 102,3 107,7 0 88,1 106,2 98,6 110,4 0 85,3 98,3 98,2 101,9 0 82,9 102,1 104,5 115,9 0 84,8 117,1 84 89,9 0 71,2 101,5 73,8 88,6 0 68,9 80,5 103,9 117,2 0 94,3 105,9 106 123,9 0 97,6 109,5 97,2 100 0 85,6 97,2 102,6 103,6 0 91,9 114,5 89 94,1 0 75,8 93,5 93,8 98,7 0 79,8 100,9 116,7 119,5 0 99 121,1 106,8 112,7 0 88,5 116,5 98,5 104,4 0 86,7 109,3 118,7 124,7 0 97,9 118,1 90 89,1 0 94,3 108,3 91,9 97 0 72,9 105,4 113,3 121,6 0 91,8 116,2 113,1 118,8 0 93,2 111,2 104,1 114 0 86,5 105,8 108,7 111,5 0 98,9 122,7 96,7 97,2 0 77,2 99,5 101 102,5 0 79,4 107,9 116,9 113,4 0 90,4 124,6 105,8 109,8 0 81,4 115 99 104,9 0 85,8 110,3 129,4 126,1 0 103,6 132,7 83 80 0 73,6 99,7 88,9 96,8 0 75,7 96,5 115,9 117,2 1 99,2 118,7 104,2 112,3 1 88,7 112,9 113,4 117,3 1 94,6 130,5 112,2 111,1 1 98,7 137,9 100,8 102,2 1 84,2 115 107,3 104,3 1 87,7 116,8 126,6 122,9 1 103,3 140,9 102,9 107,6 1 88,2 120,7 117,9 121,3 1 93,4 134,2 128,8 131,5 1 106,3 147,3 87,5 89 1 73,1 112,4 93,8 104,4 1 78,6 107,1 122,7 128,9 1 101,6 128,4 126,2 135,9 1 101,4 137,7 124,6 133,3 1 98,5 135 116,7 121,3 1 99 151 115,2 120,5 1 89,5 137,4 111,1 120,4 1 83,5 132,4 129,9 137,9 1 97,4 161,3 113,3 126,1 1 87,8 139,8 118,5 133,2 1 90,4 146 133,5 146,6 1 97,1 154,6 102,1 103,4 1 79,4 142,1 102,4 117,2 1 85 120,5
 
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 time3 seconds
R Server'Gwilym Jenkins' @ 72.249.127.135


Multiple Linear Regression - Estimated Regression Equation
metaal[t] = + 20.8675860424059 + 1.12593999912943Totaal[t] + 1.60887221363666conjunctuur[t] -0.339736946221387elektrische[t] + 0.00158058220510757mac[t] + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)20.86758604240596.1648963.38490.0011360.000568
Totaal1.125939999129430.1375138.187900
conjunctuur1.608872213636662.0039330.80290.4245940.212297
elektrische-0.3397369462213870.117824-2.88340.005130.002565
mac0.001580582205107570.0838510.01880.9850110.492505


Multiple Linear Regression - Regression Statistics
Multiple R0.919833866017206
R-squared0.846094341072158
Adjusted R-squared0.837886039262674
F-TEST (value)103.077879043687
F-TEST (DF numerator)4
F-TEST (DF denominator)75
p-value0
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation5.31645716657112
Sum Squared Residuals2119.85376029891


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
197.3105.548736421692-8.24873642169238
2101109.219633560315-8.2196335603146
3113.2122.610998925768-9.41099892576796
4101103.188622244706-2.18862224470599
5105.7110.190238881468-4.49023888146771
6113.9113.952250485953-0.052250485953429
786.490.6248213215937-4.22482132159366
896.587.49290996340039.00709003659976
9103.3105.796892919359-2.49689291935876
10114.9110.5967666437004.30323335629953
11105.8108.261699337045-2.46169933704477
1294.298.1117852354756-3.91178523547554
1398.498.23257327577320.16742672422684
1499.4100.968669787344-1.56866978734431
15108.8110.355689916374-1.55568991637421
16112.6109.1589746863153.44102531368534
17104.4107.388066911863-2.98806691186252
18112.2113.497241784030-1.29724178402966
1981.188.4101092515961-7.31010925159615
2097.189.48339980882437.6166001911757
21112.6111.1154563147271.48454368527312
22113.8117.334613130183-3.53461313018347
23107.8104.9734304295982.8265695704016
24103.298.97778133120154.22221866879851
25103.396.9919095867396.30809041326106
26101.2100.0917343038261.10826569617444
27107.7106.2882808214251.41171917857499
28110.4103.0610796746467.33892032535437
29101.9103.432078558305-1.53207855830461
30115.9109.9037090880765.99629091192399
3189.991.4177044921338-1.51770449213382
3288.680.68131925101557.91868074898446
33117.2105.98294157879811.2170584212020
34123.9107.23197375037816.6680262496224
35100101.381103951572-1.38110395157241
36103.6105.348181257825-1.74818125782496
3794.195.4719698775218-1.37196987752176
3898.799.5292303967753-0.829230396775268
39119.5118.8222347699320.677765230068165
40112.7111.2353960357321.46460396426849
41104.4102.4902403542791.90975964572106
42124.7121.4430836624193.2569163375811
4389.190.3361689881911-1.23616898819112
449799.74124194728-2.74124194727991
45121.6117.4323999328814.16760006711928
46118.8116.7236772973192.07632270268065
47114108.8579197009305.14208029906984
48111.5109.8512174030471.64878259695332
4997.2103.675559639339-6.47555963933909
50102.5107.782957244432-5.2829572444315
51113.4121.974692544980-8.57469254497952
52109.8112.519217481466-2.71921748146627
53104.9103.3605541876481.53944581235199
54126.1131.577217559836-5.47721755983652
558089.4735507741039-9.47355077410387
5696.895.39809131884631.40190868115373
57117.2119.458614197728-2.25861419772842
58112.3109.8431867664492.45681323355101
59117.3118.225205022543-0.925205022543493
60111.1115.492851852398-4.39285185239828
61102.2107.547126250036-5.34712625003588
62104.3113.679501980572-9.37950198057154
63122.9130.148339633859-7.24833963385904
64107.6108.561661781891-0.96166178189127
65121.3123.705467508250-2.4054675082505
66131.5131.616312519392-0.116312519392342
678996.3390948509386-7.33909485093855
68104.4101.5555865555492.84441344445074
69128.9126.3149691682672.58503083173323
70135.9130.3384059689725.56159403102844
71133.3129.5178715424533.78212845754731
72121.3120.4783663915010.82163360849878
73120.5121.995461463921-1.49546146392078
74120.4119.4096262337930.990373766207122
75137.9135.9006334906771.99936650932344
76126.1120.4375216714435.66247832855652
77133.2125.4188932164137.7811067835874
78146.6140.0453486706356.55465132936528
79103.4110.684419368525-7.28441936852521
80117.2109.0855338937948.11446610620604
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/04/t1196781019jtp168vfdh4bcqq/145au1196781018.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/04/t1196781019jtp168vfdh4bcqq/145au1196781018.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/04/t1196781019jtp168vfdh4bcqq/2dxz01196781018.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/04/t1196781019jtp168vfdh4bcqq/2dxz01196781018.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/04/t1196781019jtp168vfdh4bcqq/3qotv1196781018.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/04/t1196781019jtp168vfdh4bcqq/3qotv1196781018.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/04/t1196781019jtp168vfdh4bcqq/4cuyw1196781018.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/04/t1196781019jtp168vfdh4bcqq/4cuyw1196781018.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/04/t1196781019jtp168vfdh4bcqq/5imct1196781018.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/04/t1196781019jtp168vfdh4bcqq/5imct1196781018.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/04/t1196781019jtp168vfdh4bcqq/6op0p1196781018.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/04/t1196781019jtp168vfdh4bcqq/6op0p1196781018.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/04/t1196781019jtp168vfdh4bcqq/7mz351196781018.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/04/t1196781019jtp168vfdh4bcqq/7mz351196781018.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/04/t1196781019jtp168vfdh4bcqq/8trid1196781018.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/04/t1196781019jtp168vfdh4bcqq/8trid1196781018.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/04/t1196781019jtp168vfdh4bcqq/9kk4b1196781018.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/04/t1196781019jtp168vfdh4bcqq/9kk4b1196781018.ps (open in new window)


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