Home » date » 2007 » Dec » 15 » attachments

R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Sat, 15 Dec 2007 07:30:57 -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/15/t1197728111onmz5na4yi91dx2.htm/, Retrieved Sat, 15 Dec 2007 15:15:21 +0100
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
99.5 0 101.6 0 103.9 0 106.6 0 108.3 0 102 0 93.8 0 91.6 0 97.7 0 94.8 0 98 0 103.8 0 97.8 0 91.2 0 89.3 0 87.5 0 90.4 0 94.2 0 102.2 0 101.3 0 96 0 90.8 0 93.2 0 90.9 0 91.1 0 90.2 0 94.3 0 96 0 99 0 103.3 0 113.1 0 112.8 0 112.1 0 107.4 0 111 0 110.5 0 110.8 0 112.4 0 111.5 0 116.2 0 122.5 0 121.3 0 113.9 0 110.7 0 120.8 0 141.1 1 147.4 1 148 1 158.1 1 165 1 187 1 190.3 1 182.4 1 168.8 1 151.2 1 120.1 0 112.5 0 106.2 0 107.1 0 108.5 0 106.5 0 108.3 0 125.6 0 124 0 127.2 0 136.9 0 135.8 0 124.3 0 115.4 0 113.6 0 114.4 0 118.4 0 117 0 116.5 0 115.4 0 113.6 0 117.4 0 116.9 0 116.4 0 111.1 0 110.2 0 118.9 0 131.8 0 130.6 0 138.3 0 148.4 0 148.7 0 144.3 0 152.5 0 162.9 0 167.2 0 166.5 0 185.6 0
 
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
Oliezaden[t] = + 108.461953652097 + 51.4663244353184Fluctuatie[t] -0.0077442065121429M1[t] + 1.80475579348780M2[t] + 7.06725579348783M3[t] + 7.41725579348786M4[t] + 10.0672557934878M5[t] + 10.8922557934878M6[t] + 9.30475579348785M7[t] + 8.83804634790263M8[t] + 10.3255463479026M9[t] -5.41428571428569M10[t] -1.11428571428569M11[t] + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)108.4619536520977.55860314.349500
Fluctuatie51.46632443531846.7263897.651400
M1-0.007744206512142910.266769-8e-040.99940.4997
M21.8047557934878010.2667690.17580.8609060.430453
M37.0672557934878310.2667690.68840.4932160.246608
M47.4172557934878610.2667690.72250.4721230.236061
M510.067255793487810.2667690.98060.3297620.164881
M610.892255793487810.2667691.06090.2919170.145959
M79.3047557934878510.2667690.90630.36750.18375
M88.8380463479026310.3109390.85720.3939210.196961
M910.325546347902610.3109391.00140.3196450.159822
M10-5.4142857142856910.602748-0.51060.6110030.305501
M11-1.1142857142856910.602748-0.10510.9165640.458282


Multiple Linear Regression - Regression Statistics
Multiple R0.665170802242955
R-squared0.442452196156536
Adjusted R-squared0.358820025580017
F-TEST (value)5.29045453569465
F-TEST (DF numerator)12
F-TEST (DF denominator)80
p-value1.72666663089682e-06
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation19.8359247378468
Sum Squared Residuals31477.1128164418


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
199.5108.454209445585-8.95420944558508
2101.6110.266709445586-8.66670944558562
3103.9115.529209445585-11.6292094455852
4106.6115.879209445585-9.27920944558523
5108.3118.529209445585-10.2292094455852
6102119.354209445585-17.3542094455853
793.8117.766709445585-23.9667094455852
891.6117.3-25.7
997.7118.7875-21.0875000000000
1094.8103.047667937812-8.24766793781169
1198107.347667937812-9.34766793781168
12103.8108.461953652097-4.66195365209737
1397.8108.454209445585-10.6542094455852
1491.2110.266709445585-19.0667094455852
1589.3115.529209445585-26.2292094455852
1687.5115.879209445585-28.3792094455852
1790.4118.529209445585-28.1292094455852
1894.2119.354209445585-25.1542094455852
19102.2117.766709445585-15.5667094455852
20101.3117.3-16
2196118.7875-22.7875
2290.8103.047667937812-12.2476679378117
2393.2107.347667937812-14.1476679378117
2490.9108.461953652097-17.5619536520974
2591.1108.454209445585-17.3542094455852
2690.2110.266709445585-20.0667094455852
2794.3115.529209445585-21.2292094455852
2896115.879209445585-19.8792094455852
2999118.529209445585-19.5292094455852
30103.3119.354209445585-16.0542094455852
31113.1117.766709445585-4.66670944558523
32112.8117.3-4.5
33112.1118.7875-6.6875
34107.4103.0476679378124.35233206218833
35111107.3476679378123.65233206218832
36110.5108.4619536520972.03804634790263
37110.8108.4542094455852.34579055441477
38112.4110.2667094455852.13329055441485
39111.5115.529209445585-4.02920944558522
40116.2115.8792094455850.320790554414797
41122.5118.5292094455853.97079055441477
42121.3119.3542094455851.94579055441478
43113.9117.766709445585-3.86670944558522
44110.7117.3-6.59999999999999
45120.8118.78752.01250000000000
46141.1154.51399237313-13.4139923731299
47147.4158.81399237313-11.4139923731299
48148159.928278087416-11.9282780874156
49158.1159.920533880904-1.82053388090351
50165161.7330338809033.26696611909656
51187166.99553388090420.0044661190965
52190.3167.34553388090322.9544661190965
53182.4169.99553388090412.4044661190965
54168.8170.820533880903-2.02053388090348
55151.2169.233033880904-18.0330338809035
56120.1117.32.80000000000000
57112.5118.7875-6.2875
58106.2103.0476679378123.15233206218833
59107.1107.347667937812-0.247667937811685
60108.5108.4619536520970.0380463479026356
61106.5108.454209445585-1.95420944558523
62108.3110.266709445585-1.96670944558516
63125.6115.52920944558510.0707905544148
64124115.8792094455858.1207905544148
65127.2118.5292094455858.67079055441478
66136.9119.35420944558517.5457905544148
67135.8117.76670944558518.0332905544148
68124.3117.37
69115.4118.7875-3.38749999999999
70113.6103.04766793781210.5523320621883
71114.4107.3476679378127.05233206218833
72118.4108.4619536520979.93804634790264
73117108.4542094455858.54579055441477
74116.5110.2667094455856.23329055441484
75115.4115.529209445585-0.129209445585217
76113.6115.879209445585-2.27920944558521
77117.4118.529209445585-1.12920944558522
78116.9119.354209445585-2.45420944558521
79116.4117.766709445585-1.36670944558522
80111.1117.3-6.2
81110.2118.7875-8.5875
82118.9103.04766793781215.8523320621883
83131.8107.34766793781224.4523320621883
84130.6108.46195365209722.1380463479026
85138.3108.45420944558529.8457905544148
86148.4110.26670944558538.1332905544148
87148.7115.52920944558533.1707905544148
88144.3115.87920944558528.4207905544148
89152.5118.52920944558533.9707905544148
90162.9119.35420944558543.5457905544148
91167.2117.76670944558549.4332905544148
92166.5117.349.2
93185.6118.787566.8125
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728111onmz5na4yi91dx2/1qk7o1197729052.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728111onmz5na4yi91dx2/1qk7o1197729052.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728111onmz5na4yi91dx2/2h1js1197729052.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728111onmz5na4yi91dx2/2h1js1197729052.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728111onmz5na4yi91dx2/3arsz1197729052.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728111onmz5na4yi91dx2/3arsz1197729052.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728111onmz5na4yi91dx2/4952y1197729052.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728111onmz5na4yi91dx2/4952y1197729052.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728111onmz5na4yi91dx2/5urjd1197729052.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728111onmz5na4yi91dx2/5urjd1197729052.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728111onmz5na4yi91dx2/68rmi1197729052.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728111onmz5na4yi91dx2/68rmi1197729052.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728111onmz5na4yi91dx2/7r02i1197729052.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728111onmz5na4yi91dx2/7r02i1197729052.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728111onmz5na4yi91dx2/8n6dk1197729052.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728111onmz5na4yi91dx2/8n6dk1197729052.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728111onmz5na4yi91dx2/90jng1197729052.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728111onmz5na4yi91dx2/90jng1197729052.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:

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